-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[SystemZ] Bad Codegen for vec_gfmsum_accum_128 #109113
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
Comments
Good catch, this does indeed look wrong. It appears I introduced a regression here: #74625 due to a misinterpretation of the type casting rules:
I assumed that casts between a vector and a scalar of the same size (i.e. any Z vector type and __int128) would be just a bitcast. However, this is only true for the vector -> int128 conversion. A int128 -> vector conversion actually triggers the AltiVec splat rule, which is not what we want here. I'll come up with a fix. |
PR llvm#74625 introduced a regression in the code generated for the following set of intrinsic: vec_add_u128, vec_addc_u128, vec_adde_u128, vec_addec_u128 vec_sub_u128, vec_subc_u128, vec_sube_u128, vec_subec_u128 vec_sum_u128, vec_msum_u128 vec_gfmsum_128, vec_gfmsum_accum_128 This is because the new code incorrectly assumed that a cast from "unsigned __int128" to "vector unsigned char" would simply be a bitcast re-interpretation; instead, this cast actually truncates the __int128 to char and splats the result. Fixed by adding an intermediate cast via a single-element 128-bit integer vector. Fixes: llvm#109113
I had raised a similar issue (involving the same bug in the Clang vecintrin.h header) in issue #102911. |
Ah, sorry, I didn't see that. Do you still need a backport to LLVM 19? Note that LLVM 18 unfortunately also has the same bug. |
/cherry-pick baf9b7d |
Error: Command failed due to missing milestone. |
/cherry-pick baf9b7d |
PR llvm#74625 introduced a regression in the code generated for the following set of intrinsic: vec_add_u128, vec_addc_u128, vec_adde_u128, vec_addec_u128 vec_sub_u128, vec_subc_u128, vec_sube_u128, vec_subec_u128 vec_sum_u128, vec_msum_u128 vec_gfmsum_128, vec_gfmsum_accum_128 This is because the new code incorrectly assumed that a cast from "unsigned __int128" to "vector unsigned char" would simply be a bitcast re-interpretation; instead, this cast actually truncates the __int128 to char and splats the result. Fixed by adding an intermediate cast via a single-element 128-bit integer vector. Fixes: llvm#109113 (cherry picked from commit baf9b7d)
/pull-request #111376 |
PR llvm#74625 introduced a regression in the code generated for the following set of intrinsic: vec_add_u128, vec_addc_u128, vec_adde_u128, vec_addec_u128 vec_sub_u128, vec_subc_u128, vec_sube_u128, vec_subec_u128 vec_sum_u128, vec_msum_u128 vec_gfmsum_128, vec_gfmsum_accum_128 This is because the new code incorrectly assumed that a cast from "unsigned __int128" to "vector unsigned char" would simply be a bitcast re-interpretation; instead, this cast actually truncates the __int128 to char and splats the result. Fixed by adding an intermediate cast via a single-element 128-bit integer vector. Fixes: llvm#109113 (cherry picked from commit baf9b7d)
Recently the dotnet team started seeing Compression test case failures. These tests fail when zlib-ng is compiled with clang.
on deeper inspection I have managed to extract a test program from zlib-ng (Link)
The results are as follows with gcc and clang:
now on inspecting the disassembly I see this:
here the sequence
looks strange, I believe this should be directly doing a
vst
after thevgfmag
?clang version:
cc: @uweigand @JonPsson
The text was updated successfully, but these errors were encountered: