Skip to content

Commit 310fd28

Browse files
authored
Merge pull request #1322 from herbie-fp/codex/add-#-fpcore-argument-to-define-operations
Add #:fpcore argument
2 parents 5094e9b + 1a2dd84 commit 310fd28

File tree

2 files changed

+147
-147
lines changed

2 files changed

+147
-147
lines changed

src/platforms/c.rkt

Lines changed: 138 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -37,73 +37,75 @@
3737
[<=.f32 #:spec (<= x y) #:impl <= #:cost 32bit-move-cost]
3838
[>=.f32 #:spec (>= x y) #:impl >= #:cost 32bit-move-cost])
3939

40-
(parameterize ([fpcore-context '(:precision binary32)])
41-
(define-operations () <binary32>
42-
[PI.f32 #:spec (PI) #:impl (const (flsingle pi)) #:fpcore PI #:cost 32bit-move-cost]
43-
[E.f32 #:spec (E) #:impl (const (flsingle (exp 1))) #:fpcore E #:cost 32bit-move-cost]
44-
[INFINITY.f32 #:spec (INFINITY) #:impl (const +inf.0) #:fpcore INFINITY #:cost 32bit-move-cost]
45-
[NAN.f32 #:spec (NAN) #:impl (const +nan.0) #:fpcore NAN #:cost 32bit-move-cost])
46-
47-
(define-operation (neg.f32 [x <binary32>]) <binary32>
48-
#:spec (neg x) #:impl (compose flsingle -) #:fpcore (- x) #:cost 0.125)
49-
50-
(define-operations ([x <binary32>] [y <binary32>]) <binary32>
51-
[+.f32 #:spec (+ x y) #:impl (compose flsingle +) #:cost 0.200]
52-
[-.f32 #:spec (- x y) #:impl (compose flsingle -) #:cost 0.200]
53-
[*.f32 #:spec (* x y) #:impl (compose flsingle *) #:cost 0.250]
54-
[/.f32 #:spec (/ x y) #:impl (compose flsingle /) #:cost 0.350])
55-
56-
(define-operations ([x <binary32>]) <binary32>
57-
[fabs.f32 #:spec (fabs x) #:impl (from-libm 'fabsf) #:cost 0.125]
58-
[sin.f32 #:spec (sin x) #:impl (from-libm 'sinf) #:cost 4.250]
59-
[cos.f32 #:spec (cos x) #:impl (from-libm 'cosf) #:cost 4.250]
60-
[tan.f32 #:spec (tan x) #:impl (from-libm 'tanf) #:cost 4.750]
61-
[sinh.f32 #:spec (sinh x) #:impl (from-libm 'sinhf) #:cost 1.750]
62-
[cosh.f32 #:spec (cosh x) #:impl (from-libm 'coshf) #:cost 1.250]
63-
[acos.f32 #:spec (acos x) #:impl (from-libm 'acosf) #:cost 0.500]
64-
[acosh.f32 #:spec (acosh x) #:impl (from-libm 'acoshf) #:cost 0.850]
65-
[asin.f32 #:spec (asin x) #:impl (from-libm 'asinf) #:cost 0.500]
66-
[asinh.f32 #:spec (asinh x) #:impl (from-libm 'asinhf) #:cost 1.125]
67-
[atan.f32 #:spec (atan x) #:impl (from-libm 'atanf) #:cost 1.100]
68-
[atanh.f32 #:spec (atanh x) #:impl (from-libm 'atanhf) #:cost 0.500]
69-
[cbrt.f32 #:spec (cbrt x) #:impl (from-libm 'cbrtf) #:cost 2.000]
70-
[ceil.f32 #:spec (ceil x) #:impl (from-libm 'ceilf) #:cost 0.250]
71-
[erf.f32 #:spec (erf x) #:impl (from-libm 'erff) #:cost 1.125]
72-
[exp.f32 #:spec (exp x) #:impl (from-libm 'expf) #:cost 1.375]
73-
[exp2.f32 #:spec (exp2 x) #:impl (from-libm 'exp2f) #:cost 1.175]
74-
[floor.f32 #:spec (floor x) #:impl (from-libm 'floorf) #:cost 0.250]
75-
[lgamma.f32 #:spec (lgamma x) #:impl (from-libm 'lgammaf) #:cost 2.250]
76-
[log.f32 #:spec (log x) #:impl (from-libm 'logf) #:cost 0.750]
77-
[log10.f32 #:spec (log10 x) #:impl (from-libm 'log10f) #:cost 1.175]
78-
[log2.f32 #:spec (log2 x) #:impl (from-libm 'log2f) #:cost 0.875]
79-
[logb.f32 #:spec (logb x) #:impl (from-libm 'logbf) #:cost 0.375]
80-
[rint.f32 #:spec (rint x) #:impl (from-libm 'rintf) #:cost 0.300]
81-
[round.f32 #:spec (round x) #:impl (from-libm 'roundf) #:cost 0.875]
82-
[sqrt.f32 #:spec (sqrt x) #:impl (from-libm 'sqrtf) #:cost 0.250]
83-
[tanh.f32 #:spec (tanh x) #:impl (from-libm 'tanhf) #:cost 1.000]
84-
[tgamma.f32 #:spec (tgamma x) #:impl (from-libm 'tgammaf) #:cost 2.625]
85-
[trunc.f32 #:spec (trunc x) #:impl (from-libm 'truncf) #:cost 0.275])
86-
87-
(define-operations ([x <binary32>] [y <binary32>]) <binary32>
88-
[pow.f32 #:spec (pow x y) #:impl (from-libm 'powf) #:cost 2.000]
89-
[atan2.f32 #:spec (atan2 x y) #:impl (from-libm 'atan2f) #:cost 2.000]
90-
[copysign.f32 #:spec (copysign x y) #:impl (from-libm 'copysignf) #:cost 0.200]
91-
[fdim.f32 #:spec (fdim x y) #:impl (from-libm 'fdimf) #:cost 0.750]
92-
[fmax.f32 #:spec (fmax x y) #:impl (from-libm 'fmaxf) #:cost 0.250]
93-
[fmin.f32 #:spec (fmin x y) #:impl (from-libm 'fminf) #:cost 0.250]
94-
[fmod.f32 #:spec (fmod x y) #:impl (from-libm 'fmodf) #:cost 1.750]
95-
[remainder.f32 #:spec (remainder x y) #:impl (from-libm 'remainderf) #:cost 1.000])
96-
97-
(define-operations ([x <binary32>]) <binary32>
98-
[erfc.f32 #:spec (- 1 (erf x)) #:impl (from-libm 'erfcf) #:fpcore (erfc x) #:cost 0.900]
99-
[expm1.f32 #:spec (- (exp x) 1) #:impl (from-libm 'expm1f) #:fpcore (expm1 x) #:cost 0.900]
100-
[log1p.f32 #:spec (log (+ 1 x)) #:impl (from-libm 'log1pf) #:fpcore (log1p x) #:cost 1.300])
101-
102-
(define-operation (hypot.f32 [x <binary32>] [y <binary32>]) <binary32>
103-
#:spec (sqrt (+ (* x x) (* y y))) #:impl (from-libm 'hypotf) #:fpcore (hypot x y) #:cost 1.700)
104-
105-
(define-operation (fma.f32 [x <binary32>] [y <binary32>] [z <binary32>]) <binary32>
106-
#:spec (+ (* x y) z) #:impl (from-libm 'fmaf) #:fpcore (fma x y z) #:cost 0.375))
40+
(define-operations () <binary32> #:fpcore (:precision binary32)
41+
[PI.f32 #:spec (PI) #:impl (const (flsingle pi)) #:fpcore PI #:cost 32bit-move-cost]
42+
[E.f32 #:spec (E) #:impl (const (flsingle (exp 1))) #:fpcore E #:cost 32bit-move-cost]
43+
[INFINITY.f32 #:spec (INFINITY) #:impl (const +inf.0) #:fpcore INFINITY #:cost 32bit-move-cost]
44+
[NAN.f32 #:spec (NAN) #:impl (const +nan.0) #:fpcore NAN #:cost 32bit-move-cost])
45+
46+
(define-operation (neg.f32 [x <binary32>]) <binary32>
47+
#:spec (neg x) #:impl (compose flsingle -)
48+
#:fpcore (! :precision binary32 (- x)) #:cost 0.125)
49+
50+
(define-operations ([x <binary32>] [y <binary32>]) <binary32> #:fpcore (:precision binary32)
51+
[+.f32 #:spec (+ x y) #:impl (compose flsingle +) #:cost 0.200]
52+
[-.f32 #:spec (- x y) #:impl (compose flsingle -) #:cost 0.200]
53+
[*.f32 #:spec (* x y) #:impl (compose flsingle *) #:cost 0.250]
54+
[/.f32 #:spec (/ x y) #:impl (compose flsingle /) #:cost 0.350])
55+
56+
(define-operations ([x <binary32>]) <binary32> #:fpcore (:precision binary32)
57+
[fabs.f32 #:spec (fabs x) #:impl (from-libm 'fabsf) #:cost 0.125]
58+
[sin.f32 #:spec (sin x) #:impl (from-libm 'sinf) #:cost 4.250]
59+
[cos.f32 #:spec (cos x) #:impl (from-libm 'cosf) #:cost 4.250]
60+
[tan.f32 #:spec (tan x) #:impl (from-libm 'tanf) #:cost 4.750]
61+
[sinh.f32 #:spec (sinh x) #:impl (from-libm 'sinhf) #:cost 1.750]
62+
[cosh.f32 #:spec (cosh x) #:impl (from-libm 'coshf) #:cost 1.250]
63+
[acos.f32 #:spec (acos x) #:impl (from-libm 'acosf) #:cost 0.500]
64+
[acosh.f32 #:spec (acosh x) #:impl (from-libm 'acoshf) #:cost 0.850]
65+
[asin.f32 #:spec (asin x) #:impl (from-libm 'asinf) #:cost 0.500]
66+
[asinh.f32 #:spec (asinh x) #:impl (from-libm 'asinhf) #:cost 1.125]
67+
[atan.f32 #:spec (atan x) #:impl (from-libm 'atanf) #:cost 1.100]
68+
[atanh.f32 #:spec (atanh x) #:impl (from-libm 'atanhf) #:cost 0.500]
69+
[cbrt.f32 #:spec (cbrt x) #:impl (from-libm 'cbrtf) #:cost 2.000]
70+
[ceil.f32 #:spec (ceil x) #:impl (from-libm 'ceilf) #:cost 0.250]
71+
[erf.f32 #:spec (erf x) #:impl (from-libm 'erff) #:cost 1.125]
72+
[exp.f32 #:spec (exp x) #:impl (from-libm 'expf) #:cost 1.375]
73+
[exp2.f32 #:spec (exp2 x) #:impl (from-libm 'exp2f) #:cost 1.175]
74+
[floor.f32 #:spec (floor x) #:impl (from-libm 'floorf) #:cost 0.250]
75+
[lgamma.f32 #:spec (lgamma x) #:impl (from-libm 'lgammaf) #:cost 2.250]
76+
[log.f32 #:spec (log x) #:impl (from-libm 'logf) #:cost 0.750]
77+
[log10.f32 #:spec (log10 x) #:impl (from-libm 'log10f) #:cost 1.175]
78+
[log2.f32 #:spec (log2 x) #:impl (from-libm 'log2f) #:cost 0.875]
79+
[logb.f32 #:spec (logb x) #:impl (from-libm 'logbf) #:cost 0.375]
80+
[rint.f32 #:spec (rint x) #:impl (from-libm 'rintf) #:cost 0.300]
81+
[round.f32 #:spec (round x) #:impl (from-libm 'roundf) #:cost 0.875]
82+
[sqrt.f32 #:spec (sqrt x) #:impl (from-libm 'sqrtf) #:cost 0.250]
83+
[tanh.f32 #:spec (tanh x) #:impl (from-libm 'tanhf) #:cost 1.000]
84+
[tgamma.f32 #:spec (tgamma x) #:impl (from-libm 'tgammaf) #:cost 2.625]
85+
[trunc.f32 #:spec (trunc x) #:impl (from-libm 'truncf) #:cost 0.275])
86+
87+
(define-operations ([x <binary32>] [y <binary32>]) <binary32> #:fpcore (:precision binary32)
88+
[pow.f32 #:spec (pow x y) #:impl (from-libm 'powf) #:cost 2.000]
89+
[atan2.f32 #:spec (atan2 x y) #:impl (from-libm 'atan2f) #:cost 2.000]
90+
[copysign.f32 #:spec (copysign x y) #:impl (from-libm 'copysignf) #:cost 0.200]
91+
[fdim.f32 #:spec (fdim x y) #:impl (from-libm 'fdimf) #:cost 0.750]
92+
[fmax.f32 #:spec (fmax x y) #:impl (from-libm 'fmaxf) #:cost 0.250]
93+
[fmin.f32 #:spec (fmin x y) #:impl (from-libm 'fminf) #:cost 0.250]
94+
[fmod.f32 #:spec (fmod x y) #:impl (from-libm 'fmodf) #:cost 1.750]
95+
[remainder.f32 #:spec (remainder x y) #:impl (from-libm 'remainderf) #:cost 1.000])
96+
97+
(define-operations ([x <binary32>]) <binary32> #:fpcore (:precision binary32)
98+
[erfc.f32 #:spec (- 1 (erf x)) #:impl (from-libm 'erfcf) #:fpcore (erfc x) #:cost 0.900]
99+
[expm1.f32 #:spec (- (exp x) 1) #:impl (from-libm 'expm1f) #:fpcore (expm1 x) #:cost 0.900]
100+
[log1p.f32 #:spec (log (+ 1 x)) #:impl (from-libm 'log1pf) #:fpcore (log1p x) #:cost 1.300])
101+
102+
(define-operation (hypot.f32 [x <binary32>] [y <binary32>]) <binary32>
103+
#:spec (sqrt (+ (* x x) (* y y))) #:impl (from-libm 'hypotf)
104+
#:fpcore (! :precision binary32 (hypot x y)) #:cost 1.700)
105+
106+
(define-operation (fma.f32 [x <binary32>] [y <binary32>] [z <binary32>]) <binary32>
107+
#:spec (+ (* x y) z) #:impl (from-libm 'fmaf)
108+
#:fpcore (! :precision binary32 (fma x y z)) #:cost 0.375)
107109

108110
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BINARY 64 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
109111

@@ -117,78 +119,72 @@
117119
[<=.f64 #:spec (<= x y) #:impl <= #:cost 64bit-move-cost]
118120
[>=.f64 #:spec (>= x y) #:impl >= #:cost 64bit-move-cost])
119121

120-
(parameterize ([fpcore-context '(:precision binary64)])
121-
(define-operations () <binary64>
122-
[PI.f64 #:spec (PI) #:impl (const pi) #:fpcore PI #:cost 64bit-move-cost]
123-
[E.f64 #:spec (E) #:impl (const (exp 1)) #:fpcore E #:cost 64bit-move-cost]
124-
[INFINITY #:spec (INFINITY) #:impl (const +inf.0) #:fpcore INFINITY #:cost 64bit-move-cost]
125-
[NAN.f64 #:spec (NAN) #:impl (const +nan.0) #:fpcore NAN #:cost 64bit-move-cost])
126-
127-
(define-operation (neg.f64 [x <binary64>]) <binary64>
128-
#:spec (neg x) #:impl - #:fpcore (- x) #:cost 0.125)
129-
130-
(define-operations ([x <binary64>] [y <binary64>]) <binary64>
131-
[+.f64 #:spec (+ x y) #:impl + #:cost 0.200]
132-
[-.f64 #:spec (- x y) #:impl - #:cost 0.200]
133-
[*.f64 #:spec (* x y) #:impl * #:cost 0.250]
134-
[/.f64 #:spec (/ x y) #:impl / #:cost 0.350])
135-
136-
(define-operations ([x <binary64>]) <binary64>
137-
[fabs.f64 #:spec (fabs x) #:impl (from-libm 'fabs) #:cost 0.125]
138-
[sin.f64 #:spec (sin x) #:impl (from-libm 'sin) #:cost 4.200]
139-
[cos.f64 #:spec (cos x) #:impl (from-libm 'cos) #:cost 4.200]
140-
[tan.f64 #:spec (tan x) #:impl (from-libm 'tan) #:cost 4.650]
141-
[sinh.f64 #:spec (sinh x) #:impl (from-libm 'sinh) #:cost 1.750]
142-
[cosh.f64 #:spec (cosh x) #:impl (from-libm 'cosh) #:cost 1.650]
143-
[acos.f64 #:spec (acos x) #:impl (from-libm 'acos) #:cost 0.500]
144-
[acosh.f64 #:spec (acosh x) #:impl (from-libm 'acosh) #:cost 0.850]
145-
[asin.f64 #:spec (asin x) #:impl (from-libm 'asin) #:cost 0.500]
146-
[asinh.f64 #:spec (asinh x) #:impl (from-libm 'asinh) #:cost 1.125]
147-
[atan.f64 #:spec (atan x) #:impl (from-libm 'atan) #:cost 1.100]
148-
[atanh.f64 #:spec (atanh x) #:impl (from-libm 'atanh) #:cost 0.450]
149-
[cbrt.f64 #:spec (cbrt x) #:impl (from-libm 'cbrt) #:cost 2.000]
150-
[ceil.f64 #:spec (ceil x) #:impl (from-libm 'ceil) #:cost 0.250]
151-
[erf.f64 #:spec (erf x) #:impl (from-libm 'erf) #:cost 1.125]
152-
[exp.f64 #:spec (exp x) #:impl (from-libm 'exp) #:cost 1.375]
153-
[exp2.f64 #:spec (exp2 x) #:impl (from-libm 'exp2) #:cost 1.175]
154-
[floor.f64 #:spec (floor x) #:impl (from-libm 'floor) #:cost 0.300]
155-
[lgamma.f64 #:spec (lgamma x) #:impl (from-libm 'lgamma) #:cost 2.250]
156-
[log.f64 #:spec (log x) #:impl (from-libm 'log) #:cost 0.750]
157-
[log10.f64 #:spec (log10 x) #:impl (from-libm 'log10) #:cost 1.175]
158-
[log2.f64 #:spec (log2 x) #:impl (from-libm 'log2) #:cost 0.850]
159-
[logb.f64 #:spec (logb x) #:impl (from-libm 'logb) #:cost 0.350]
160-
[rint.f64 #:spec (rint x) #:impl (from-libm 'rint) #:cost 0.300]
161-
[round.f64 #:spec (round x) #:impl (from-libm 'round) #:cost 0.850]
162-
[sqrt.f64 #:spec (sqrt x) #:impl (from-libm 'sqrt) #:cost 0.250]
163-
[tanh.f64 #:spec (tanh x) #:impl (from-libm 'tanh) #:cost 1.000]
164-
[tgamma.f64 #:spec (tgamma x) #:impl (from-libm 'tgamma) #:cost 2.625]
165-
[trunc.f64 #:spec (trunc x) #:impl (from-libm 'trunc) #:cost 0.250])
166-
167-
(define-operations ([x <binary64>] [y <binary64>]) <binary64>
168-
[pow.f64 #:spec (pow x y) #:impl (from-libm 'pow) #:cost 2.000]
169-
[atan2.f64 #:spec (atan2 x y) #:impl (from-libm 'atan2) #:cost 2.000]
170-
[copysign.f64 #:spec (copysign x y) #:impl (from-libm 'copysign) #:cost 0.200]
171-
[fdim.f64 #:spec (fdim x y) #:impl (from-libm 'fdim) #:cost 0.750]
172-
[fmax.f64 #:spec (fmax x y) #:impl (from-libm 'fmax) #:cost 0.250]
173-
[fmin.f64 #:spec (fmin x y) #:impl (from-libm 'fmin) #:cost 0.250]
174-
[fmod.f64 #:spec (fmod x y) #:impl (from-libm 'fmod) #:cost 1.750]
175-
[remainder.f64 #:spec (remainder x y) #:impl (from-libm 'remainder) #:cost 1.000])
176-
177-
(define-operations ([x <binary64>]) <binary64>
178-
[erfc.f64 #:spec (- 1 (erf x)) #:impl (from-libm 'erfc) #:fpcore (erfc x) #:cost 0.900]
179-
[expm1.f64 #:spec (- (exp x) 1) #:impl (from-libm 'expm1) #:fpcore (expm1 x) #:cost 0.900]
180-
[log1p.f64 #:spec (log (+ 1 x)) #:impl (from-libm 'log1p) #:fpcore (log1p x) #:cost 1.300])
181-
182-
(define-operation (hypot.f64 [x <binary64>] [y <binary64>]) <binary64>
183-
#:spec (sqrt (+ (* x x) (* y y))) #:impl (from-libm 'hypot) #:fpcore (hypot x y) #:cost 1.700)
184-
185-
(define-operation (fma.f64 [x <binary64>] [y <binary64>] [z <binary64>]) <binary64>
186-
#:spec (+ (* x y) z) #:impl (from-libm 'fma) #:fpcore (fma x y z) #:cost 0.375))
187-
188-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CASTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
189-
190-
(define-operation (binary64->binary32 [x <binary64>]) <binary32>
191-
#:spec x #:fpcore (! :precision binary32 (cast x)) #:impl flsingle #:cost 32bit-move-cost)
192-
193-
(define-operation (binary32->binary64 [x <binary32>]) <binary64>
194-
#:spec x #:fpcore (! :precision binary64 (cast x)) #:impl identity #:cost 64bit-move-cost)
122+
(define-operations () <binary64> #:fpcore (:precision binary64)
123+
[PI.f64 #:spec (PI) #:impl (const pi) #:fpcore PI #:cost 64bit-move-cost]
124+
[E.f64 #:spec (E) #:impl (const (exp 1)) #:fpcore E #:cost 64bit-move-cost]
125+
[INFINITY #:spec (INFINITY) #:impl (const +inf.0) #:fpcore INFINITY #:cost 64bit-move-cost]
126+
[NAN.f64 #:spec (NAN) #:impl (const +nan.0) #:fpcore NAN #:cost 64bit-move-cost])
127+
128+
(define-operation (neg.f64 [x <binary64>]) <binary64>
129+
#:spec (neg x) #:impl - #:fpcore (! :precision binary64 (- x)) #:cost 0.125)
130+
131+
(define-operations ([x <binary64>] [y <binary64>]) <binary64> #:fpcore (:precision binary64)
132+
[+.f64 #:spec (+ x y) #:impl + #:cost 0.200]
133+
[-.f64 #:spec (- x y) #:impl - #:cost 0.200]
134+
[*.f64 #:spec (* x y) #:impl * #:cost 0.250]
135+
[/.f64 #:spec (/ x y) #:impl / #:cost 0.350])
136+
137+
(define-operations ([x <binary64>]) <binary64> #:fpcore (:precision binary64)
138+
[fabs.f64 #:spec (fabs x) #:impl (from-libm 'fabs) #:cost 0.125]
139+
[sin.f64 #:spec (sin x) #:impl (from-libm 'sin) #:cost 4.200]
140+
[cos.f64 #:spec (cos x) #:impl (from-libm 'cos) #:cost 4.200]
141+
[tan.f64 #:spec (tan x) #:impl (from-libm 'tan) #:cost 4.650]
142+
[sinh.f64 #:spec (sinh x) #:impl (from-libm 'sinh) #:cost 1.750]
143+
[cosh.f64 #:spec (cosh x) #:impl (from-libm 'cosh) #:cost 1.650]
144+
[acos.f64 #:spec (acos x) #:impl (from-libm 'acos) #:cost 0.500]
145+
[acosh.f64 #:spec (acosh x) #:impl (from-libm 'acosh) #:cost 0.850]
146+
[asin.f64 #:spec (asin x) #:impl (from-libm 'asin) #:cost 0.500]
147+
[asinh.f64 #:spec (asinh x) #:impl (from-libm 'asinh) #:cost 1.125]
148+
[atan.f64 #:spec (atan x) #:impl (from-libm 'atan) #:cost 1.100]
149+
[atanh.f64 #:spec (atanh x) #:impl (from-libm 'atanh) #:cost 0.450]
150+
[cbrt.f64 #:spec (cbrt x) #:impl (from-libm 'cbrt) #:cost 2.000]
151+
[ceil.f64 #:spec (ceil x) #:impl (from-libm 'ceil) #:cost 0.250]
152+
[erf.f64 #:spec (erf x) #:impl (from-libm 'erf) #:cost 1.125]
153+
[exp.f64 #:spec (exp x) #:impl (from-libm 'exp) #:cost 1.375]
154+
[exp2.f64 #:spec (exp2 x) #:impl (from-libm 'exp2) #:cost 1.175]
155+
[floor.f64 #:spec (floor x) #:impl (from-libm 'floor) #:cost 0.300]
156+
[lgamma.f64 #:spec (lgamma x) #:impl (from-libm 'lgamma) #:cost 2.250]
157+
[log.f64 #:spec (log x) #:impl (from-libm 'log) #:cost 0.750]
158+
[log10.f64 #:spec (log10 x) #:impl (from-libm 'log10) #:cost 1.175]
159+
[log2.f64 #:spec (log2 x) #:impl (from-libm 'log2) #:cost 0.850]
160+
[logb.f64 #:spec (logb x) #:impl (from-libm 'logb) #:cost 0.350]
161+
[rint.f64 #:spec (rint x) #:impl (from-libm 'rint) #:cost 0.300]
162+
[round.f64 #:spec (round x) #:impl (from-libm 'round) #:cost 0.850]
163+
[sqrt.f64 #:spec (sqrt x) #:impl (from-libm 'sqrt) #:cost 0.250]
164+
[tanh.f64 #:spec (tanh x) #:impl (from-libm 'tanh) #:cost 1.000]
165+
[tgamma.f64 #:spec (tgamma x) #:impl (from-libm 'tgamma) #:cost 2.625]
166+
[trunc.f64 #:spec (trunc x) #:impl (from-libm 'trunc) #:cost 0.250])
167+
168+
(define-operations ([x <binary64>] [y <binary64>]) <binary64> #:fpcore (:precision binary64)
169+
[pow.f64 #:spec (pow x y) #:impl (from-libm 'pow) #:cost 2.000]
170+
[atan2.f64 #:spec (atan2 x y) #:impl (from-libm 'atan2) #:cost 2.000]
171+
[copysign.f64 #:spec (copysign x y) #:impl (from-libm 'copysign) #:cost 0.200]
172+
[fdim.f64 #:spec (fdim x y) #:impl (from-libm 'fdim) #:cost 0.750]
173+
[fmax.f64 #:spec (fmax x y) #:impl (from-libm 'fmax) #:cost 0.250]
174+
[fmin.f64 #:spec (fmin x y) #:impl (from-libm 'fmin) #:cost 0.250]
175+
[fmod.f64 #:spec (fmod x y) #:impl (from-libm 'fmod) #:cost 1.750]
176+
[remainder.f64 #:spec (remainder x y) #:impl (from-libm 'remainder) #:cost 1.000])
177+
178+
(define-operations ([x <binary64>]) <binary64> #:fpcore (:precision binary64)
179+
[erfc.f64 #:spec (- 1 (erf x)) #:impl (from-libm 'erfc) #:fpcore (erfc x) #:cost 0.900]
180+
[expm1.f64 #:spec (- (exp x) 1) #:impl (from-libm 'expm1) #:fpcore (expm1 x) #:cost 0.900]
181+
[log1p.f64 #:spec (log (+ 1 x)) #:impl (from-libm 'log1p) #:fpcore (log1p x) #:cost 1.300])
182+
183+
(define-operation (hypot.f64 [x <binary64>] [y <binary64>]) <binary64>
184+
#:spec (sqrt (+ (* x x) (* y y))) #:impl (from-libm 'hypot)
185+
#:fpcore (! :precision binary64 (hypot x y)) #:cost 1.700)
186+
187+
(define-operation (fma.f64 [x <binary64>] [y <binary64>] [z <binary64>]) <binary64>
188+
#:spec (+ (* x y) z) #:impl (from-libm 'fma)
189+
#:fpcore (! :precision binary64 (fma x y z)) #:cost 0.375)
190+

0 commit comments

Comments
 (0)