mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[NFC][InstCombine] Add unary FNeg tests to fdiv.ll
llvm-svn: 362231
This commit is contained in:
parent
6c3794e196
commit
4d7b58d613
@ -198,6 +198,39 @@ define float @fneg_fneg(float %x, float %y) {
|
||||
ret float %div
|
||||
}
|
||||
|
||||
define float @unary_fneg_unary_fneg(float %x, float %y) {
|
||||
; CHECK-LABEL: @unary_fneg_unary_fneg(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv float [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret float [[DIV]]
|
||||
;
|
||||
%x.fneg = fneg float %x
|
||||
%y.fneg = fneg float %y
|
||||
%div = fdiv float %x.fneg, %y.fneg
|
||||
ret float %div
|
||||
}
|
||||
|
||||
define float @unary_fneg_fneg(float %x, float %y) {
|
||||
; CHECK-LABEL: @unary_fneg_fneg(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv float [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret float [[DIV]]
|
||||
;
|
||||
%x.fneg = fneg float %x
|
||||
%y.fneg = fsub float -0.0, %y
|
||||
%div = fdiv float %x.fneg, %y.fneg
|
||||
ret float %div
|
||||
}
|
||||
|
||||
define float @fneg_unary_fneg(float %x, float %y) {
|
||||
; CHECK-LABEL: @fneg_unary_fneg(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv float [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret float [[DIV]]
|
||||
;
|
||||
%x.fneg = fsub float -0.0, %x
|
||||
%y.fneg = fneg float %y
|
||||
%div = fdiv float %x.fneg, %y.fneg
|
||||
ret float %div
|
||||
}
|
||||
|
||||
; The test above shows that no FMF are needed, but show that we are not dropping FMF.
|
||||
|
||||
define float @fneg_fneg_fast(float %x, float %y) {
|
||||
@ -211,6 +244,17 @@ define float @fneg_fneg_fast(float %x, float %y) {
|
||||
ret float %div
|
||||
}
|
||||
|
||||
define float @unary_fneg_unary_fneg_fast(float %x, float %y) {
|
||||
; CHECK-LABEL: @unary_fneg_unary_fneg_fast(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv fast float [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret float [[DIV]]
|
||||
;
|
||||
%x.fneg = fneg float %x
|
||||
%y.fneg = fneg float %y
|
||||
%div = fdiv fast float %x.fneg, %y.fneg
|
||||
ret float %div
|
||||
}
|
||||
|
||||
define <2 x float> @fneg_fneg_vec(<2 x float> %x, <2 x float> %y) {
|
||||
; CHECK-LABEL: @fneg_fneg_vec(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[X:%.*]], [[Y:%.*]]
|
||||
@ -222,6 +266,39 @@ define <2 x float> @fneg_fneg_vec(<2 x float> %x, <2 x float> %y) {
|
||||
ret <2 x float> %div
|
||||
}
|
||||
|
||||
define <2 x float> @unary_fneg_unary_fneg_vec(<2 x float> %x, <2 x float> %y) {
|
||||
; CHECK-LABEL: @unary_fneg_unary_fneg_vec(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret <2 x float> [[DIV]]
|
||||
;
|
||||
%xneg = fneg <2 x float> %x
|
||||
%yneg = fneg <2 x float> %y
|
||||
%div = fdiv <2 x float> %xneg, %yneg
|
||||
ret <2 x float> %div
|
||||
}
|
||||
|
||||
define <2 x float> @fneg_unary_fneg_vec(<2 x float> %x, <2 x float> %y) {
|
||||
; CHECK-LABEL: @fneg_unary_fneg_vec(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret <2 x float> [[DIV]]
|
||||
;
|
||||
%xneg = fsub <2 x float> <float -0.0, float -0.0>, %x
|
||||
%yneg = fneg <2 x float> %y
|
||||
%div = fdiv <2 x float> %xneg, %yneg
|
||||
ret <2 x float> %div
|
||||
}
|
||||
|
||||
define <2 x float> @unary_fneg_fneg_vec(<2 x float> %x, <2 x float> %y) {
|
||||
; CHECK-LABEL: @unary_fneg_fneg_vec(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: ret <2 x float> [[DIV]]
|
||||
;
|
||||
%xneg = fneg <2 x float> %x
|
||||
%yneg = fsub <2 x float> <float -0.0, float -0.0>, %y
|
||||
%div = fdiv <2 x float> %xneg, %yneg
|
||||
ret <2 x float> %div
|
||||
}
|
||||
|
||||
define <2 x float> @fneg_fneg_vec_undef_elts(<2 x float> %x, <2 x float> %y) {
|
||||
; CHECK-LABEL: @fneg_fneg_vec_undef_elts(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[X:%.*]], [[Y:%.*]]
|
||||
@ -243,6 +320,16 @@ define float @fneg_dividend_constant_divisor(float %x) {
|
||||
ret float %div
|
||||
}
|
||||
|
||||
define float @unary_fneg_dividend_constant_divisor(float %x) {
|
||||
; CHECK-LABEL: @unary_fneg_dividend_constant_divisor(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv nsz float [[X:%.*]], -3.000000e+00
|
||||
; CHECK-NEXT: ret float [[DIV]]
|
||||
;
|
||||
%neg = fneg float %x
|
||||
%div = fdiv nsz float %neg, 3.0
|
||||
ret float %div
|
||||
}
|
||||
|
||||
define float @fneg_divisor_constant_dividend(float %x) {
|
||||
; CHECK-LABEL: @fneg_divisor_constant_dividend(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv nnan float 3.000000e+00, [[X:%.*]]
|
||||
@ -253,6 +340,16 @@ define float @fneg_divisor_constant_dividend(float %x) {
|
||||
ret float %div
|
||||
}
|
||||
|
||||
define float @unary_fneg_divisor_constant_dividend(float %x) {
|
||||
; CHECK-LABEL: @unary_fneg_divisor_constant_dividend(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv nnan float 3.000000e+00, [[X:%.*]]
|
||||
; CHECK-NEXT: ret float [[DIV]]
|
||||
;
|
||||
%neg = fneg float %x
|
||||
%div = fdiv nnan float -3.0, %neg
|
||||
ret float %div
|
||||
}
|
||||
|
||||
define <2 x float> @fneg_dividend_constant_divisor_vec(<2 x float> %x) {
|
||||
; CHECK-LABEL: @fneg_dividend_constant_divisor_vec(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf <2 x float> [[X:%.*]], <float -3.000000e+00, float 8.000000e+00>
|
||||
@ -263,6 +360,16 @@ define <2 x float> @fneg_dividend_constant_divisor_vec(<2 x float> %x) {
|
||||
ret <2 x float> %div
|
||||
}
|
||||
|
||||
define <2 x float> @unary_fneg_dividend_constant_divisor_vec(<2 x float> %x) {
|
||||
; CHECK-LABEL: @unary_fneg_dividend_constant_divisor_vec(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf <2 x float> [[X:%.*]], <float -3.000000e+00, float 8.000000e+00>
|
||||
; CHECK-NEXT: ret <2 x float> [[DIV]]
|
||||
;
|
||||
%neg = fneg <2 x float> %x
|
||||
%div = fdiv ninf <2 x float> %neg, <float 3.0, float -8.0>
|
||||
ret <2 x float> %div
|
||||
}
|
||||
|
||||
define <2 x float> @fneg_dividend_constant_divisor_vec_undef_elt(<2 x float> %x) {
|
||||
; CHECK-LABEL: @fneg_dividend_constant_divisor_vec_undef_elt(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf <2 x float> [[X:%.*]], <float -3.000000e+00, float 8.000000e+00>
|
||||
@ -283,6 +390,17 @@ define <2 x float> @fneg_divisor_constant_dividend_vec(<2 x float> %x) {
|
||||
ret <2 x float> %div
|
||||
}
|
||||
|
||||
define <2 x float> @unary_fneg_divisor_constant_dividend_vec(<2 x float> %x) {
|
||||
; CHECK-LABEL: @unary_fneg_divisor_constant_dividend_vec(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv afn <2 x float> <float 3.000000e+00, float -5.000000e+00>, [[X:%.*]]
|
||||
; CHECK-NEXT: ret <2 x float> [[DIV]]
|
||||
;
|
||||
%neg = fneg <2 x float> %x
|
||||
%div = fdiv afn <2 x float> <float -3.0, float 5.0>, %neg
|
||||
ret <2 x float> %div
|
||||
}
|
||||
|
||||
|
||||
; X / (X * Y) --> 1.0 / Y
|
||||
|
||||
define float @div_factor(float %x, float %y) {
|
||||
|
Loading…
Reference in New Issue
Block a user