Raymond Toy pushed to branch master at cmucl / cmucl

Commits:

3 changed files:

Changes:

  • src/lisp/Config.x86_common
    ... ... @@ -95,10 +95,49 @@ CORE_MATH_SRCS = $(CORE64_SRCS) $(CORE32_SRCS)
    95 95
     
    
    96 96
     endif
    
    97 97
     
    
    98
    +# If core-math is not defined such as on Darwin, we use the code from
    
    99
    +# openlibm to implement the special functions for single-floats.
    
    100
    +ifndef FEATURE_CORE_MATH
    
    101
    +OPENLIBM_DIR = openlibm
    
    102
    +OPENLIBM_SRCS = \
    
    103
    +	$(OPENLIBM_DIR)/e_acosf.c \
    
    104
    +	$(OPENLIBM_DIR)/e_acoshf.c \
    
    105
    +	$(OPENLIBM_DIR)/e_asinf.c \
    
    106
    +	$(OPENLIBM_DIR)/e_atan2f.c \
    
    107
    +	$(OPENLIBM_DIR)/e_atanhf.c \
    
    108
    +	$(OPENLIBM_DIR)/e_coshf.c \
    
    109
    +	$(OPENLIBM_DIR)/e_expf.c \
    
    110
    +	$(OPENLIBM_DIR)/e_hypotf.c \
    
    111
    +	$(OPENLIBM_DIR)/e_log10f.c \
    
    112
    +	$(OPENLIBM_DIR)/e_logf.c \
    
    113
    +	$(OPENLIBM_DIR)/e_powf.c \
    
    114
    +	$(OPENLIBM_DIR)/e_rem_pio2f.c \
    
    115
    +	$(OPENLIBM_DIR)/e_sinhf.c \
    
    116
    +	$(OPENLIBM_DIR)/k_cosf.c \
    
    117
    +	$(OPENLIBM_DIR)/k_sinf.c \
    
    118
    +	$(OPENLIBM_DIR)/k_tanf.c \
    
    119
    +	$(OPENLIBM_DIR)/k_expf.c \
    
    120
    +	$(OPENLIBM_DIR)/s_asinhf.c \
    
    121
    +	$(OPENLIBM_DIR)/s_atanf.c \
    
    122
    +	$(OPENLIBM_DIR)/s_cosf.c \
    
    123
    +	$(OPENLIBM_DIR)/s_expm1f.c \
    
    124
    +	$(OPENLIBM_DIR)/s_log1pf.c \
    
    125
    +	$(OPENLIBM_DIR)/s_sinf.c \
    
    126
    +	$(OPENLIBM_DIR)/s_sincosf.c \
    
    127
    +	$(OPENLIBM_DIR)/s_tanf.c \
    
    128
    +	$(OPENLIBM_DIR)/s_tanhf.c
    
    129
    +endif
    
    130
    +
    
    98 131
     ifeq ($(filter 2% 3%, $(shell $(CC) -dumpversion)),)
    
    99 132
     CPP_INCLUDE_OPTIONS := -iquote . -iquote $(PATH1)
    
    133
    +ifndef FEATURE_CORE_MATH
    
    134
    +CPP_INCLUDE_OPTIONS += -I $(PATH1)/$(OPENLIBM_DIR) -DOPENLIBM_USE_HOST_MATH_H
    
    135
    +endif
    
    100 136
     else
    
    101
    -CPP_INCLUDE_OPTIONS := -I. -I$(PATH1) -I-
    
    137
    +CPP_INCLUDE_OPTIONS := -I. -I$(PATH1) -I $(OPENLIBM_DIR) -I-
    
    138
    +ifndef FEATURE_CORE_MATH
    
    139
    +CPP_INCLUDE_OPTIONS += -I $(PATH1)/$(OPENLIBM_DIR)
    
    140
    +endif
    
    102 141
     endif
    
    103 142
     
    
    104 143
     CPPFLAGS := $(CPP_DEFINE_OPTIONS) $(CPP_INCLUDE_OPTIONS) 
    

  • src/lisp/GNUmakefile
    ... ... @@ -37,6 +37,7 @@ SRCS = lisp.c coreparse.c alloc.c monitor.c print.c interr.c \
    37 37
     	runprog.c time.c case-mapping.c exec-init.c \
    
    38 38
     	irrat.c \
    
    39 39
     	${CORE_MATH_SRCS} \
    
    40
    +	${OPENLIBM_SRCS} \
    
    40 41
     	${FDLIBM} ${ARCH_SRC} ${ASSEM_SRC} ${OS_SRC} ${GC_SRC}
    
    41 42
     
    
    42 43
     
    

  • src/lisp/irrat.c
    ... ... @@ -54,6 +54,8 @@ extern float cr_hypotf(float, float);
    54 54
     extern float cr_log1pf(float);
    
    55 55
     extern float cr_expm1f(float);
    
    56 56
     extern void cr_sincosf(float, float *, float *);
    
    57
    +#else
    
    58
    +#include "openlibm_math.h"
    
    57 59
     #endif
    
    58 60
     
    
    59 61
     
    
    ... ... @@ -348,7 +350,7 @@ lisp_sinf(float x)
    348 350
     #ifdef FEATURE_CORE_MATH
    
    349 351
         return cr_sinf(x);
    
    350 352
     #else    
    
    351
    -    return (float) fdlibm_sin((double) x);
    
    353
    +    return sinf(x);
    
    352 354
     #endif    
    
    353 355
     }
    
    354 356
     
    
    ... ... @@ -358,7 +360,7 @@ lisp_cosf(float x)
    358 360
     #ifdef FEATURE_CORE_MATH
    
    359 361
         return cr_cosf(x);
    
    360 362
     #else    
    
    361
    -    return (float) fdlibm_cos((double) x);
    
    363
    +    return cosf(x);
    
    362 364
     #endif
    
    363 365
     }
    
    364 366
     
    
    ... ... @@ -368,7 +370,7 @@ lisp_tanf(float x)
    368 370
     #ifdef FEATURE_CORE_MATH
    
    369 371
         return cr_tanf(x);
    
    370 372
     #else    
    
    371
    -    return (float) fdlibm_tan((double) x);
    
    373
    +    return tanf(x);
    
    372 374
     #endif
    
    373 375
     }
    
    374 376
     
    
    ... ... @@ -378,7 +380,7 @@ lisp_atanf(float x)
    378 380
     #ifdef FEATURE_CORE_MATH
    
    379 381
         return cr_atanf(x);
    
    380 382
     #else    
    
    381
    -    return (float) fdlibm_atan((double) x);
    
    383
    +    return atanf(x);
    
    382 384
     #endif
    
    383 385
     }
    
    384 386
     
    
    ... ... @@ -388,7 +390,7 @@ lisp_atan2f(float y, float x)
    388 390
     #ifdef FEATURE_CORE_MATH
    
    389 391
         return cr_atan2f(y, x);
    
    390 392
     #else    
    
    391
    -    return (float) __ieee754_atan2((double) y, (double) x);
    
    393
    +    return atan2f(y, x);
    
    392 394
     #endif
    
    393 395
     }
    
    394 396
     
    
    ... ... @@ -398,7 +400,7 @@ lisp_asinf(float x)
    398 400
     #ifdef FEATURE_CORE_MATH
    
    399 401
         return cr_asinf(x);
    
    400 402
     #else    
    
    401
    -    return (float) __ieee754_asin((double) x);
    
    403
    +    return asinf(x);
    
    402 404
     #endif
    
    403 405
     }
    
    404 406
     
    
    ... ... @@ -408,7 +410,7 @@ lisp_acosf(float x)
    408 410
     #ifdef FEATURE_CORE_MATH
    
    409 411
         return cr_acosf(x);
    
    410 412
     #else    
    
    411
    -    return (float) __ieee754_acos((double) x);
    
    413
    +    return acosf(x);
    
    412 414
     #endif
    
    413 415
     }
    
    414 416
     
    
    ... ... @@ -418,7 +420,7 @@ lisp_sinhf(float x)
    418 420
     #ifdef FEATURE_CORE_MATH
    
    419 421
         return cr_sinhf(x);
    
    420 422
     #else    
    
    421
    -    return (float) __ieee754_sinh((double) x);
    
    423
    +    return sinhf(x);
    
    422 424
     #endif
    
    423 425
     }
    
    424 426
     
    
    ... ... @@ -428,7 +430,7 @@ lisp_coshf(float x)
    428 430
     #ifdef FEATURE_CORE_MATH
    
    429 431
         return cr_coshf(x);
    
    430 432
     #else    
    
    431
    -    return (float) __ieee754_cosh((double) x);
    
    433
    +    return coshf(x);
    
    432 434
     #endif
    
    433 435
     }
    
    434 436
     
    
    ... ... @@ -438,7 +440,7 @@ lisp_tanhf(float x)
    438 440
     #ifdef FEATURE_CORE_MATH
    
    439 441
         return cr_tanhf(x);
    
    440 442
     #else    
    
    441
    -    return (float) fdlibm_tanh((double) x);
    
    443
    +    return tanhf(x);
    
    442 444
     #endif
    
    443 445
     }
    
    444 446
     
    
    ... ... @@ -448,7 +450,7 @@ lisp_asinhf(float x)
    448 450
     #ifdef FEATURE_CORE_MATH
    
    449 451
         return cr_asinhf(x);
    
    450 452
     #else    
    
    451
    -    return (float) fdlibm_asinh((double) x);
    
    453
    +    return asinhf((double) x);
    
    452 454
     #endif
    
    453 455
     }
    
    454 456
     
    
    ... ... @@ -458,7 +460,7 @@ lisp_acoshf(float x)
    458 460
     #ifdef FEATURE_CORE_MATH
    
    459 461
         return cr_acoshf(x);
    
    460 462
     #else    
    
    461
    -    return (float) __ieee754_acosh((double) x);
    
    463
    +    return acoshf(x);
    
    462 464
     #endif
    
    463 465
     }
    
    464 466
     
    
    ... ... @@ -468,7 +470,7 @@ lisp_atanhf(float x)
    468 470
     #ifdef FEATURE_CORE_MATH
    
    469 471
         return cr_atanhf(x);
    
    470 472
     #else    
    
    471
    -    return (float) __ieee754_atanh((double) x);
    
    473
    +    return atanhf(x);
    
    472 474
     #endif
    
    473 475
     }
    
    474 476
     
    
    ... ... @@ -478,7 +480,7 @@ lisp_expf(float x)
    478 480
     #ifdef FEATURE_CORE_MATH
    
    479 481
         return cr_expf(x);
    
    480 482
     #else    
    
    481
    -    return (float) __ieee754_exp((double) x);
    
    483
    +    return expf(x);
    
    482 484
     #endif
    
    483 485
     }
    
    484 486
     
    
    ... ... @@ -488,7 +490,7 @@ lisp_logf(float x)
    488 490
     #ifdef FEATURE_CORE_MATH
    
    489 491
         return cr_logf(x);
    
    490 492
     #else    
    
    491
    -    return (float) __ieee754_log((double) x);
    
    493
    +    return log(x);
    
    492 494
     #endif
    
    493 495
     }
    
    494 496
     
    
    ... ... @@ -498,7 +500,7 @@ lisp_log10f(float x)
    498 500
     #ifdef FEATURE_CORE_MATH
    
    499 501
         return cr_log10f(x);
    
    500 502
     #else    
    
    501
    -    return (float) __ieee754_log10((double) x);
    
    503
    +    return log10f(x);
    
    502 504
     #endif
    
    503 505
     }
    
    504 506
     
    
    ... ... @@ -520,7 +522,7 @@ lisp_powf(float x, float y)
    520 522
          * just use fdlibm for now until we can figure out what's causing
    
    521 523
          * the failure.
    
    522 524
          */
    
    523
    -    return (float) __ieee754_pow((double) x, (double) y);
    
    525
    +    return pow(x, y);
    
    524 526
     #endif
    
    525 527
     }
    
    526 528
     
    
    ... ... @@ -530,7 +532,7 @@ lisp_hypotf(float x, float y)
    530 532
     #ifdef FEATURE_CORE_MATH
    
    531 533
         return cr_hypotf(x, y);
    
    532 534
     #else    
    
    533
    -    return (float) __ieee754_hypot((double) x, (double) y);
    
    535
    +    return hypotf(x, y);
    
    534 536
     #endif
    
    535 537
     }
    
    536 538
     
    
    ... ... @@ -540,7 +542,7 @@ lisp_log1pf(float x)
    540 542
     #ifdef FEATURE_CORE_MATH
    
    541 543
         return cr_log1pf(x);
    
    542 544
     #else    
    
    543
    -    return (float) fdlibm_log1p((double) x);
    
    545
    +    return log1pf(x);
    
    544 546
     #endif
    
    545 547
     }
    
    546 548
     
    
    ... ... @@ -550,7 +552,7 @@ lisp_expm1f(float x)
    550 552
     #ifdef FEATURE_CORE_MATH
    
    551 553
         return cr_expm1f(x);
    
    552 554
     #else    
    
    553
    -    return (float) fdlibm_expm1((double) x);
    
    555
    +    return expm1f(x);
    
    554 556
     #endif
    
    555 557
     }
    
    556 558
     
    
    ... ... @@ -560,11 +562,8 @@ lisp_sincosf(float x, float *s, float *c)
    560 562
     #ifdef FEATURE_CORE_MATH
    
    561 563
         cr_sincosf(x, s, c);
    
    562 564
     #else    
    
    563
    -    extern void cmucl_sincos(double, double*, double*);
    
    564
    -    double ds, dc;
    
    565
    -    
    
    566
    -    cmucl_sincos((double) x, &ds, &dc);
    
    567
    -    *s = (float) ds;
    
    568
    -    *c = (float) dc;
    
    565
    +    extern void sincosf(float x, float *s, float *c);
    
    566
    +
    
    567
    +    sincosf(x, s, c);
    
    569 568
     #endif
    
    570 569
     }