Skip to content

Commit

Permalink
[InstCombine] add test for copysign with FMF propagation; NFC
Browse files Browse the repository at this point in the history
This is a miscompile as noted in #54077.
  • Loading branch information
rotateright committed Mar 1, 2022
1 parent c2428a4 commit 53dbedc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions llvm/test/Transforms/InstCombine/select.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,17 @@ define float @copysign1(float %x) {
ret float %r
}

define float @copysign1_fmf(float %x) {
; CHECK-LABEL: @copysign1_fmf(
; CHECK-NEXT: [[R:%.*]] = call ninf nsz float @llvm.copysign.f32(float 1.000000e+00, float [[X:%.*]])
; CHECK-NEXT: ret float [[R]]
;
%i = bitcast float %x to i32
%ispos = icmp sgt i32 %i, -1
%r = select nsz ninf i1 %ispos, float 1.0, float -1.0
ret float %r
}

define <2 x float> @copysign2(<2 x float> %x) {
; CHECK-LABEL: @copysign2(
; CHECK-NEXT: [[TMP1:%.*]] = fneg nsz <2 x float> [[X:%.*]]
Expand Down

0 comments on commit 53dbedc

Please sign in to comment.