-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Compile constant SIMD initialiser to a constant vector expression #18147
Comments
@huonw with |
Yes, this applies to any |
Cc @rust-lang/wg-compiler-performance now that SIMD support is going to be stabilised. |
According to Godbolt target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @_ZN7example3foo17h2ac4b13db8a0abecE
(<2 x double>* noalias nocapture sret dereferenceable(16) %0, double %x, double %y)
unnamed_addr #0 !dbg !6 {
%1 = bitcast <2 x double>* %0 to double*, !dbg !10
store double 0.000000e+00, double* %1, align 16, !dbg !10
%2 = getelementptr inbounds <2 x double>, <2 x double>* %0, i32 0, i32 1, !dbg !10
store double 1.000000e+00, double* %2, align 8, !dbg !10
ret void, !dbg !11
}
attributes #0 = { nonlazybind uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" }
!llvm.module.flags = !{!0, !1, !2}
!llvm.dbg.cu = !{!3} and target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @_ZN7example3foo17h2ac4b13db8a0abecE
(<2 x double>* noalias nocapture sret dereferenceable(16) %0, double %x, double %y)
unnamed_addr #0 !dbg !6 {
store <2 x double> <double 0.000000e+00, double 1.000000e+00>, <2 x double>* %0, align 16, !dbg !10
ret void, !dbg !11
}
attributes #0 = { nofree norecurse nounwind nonlazybind uwtable writeonly
"probe-stack"="__rust_probestack" "target-cpu"="x86-64" } I'm... not sure how to read what seem like significant syntactic differences in these IR outputs, but I have a hunch that the result is "no change". |
Hm... With new eyes, I can affirm. No change. |
Currently
becomes, with no optimisations,
After optimisations it becomes
We could detect constants in a SIMD initialiser and compile to this directly, making our no-opt code faster, and saving the optimiser work.
The text was updated successfully, but these errors were encountered: