-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,8 +61,8 @@ macro evalpoly(z, p...) | |
for i = length(p)-2:-1:1 | ||
ai = symbol("a", i) | ||
push!(as, :($ai = $a)) | ||
a = :($b + r*$ai) | ||
b = :($(esc(p[i])) - s * $ai) | ||
a = :(muladd(r, $ai, $b)) | ||
b = :(muladd(-s, $ai, $(esc(p[i])))) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
simonbyrne
Author
Contributor
|
||
end | ||
ai = :a0 | ||
push!(as, :($ai = $a)) | ||
|
@@ -72,7 +72,7 @@ macro evalpoly(z, p...) | |
:(r = x + x), | ||
:(s = x*x + y*y), | ||
as..., | ||
:($ai * tt + $b)) | ||
:(muladd($ai, tt, $b))) | ||
This comment has been minimized.
Sorry, something went wrong.
stevengj
Member
|
||
R = Expr(:macrocall, symbol("@horner"), :tt, p...) | ||
:(let tt = $(esc(z)) | ||
isa(tt, Complex) ? $C : $R | ||
|
This doesn't seem to generate efficient code in LLVM: it generates an explicit negation instruction for
-s
.(Unfortunately, LLVM doesn't seem to have intrinsics for fused multiply-subtract and similar. Nor does
@fastmath
seem to help here; the compiler still isn't smart enough to turn the negation back into a subtraction.)