Test Transforms/InstCombine/select.ll, fn copysign2:
Simplified without vectors:
define float @src(float %x) {
%0:
%i = bitcast float %x to i32
%isneg = icmp slt i32 %i, 0
%r = select nsz i1 %isneg, float 42.000000, float -42.000000
ret float %r
}
=>
define float @tgt(float %x) {
%0:
%1 = fneg nsz float %x, exceptions=ignore
%r = copysign float 42.000000, %1, exceptions=ignore
ret float %r
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
float %x = #x00000000 (+0.0)
Source:
i32 %i = #x00000000 (0)
i1 %isneg = #x0 (0)
float %r = #xc2280000 (-42)
Target:
float %1 = #x00000000 (+0.0)
float %r = #x42280000 (42)
Source value: #xc2280000 (-42)
Target value: #x42280000 (42)
Dropping nsz from fneg makes it correct.
https://alive2.llvm.org/ce/z/tNATrd
cc @rotateright @LebedevRI
Test Transforms/InstCombine/select.ll, fn copysign2:
Simplified without vectors:
Dropping nsz from
fnegmakes it correct.https://alive2.llvm.org/ce/z/tNATrd
cc @rotateright @LebedevRI