Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use muladd in complex evalpoly #35562

Merged
merged 1 commit into from
Apr 23, 2020
Merged

Use muladd in complex evalpoly #35562

merged 1 commit into from
Apr 23, 2020

Conversation

augustt198
Copy link
Contributor

Speeds up evalpoly for complex inputs a bit by using muladd for both recurrences. The number of instructions generated by the inner loop is halved.

@MasonProtter
Copy link
Contributor

Looks like the old version had a comment on it regarding this issue which has since been closed.

@StefanKarpinski
Copy link
Sponsor Member

I'll leave this for a bit longer in case @stevengj has any comments. Please ping in a bit if this hasn't been merged and I'll merge it.

@stevengj
Copy link
Member

Looks good to me. LLVM seems to emit a fused multiply-subtract these days:

julia> f(a,b,c) = muladd(-a, b, c)
f (generic function with 1 method)

julia> @code_llvm f(1., 2., 3.)

;  @ REPL[1]:1 within `f'
define double @julia_f_16811(double, double, double) {
top:
; ┌ @ float.jl:410 within `muladd'
   %3 = fmul contract double %0, %1
   %4 = fsub contract double %2, %3
; └
  ret double %4
}

julia> @code_native f(1., 2., 3.)
	.section	__TEXT,__text,regular,pure_instructions
; ┌ @ REPL[1]:1 within `f'
; │┌ @ REPL[1]:1 within `muladd'
	vfnmadd213sd	%xmm2, %xmm1, %xmm0
; │└
	retq
	nopw	%cs:(%rax,%rax)
; └

@stevengj stevengj merged commit eaa2c58 into JuliaLang:master Apr 23, 2020
martinholters added a commit to JuliaLang/Compat.jl that referenced this pull request May 8, 2020
martinholters added a commit to JuliaLang/Compat.jl that referenced this pull request May 8, 2020
martinholters added a commit to JuliaLang/Compat.jl that referenced this pull request May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants