1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

[InstCombine] add tests for FMF propagation via -(C/X); NFC

There are bugs here as discussed in:
https://llvm.org/PR49654
This commit is contained in:
Sanjay Patel 2021-06-07 10:42:28 -04:00
parent f4f2509f8a
commit 2243b0992e

View File

@ -225,18 +225,18 @@ define float @fdiv_op0_constant_fneg(float %x) {
; Fast math is not required, but it should be propagated.
define float @fdiv_op0_constant_fsub_fmf(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fsub_fmf(
define float @fdiv_op0_constant_fneg_fast_fast(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_fast_fast(
; CHECK-NEXT: [[R:%.*]] = fdiv fast float -4.200000e+01, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
%r = fsub fast float -0.0, %d
%d = fdiv fast float 42.0, %x
%r = fneg fast float %d
ret float %r
}
define float @fdiv_op0_constant_fneg_fmf(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_fmf(
define float @fdiv_op0_constant_fneg_fast(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_fast(
; CHECK-NEXT: [[R:%.*]] = fdiv fast float -4.200000e+01, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
@ -245,6 +245,66 @@ define float @fdiv_op0_constant_fneg_fmf(float %x) {
ret float %r
}
define float @fdiv_op0_constant_fneg_nsz_nsz(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_nsz_nsz(
; CHECK-NEXT: [[R:%.*]] = fdiv nsz float -4.200000e+01, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv nsz float 42.0, %x
%r = fneg nsz float %d
ret float %r
}
define float @fdiv_op0_constant_fneg_nsz(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_nsz(
; CHECK-NEXT: [[R:%.*]] = fdiv nsz float -4.200000e+01, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
%r = fneg nsz float %d
ret float %r
}
define float @fdiv_op0_constant_fneg_ninf_ninf(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_ninf_ninf(
; CHECK-NEXT: [[R:%.*]] = fdiv ninf float -4.200000e+01, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv ninf float 42.0, %x
%r = fneg ninf float %d
ret float %r
}
define float @fdiv_op0_constant_fneg_ninf(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_ninf(
; CHECK-NEXT: [[R:%.*]] = fdiv ninf float -4.200000e+01, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
%r = fneg ninf float %d
ret float %r
}
define float @fdiv_op0_constant_fneg_nnan_nnan(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_nnan_nnan(
; CHECK-NEXT: [[R:%.*]] = fdiv nnan float -4.200000e+01, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv nnan float 42.0, %x
%r = fneg nnan float %d
ret float %r
}
define float @fdiv_op0_constant_fneg_nnan(float %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_nnan(
; CHECK-NEXT: [[R:%.*]] = fdiv nnan float -4.200000e+01, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%d = fdiv float 42.0, %x
%r = fneg nnan float %d
ret float %r
}
; Extra use prevents the fold. We don't want to replace the fneg with an fdiv.
define float @fdiv_op0_constant_fsub_extra_use(float %x) {