OSDN Git Service

[NFC][InstCombine] Add unary FNeg tests to fpcast.ll and fpextend.ll
authorCameron McInally <cameron.mcinally@nyu.edu>
Wed, 29 May 2019 15:29:35 +0000 (15:29 +0000)
committerCameron McInally <cameron.mcinally@nyu.edu>
Wed, 29 May 2019 15:29:35 +0000 (15:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361973 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/fpcast.ll
test/Transforms/InstCombine/fpextend.ll

index bfc1de4..f0f5848 100644 (file)
@@ -40,6 +40,18 @@ define half @fneg_fptrunc(float %a) {
   ret half %c
 }
 
+; FIXME: This combine isn't working.
+define half @unary_fneg_fptrunc(float %a) {
+; CHECK-LABEL: @unary_fneg_fptrunc(
+; CHECK-NEXT:    [[B:%.*]] = fneg float [[A:%.*]]
+; CHECK-NEXT:    [[C:%.*]] = fptrunc float [[B]] to half
+; CHECK-NEXT:    ret half [[C]]
+;
+  %b = fneg float %a
+  %c = fptrunc float %b to half
+  ret half %c
+}
+
 define <2 x half> @fneg_fptrunc_vec_undef(<2 x float> %a) {
 ; CHECK-LABEL: @fneg_fptrunc_vec_undef(
 ; CHECK-NEXT:    [[TMP1:%.*]] = fptrunc <2 x float> [[A:%.*]] to <2 x half>
@@ -51,6 +63,18 @@ define <2 x half> @fneg_fptrunc_vec_undef(<2 x float> %a) {
   ret <2 x half> %c
 }
 
+; FIXME: This combine isn't working.
+define <2 x half> @unary_fneg_fptrunc_vec(<2 x float> %a) {
+; CHECK-LABEL: @unary_fneg_fptrunc_vec(
+; CHECK-NEXT:    [[B:%.*]] = fneg <2 x float> [[A:%.*]]
+; CHECK-NEXT:    [[C:%.*]] = fptrunc <2 x float> [[B]] to <2 x half>
+; CHECK-NEXT:    ret <2 x half> [[C]]
+;
+  %b = fneg <2 x float> %a
+  %c = fptrunc <2 x float> %b to <2 x half>
+  ret <2 x half> %c
+}
+
 define half @test4-fast(float %a) {
 ; CHECK-LABEL: @test4-fast(
 ; CHECK-NEXT:    [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
@@ -62,6 +86,18 @@ define half @test4-fast(float %a) {
   ret half %c
 }
 
+; FIXME: This combine isn't working.
+define half @test4_unary_fneg-fast(float %a) {
+; CHECK-LABEL: @test4_unary_fneg-fast(
+; CHECK-NEXT:    [[B:%.*]] = fneg fast float [[A:%.*]]
+; CHECK-NEXT:    [[C:%.*]] = fptrunc float [[B]] to half
+; CHECK-NEXT:    ret half [[C]]
+;
+  %b = fneg fast float %a
+  %c = fptrunc float %b to half
+  ret half %c
+}
+
 define half @test5(float %a, float %b, float %c) {
 ; CHECK-LABEL: @test5(
 ; CHECK-NEXT:    [[D:%.*]] = fcmp ogt float [[A:%.*]], [[B:%.*]]
index 8840150..f1e7076 100644 (file)
@@ -55,6 +55,22 @@ entry:
   ret float %tmp34
 }
 
+; FIXME: This combine isn't working.
+define float @test4_unary_fneg(float %x) nounwind  {
+; CHECK-LABEL: @test4_unary_fneg(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[TMP1:%.*]] = fpext float [[X:%.*]] to double
+; CHECK-NEXT:    [[TMP2:%.*]] = fneg double [[TMP1]]
+; CHECK-NEXT:    [[TMP34:%.*]] = fptrunc double [[TMP2]] to float
+; CHECK-NEXT:    ret float [[TMP34]]
+;
+entry:
+  %tmp1 = fpext float %x to double
+  %tmp2 = fneg double %tmp1
+  %tmp34 = fptrunc double %tmp2 to float
+  ret float %tmp34
+}
+
 ; Test with vector splat constant
 define <2 x float> @test5(<2 x float> %x) nounwind  {
 ; CHECK-LABEL: @test5(