[llvm] [VectorCombine] Combine scalar fneg with insert/extract to vector fneg when length is different (PR #115209)
Nuno Lopes via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 05:07:58 PST 2024
nunoplopes wrote:
Alive2 flags an issue with this commit.
TL;DR: the optimized code is missing the fneg.
```llvm
define <4 x float> @ext1_v2f32v4f32_fsub_fmf(<2 x float> %x, <4 x float> %y) {
%e = extractelement <2 x float> %x, i32 1
%s = fsub nnan nsz float 0.000000, %e
%r = insertelement <4 x float> %y, float %s, i32 1
ret <4 x float> %r
}
=>
define <4 x float> @ext1_v2f32v4f32_fsub_fmf(<2 x float> %x, <4 x float> %y) {
%#2 = shufflevector <2 x float> %x, <2 x float> poison, 4294967295, 1, 4294967295, 4294967295
%r = shufflevector <4 x float> %y, <4 x float> %#2, 0, 5, 2, 3
ret <4 x float> %r
}
Transformation doesn't verify! (unsound)
ERROR: Value mismatch
Example:
<2 x float> %x = < poison, #x00000002 (0.000000000000?) >
<4 x float> %y = < #x00000000 (+0.0), poison, #x00000000 (+0.0), #x00000000 (+0.0) >
Source:
float %e = #x00000002 (0.000000000000?)
float %s = #x80000002 (-0.000000000000?)
<4 x float> %r = < #x00000000 (+0.0), #x80000002 (-0.000000000000?), #x00000000 (+0.0), #x00000000 (+0.0) >
Target:
<4 x float> %#2 = < poison, #x00000002 (0.000000000000?), poison, poison >
<4 x float> %r = < #x00000000 (+0.0), #x00000002 (0.000000000000?), #x00000000 (+0.0), #x00000000 (+0.0) >
Source value: < #x00000000 (+0.0), #x80000002 (-0.000000000000?), #x00000000 (+0.0), #x00000000 (+0.0) >
Target value: < #x00000000 (+0.0), #x00000002 (0.000000000000?), #x00000000 (+0.0), #x00000000 (+0.0) >
```
https://github.com/llvm/llvm-project/pull/115209
More information about the llvm-commits
mailing list