summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorCameron McInally <cameron.mcinally@nyu.edu>2019-05-05 16:07:09 +0000
committerCameron McInally <cameron.mcinally@nyu.edu>2019-05-05 16:07:09 +0000
commit1d0c845d9dce577c2ef14cd7d5fcf0b9c17f9ed2 (patch)
treebc2a42daa117355c7d3a43a82ce69c34ea357883 /llvm/test/Transforms
parent70ee2def906e928624f59611c3de732fe121b8a4 (diff)
downloadbcm5719-llvm-1d0c845d9dce577c2ef14cd7d5fcf0b9c17f9ed2.tar.gz
bcm5719-llvm-1d0c845d9dce577c2ef14cd7d5fcf0b9c17f9ed2.zip
Add FNeg IR constant folding support
llvm-svn: 359982
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/fneg.ll53
-rw-r--r--llvm/test/Transforms/InstCombine/fsub.ll6
-rw-r--r--llvm/test/Transforms/InstCombine/inselt-binop.ll2
-rw-r--r--llvm/test/Transforms/Reassociate/crash2.ll2
4 files changed, 8 insertions, 55 deletions
diff --git a/llvm/test/Transforms/InstCombine/fneg.ll b/llvm/test/Transforms/InstCombine/fneg.ll
index 84cc981566f..889bb022541 100644
--- a/llvm/test/Transforms/InstCombine/fneg.ll
+++ b/llvm/test/Transforms/InstCombine/fneg.ll
@@ -46,7 +46,7 @@ define float @fmul_fneg_extra_use(float %x) {
define <4 x double> @fmul_fneg_vec(<4 x double> %x) {
; CHECK-LABEL: @fmul_fneg_vec(
-; CHECK-NEXT: [[R:%.*]] = fmul <4 x double> [[X:%.*]], <double -4.200000e+01, double 0x7F80000000000000, double 0xFFF0000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT: [[R:%.*]] = fmul <4 x double> [[X:%.*]], <double -4.200000e+01, double 0x7F80000000000000, double 0xFFF0000000000000, double undef>
; CHECK-NEXT: ret <4 x double> [[R]]
;
%m = fmul <4 x double> %x, <double 42.0, double 0x7FF80000000000000, double 0x7FF0000000000000, double undef>
@@ -97,7 +97,7 @@ define float @fdiv_op1_constant_fneg_extra_use(float %x) {
define <4 x double> @fdiv_op1_constant_fneg_vec(<4 x double> %x) {
; CHECK-LABEL: @fdiv_op1_constant_fneg_vec(
-; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> [[X:%.*]], <double 4.200000e+01, double 0x7FF800000ABCD000, double 0x7FF0000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> [[X:%.*]], <double 4.200000e+01, double 0x7FF800000ABCD000, double 0x7FF0000000000000, double undef>
; CHECK-NEXT: ret <4 x double> [[R]]
;
%d = fdiv <4 x double> %x, <double -42.0, double 0xFFF800000ABCD000, double 0xFFF0000000000000, double undef>
@@ -148,57 +148,10 @@ define float @fdiv_op0_constant_fneg_extra_use(float %x) {
define <4 x double> @fdiv_op0_constant_fneg_vec(<4 x double> %x) {
; CHECK-LABEL: @fdiv_op0_constant_fneg_vec(
-; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double 0x7F80000000000000, double 0x7FF0000000000000, double 0x7FF8000000000000>, [[X:%.*]]
+; CHECK-NEXT: [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double 0x7F80000000000000, double 0x7FF0000000000000, double undef>, [[X:%.*]]
; CHECK-NEXT: ret <4 x double> [[R]]
;
%d = fdiv <4 x double> <double -42.0, double 0x7FF80000000000000, double 0xFFF0000000000000, double undef>, %x
%r = fsub <4 x double> <double -0.0, double -0.0, double -0.0, double -0.0>, %d
ret <4 x double> %r
}
-
-; Actual fneg instructions.
-
-define float @fneg_constant() {
-; CHECK-LABEL: @fneg_constant(
-; CHECK-NEXT: [[R:%.*]] = fneg float -0.000000e+00
-; CHECK-NEXT: ret float [[R]]
-;
- %r = fneg float -0.0
- ret float %r
-}
-
-define float @fneg_undef() {
-; CHECK-LABEL: @fneg_undef(
-; CHECK-NEXT: [[R:%.*]] = fneg float undef
-; CHECK-NEXT: ret float [[R]]
-;
- %r = fneg float undef
- ret float %r
-}
-
-define <4 x float> @fneg_constant_elts_v4f32() {
-; CHECK-LABEL: @fneg_constant_elts_v4f32(
-; CHECK-NEXT: [[R:%.*]] = fneg <4 x float> <float -0.000000e+00, float 0.000000e+00, float -1.000000e+00, float 1.000000e+00>
-; CHECK-NEXT: ret <4 x float> [[R]]
-;
- %r = fneg <4 x float> <float -0.0, float 0.0, float -1.0, float 1.0>
- ret <4 x float> %r
-}
-
-define <4 x float> @fneg_constant_undef_elts_v4f32() {
-; CHECK-LABEL: @fneg_constant_undef_elts_v4f32(
-; CHECK-NEXT: [[R:%.*]] = fneg <4 x float> <float -0.000000e+00, float undef, float undef, float 1.000000e+00>
-; CHECK-NEXT: ret <4 x float> [[R]]
-;
- %r = fneg <4 x float> <float -0.0, float undef, float undef, float 1.0>
- ret <4 x float> %r
-}
-
-define <4 x float> @fneg_constant_all_undef_elts_v4f32() {
-; CHECK-LABEL: @fneg_constant_all_undef_elts_v4f32(
-; CHECK-NEXT: [[R:%.*]] = fneg <4 x float> undef
-; CHECK-NEXT: ret <4 x float> [[R]]
-;
- %r = fneg <4 x float> <float undef, float undef, float undef, float undef>
- ret <4 x float> %r
-}
diff --git a/llvm/test/Transforms/InstCombine/fsub.ll b/llvm/test/Transforms/InstCombine/fsub.ll
index 4868ece222d..189bc4ca850 100644
--- a/llvm/test/Transforms/InstCombine/fsub.ll
+++ b/llvm/test/Transforms/InstCombine/fsub.ll
@@ -64,8 +64,8 @@ define float @sub_sub_nsz(float %x, float %y, float %z) {
define float @sub_add_neg_x(float %x, float %y) {
; CHECK-LABEL: @sub_add_neg_x(
-; CHECK-NEXT: [[TMP1:%.*]] = fmul reassoc nsz float [[X:%.*]], -5.000000e+00
-; CHECK-NEXT: ret float [[TMP1]]
+; CHECK-NEXT: [[R:%.*]] = fmul reassoc nsz float [[X:%.*]], -5.000000e+00
+; CHECK-NEXT: ret float [[R]]
;
%mul = fmul float %x, 5.000000e+00
%add = fadd float %mul, %y
@@ -121,7 +121,7 @@ define <2 x float> @constant_op1_vec(<2 x float> %x, <2 x float> %y) {
define <2 x float> @constant_op1_vec_undef(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @constant_op1_vec_undef(
-; CHECK-NEXT: [[R:%.*]] = fadd <2 x float> [[X:%.*]], <float 0x7FF8000000000000, float 4.200000e+01>
+; CHECK-NEXT: [[R:%.*]] = fadd <2 x float> [[X:%.*]], <float undef, float 4.200000e+01>
; CHECK-NEXT: ret <2 x float> [[R]]
;
%r = fsub <2 x float> %x, <float undef, float -42.0>
diff --git a/llvm/test/Transforms/InstCombine/inselt-binop.ll b/llvm/test/Transforms/InstCombine/inselt-binop.ll
index 882a1318c68..64296c9fd5a 100644
--- a/llvm/test/Transforms/InstCombine/inselt-binop.ll
+++ b/llvm/test/Transforms/InstCombine/inselt-binop.ll
@@ -504,7 +504,7 @@ define <2 x float> @fsub_constant_op0_not_undef_lane(float %x) {
define <2 x float> @fsub_constant_op1(float %x) {
; CHECK-LABEL: @fsub_constant_op1(
; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1
-; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float 0x7FF8000000000000, float -4.200000e+01>
+; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float undef, float -4.200000e+01>
; CHECK-NEXT: ret <2 x float> [[BO]]
;
%ins = insertelement <2 x float> undef, float %x, i32 1
diff --git a/llvm/test/Transforms/Reassociate/crash2.ll b/llvm/test/Transforms/Reassociate/crash2.ll
index 7e4a3278c9e..0da5bde2b31 100644
--- a/llvm/test/Transforms/Reassociate/crash2.ll
+++ b/llvm/test/Transforms/Reassociate/crash2.ll
@@ -7,7 +7,7 @@
define float @undef1() {
; CHECK-LABEL: @undef1(
-; CHECK-NEXT: ret float fadd (float bitcast (i32 ptrtoint (i32* @g to i32) to float), float fadd (float bitcast (i32 ptrtoint (i32* @g to i32) to float), float fadd (float fsub (float -0.000000e+00, float bitcast (i32 ptrtoint (i32* @g to i32) to float)), float fsub (float -0.000000e+00, float bitcast (i32 ptrtoint (i32* @g to i32) to float)))))
+; CHECK-NEXT: ret float fadd (float bitcast (i32 ptrtoint (i32* @g to i32) to float), float fadd (float bitcast (i32 ptrtoint (i32* @g to i32) to float), float fadd (float fneg (float bitcast (i32 ptrtoint (i32* @g to i32) to float)), float fneg (float bitcast (i32 ptrtoint (i32* @g to i32) to float)))))
;
%t0 = fadd fast float bitcast (i32 ptrtoint (i32* @g to i32) to float), bitcast (i32 ptrtoint (i32* @g to i32) to float)
%t1 = fsub fast float bitcast (i32 ptrtoint (i32* @g to i32) to float), %t0
OpenPOWER on IntegriCloud