forked from OSchip/llvm-project
[NFC][Reassociate] Add unary FNeg tests to fast-ReassociateVector.ll
llvm-svn: 364232
This commit is contained in:
parent
6694b2b36b
commit
1e5116cbb3
|
@ -232,6 +232,19 @@ define <2 x double> @test9(<2 x double> %b, <2 x double> %a) {
|
|||
ret <2 x double> %4
|
||||
}
|
||||
|
||||
define <2 x double> @test9_unary_fneg(<2 x double> %b, <2 x double> %a) {
|
||||
; CHECK-LABEL: @test9_unary_fneg(
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = fneg fast <2 x double> [[A:%.*]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = fadd fast <2 x double> [[B:%.*]], <double 1.234000e+03, double 1.234000e+03>
|
||||
; CHECK-NEXT: ret <2 x double> [[TMP2]]
|
||||
;
|
||||
%1 = fadd fast <2 x double> %a, <double 1.234000e+03, double 1.234000e+03>
|
||||
%2 = fadd fast <2 x double> %b, %1
|
||||
%3 = fneg fast <2 x double> %a
|
||||
%4 = fadd fast <2 x double> %2, %3
|
||||
ret <2 x double> %4
|
||||
}
|
||||
|
||||
; Check (b+(a+1234))+-a -> b+1234 - minimum FMF subset version
|
||||
|
||||
define <2 x double> @test9_reassoc(<2 x double> %b, <2 x double> %a) {
|
||||
|
@ -249,6 +262,21 @@ define <2 x double> @test9_reassoc(<2 x double> %b, <2 x double> %a) {
|
|||
ret <2 x double> %4
|
||||
}
|
||||
|
||||
define <2 x double> @test9_reassoc_unary_fneg(<2 x double> %b, <2 x double> %a) {
|
||||
; CHECK-LABEL: @test9_reassoc_unary_fneg(
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc <2 x double> [[A:%.*]], <double 1.234000e+03, double 1.234000e+03>
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = fadd reassoc <2 x double> [[B:%.*]], [[TMP1]]
|
||||
; CHECK-NEXT: [[TMP3:%.*]] = fneg reassoc <2 x double> [[A]]
|
||||
; CHECK-NEXT: [[TMP4:%.*]] = fadd reassoc <2 x double> [[TMP3]], [[TMP2]]
|
||||
; CHECK-NEXT: ret <2 x double> [[TMP4]]
|
||||
;
|
||||
%1 = fadd reassoc <2 x double> %a, <double 1.234000e+03, double 1.234000e+03>
|
||||
%2 = fadd reassoc <2 x double> %b, %1
|
||||
%3 = fneg reassoc <2 x double> %a
|
||||
%4 = fadd reassoc <2 x double> %2, %3
|
||||
ret <2 x double> %4
|
||||
}
|
||||
|
||||
; Check -(-(z*40)*a) -> a*40*z.
|
||||
|
||||
define <2 x float> @test10(<2 x float> %a, <2 x float> %b, <2 x float> %z) {
|
||||
|
@ -265,6 +293,20 @@ define <2 x float> @test10(<2 x float> %a, <2 x float> %b, <2 x float> %z) {
|
|||
ret <2 x float> %f
|
||||
}
|
||||
|
||||
define <2 x float> @test10_unary_fneg(<2 x float> %a, <2 x float> %b, <2 x float> %z) {
|
||||
; CHECK-LABEL: @test10_unary_fneg(
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = fneg fast <2 x float> zeroinitializer
|
||||
; CHECK-NEXT: [[E:%.*]] = fmul fast <2 x float> [[A:%.*]], <float 4.000000e+01, float 4.000000e+01>
|
||||
; CHECK-NEXT: [[F:%.*]] = fmul fast <2 x float> [[E]], [[Z:%.*]]
|
||||
; CHECK-NEXT: ret <2 x float> [[F]]
|
||||
;
|
||||
%d = fmul fast <2 x float> %z, <float 4.000000e+01, float 4.000000e+01>
|
||||
%c = fneg fast <2 x float> %d
|
||||
%e = fmul fast <2 x float> %a, %c
|
||||
%f = fneg fast <2 x float> %e
|
||||
ret <2 x float> %f
|
||||
}
|
||||
|
||||
; Check -(-(z*40)*a) -> a*40*z - minimum FMF subset version
|
||||
|
||||
define <2 x float> @test10_reassoc(<2 x float> %a, <2 x float> %b, <2 x float> %z) {
|
||||
|
@ -282,6 +324,21 @@ define <2 x float> @test10_reassoc(<2 x float> %a, <2 x float> %b, <2 x float> %
|
|||
ret <2 x float> %f
|
||||
}
|
||||
|
||||
define <2 x float> @test10_reassoc_unary_fneg(<2 x float> %a, <2 x float> %b, <2 x float> %z) {
|
||||
; CHECK-LABEL: @test10_reassoc_unary_fneg(
|
||||
; CHECK-NEXT: [[D:%.*]] = fmul reassoc <2 x float> [[Z:%.*]], <float 4.000000e+01, float 4.000000e+01>
|
||||
; CHECK-NEXT: [[C:%.*]] = fneg reassoc <2 x float> [[D]]
|
||||
; CHECK-NEXT: [[E:%.*]] = fmul reassoc <2 x float> [[A:%.*]], [[C]]
|
||||
; CHECK-NEXT: [[F:%.*]] = fneg reassoc <2 x float> [[E]]
|
||||
; CHECK-NEXT: ret <2 x float> [[F]]
|
||||
;
|
||||
%d = fmul reassoc <2 x float> %z, <float 4.000000e+01, float 4.000000e+01>
|
||||
%c = fneg reassoc <2 x float> %d
|
||||
%e = fmul reassoc <2 x float> %a, %c
|
||||
%f = fneg reassoc <2 x float> %e
|
||||
ret <2 x float> %f
|
||||
}
|
||||
|
||||
; Check x*y+y*x -> x*y*2.
|
||||
|
||||
define <2 x double> @test11(<2 x double> %x, <2 x double> %y) {
|
||||
|
|
Loading…
Reference in New Issue