[llvm] r362227 - [NFC][InstCombine] Add unary FNeg tests to fma.ll

Cameron McInally via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 07:49:31 PDT 2019


Author: mcinally
Date: Fri May 31 07:49:31 2019
New Revision: 362227

URL: http://llvm.org/viewvc/llvm-project?rev=362227&view=rev
Log:
[NFC][InstCombine] Add unary FNeg tests to fma.ll

Modified:
    llvm/trunk/test/Transforms/InstCombine/fma.ll

Modified: llvm/trunk/test/Transforms/InstCombine/fma.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fma.ll?rev=362227&r1=362226&r2=362227&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fma.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fma.ll Fri May 31 07:49:31 2019
@@ -19,6 +19,17 @@ define float @fma_fneg_x_fneg_y(float %x
   ret float %fma
 }
 
+define float @fma_unary_fneg_x_unary_fneg_y(float %x, float %y, float %z) {
+; CHECK-LABEL: @fma_unary_fneg_x_unary_fneg_y(
+; CHECK-NEXT:    [[FMA:%.*]] = call float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
+; CHECK-NEXT:    ret float [[FMA]]
+;
+  %x.fneg = fneg float %x
+  %y.fneg = fneg float %y
+  %fma = call float @llvm.fma.f32(float %x.fneg, float %y.fneg, float %z)
+  ret float %fma
+}
+
 define <2 x float> @fma_fneg_x_fneg_y_vec(<2 x float> %x, <2 x float> %y, <2 x float> %z) {
 ; CHECK-LABEL: @fma_fneg_x_fneg_y_vec(
 ; CHECK-NEXT:    [[FMA:%.*]] = call <2 x float> @llvm.fma.v2f32(<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]], <2 x float> [[Z:%.*]])
@@ -30,6 +41,17 @@ define <2 x float> @fma_fneg_x_fneg_y_ve
   ret <2 x float> %fma
 }
 
+define <2 x float> @fma_unary_fneg_x_unary_fneg_y_vec(<2 x float> %x, <2 x float> %y, <2 x float> %z) {
+; CHECK-LABEL: @fma_unary_fneg_x_unary_fneg_y_vec(
+; CHECK-NEXT:    [[FMA:%.*]] = call <2 x float> @llvm.fma.v2f32(<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]], <2 x float> [[Z:%.*]])
+; CHECK-NEXT:    ret <2 x float> [[FMA]]
+;
+  %xn = fneg <2 x float> %x
+  %yn = fneg <2 x float> %y
+  %fma = call <2 x float> @llvm.fma.v2f32(<2 x float> %xn, <2 x float> %yn, <2 x float> %z)
+  ret <2 x float> %fma
+}
+
 define <2 x float> @fma_fneg_x_fneg_y_vec_undef(<2 x float> %x, <2 x float> %y, <2 x float> %z) {
 ; CHECK-LABEL: @fma_fneg_x_fneg_y_vec_undef(
 ; CHECK-NEXT:    [[FMA:%.*]] = call <2 x float> @llvm.fma.v2f32(<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]], <2 x float> [[Z:%.*]])
@@ -52,6 +74,17 @@ define float @fma_fneg_x_fneg_y_fast(flo
   ret float %fma
 }
 
+define float @fma_unary_fneg_x_unary_fneg_y_fast(float %x, float %y, float %z) {
+; CHECK-LABEL: @fma_unary_fneg_x_unary_fneg_y_fast(
+; CHECK-NEXT:    [[FMA:%.*]] = call fast float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
+; CHECK-NEXT:    ret float [[FMA]]
+;
+  %x.fneg = fneg float %x
+  %y.fneg = fneg float %y
+  %fma = call fast float @llvm.fma.f32(float %x.fneg, float %y.fneg, float %z)
+  ret float %fma
+}
+
 define float @fma_fneg_const_fneg_y(float %y, float %z) {
 ; CHECK-LABEL: @fma_fneg_const_fneg_y(
 ; CHECK-NEXT:    [[FMA:%.*]] = call float @llvm.fma.f32(float [[Y:%.*]], float bitcast (i32 ptrtoint (i32* @external to i32) to float), float [[Z:%.*]])
@@ -62,6 +95,16 @@ define float @fma_fneg_const_fneg_y(floa
   ret float %fma
 }
 
+define float @fma_unary_fneg_const_unary_fneg_y(float %y, float %z) {
+; CHECK-LABEL: @fma_unary_fneg_const_unary_fneg_y(
+; CHECK-NEXT:    [[FMA:%.*]] = call float @llvm.fma.f32(float [[Y:%.*]], float bitcast (i32 ptrtoint (i32* @external to i32) to float), float [[Z:%.*]])
+; CHECK-NEXT:    ret float [[FMA]]
+;
+  %y.fneg = fneg float %y
+  %fma = call float @llvm.fma.f32(float fneg (float bitcast (i32 ptrtoint (i32* @external to i32) to float)), float %y.fneg, float %z)
+  ret float %fma
+}
+
 define float @fma_fneg_x_fneg_const(float %x, float %z) {
 ; CHECK-LABEL: @fma_fneg_x_fneg_const(
 ; CHECK-NEXT:    [[FMA:%.*]] = call float @llvm.fma.f32(float [[X:%.*]], float bitcast (i32 ptrtoint (i32* @external to i32) to float), float [[Z:%.*]])
@@ -72,6 +115,16 @@ define float @fma_fneg_x_fneg_const(floa
   ret float %fma
 }
 
+define float @fma_unary_fneg_x_unary_fneg_const(float %x, float %z) {
+; CHECK-LABEL: @fma_unary_fneg_x_unary_fneg_const(
+; CHECK-NEXT:    [[FMA:%.*]] = call float @llvm.fma.f32(float [[X:%.*]], float bitcast (i32 ptrtoint (i32* @external to i32) to float), float [[Z:%.*]])
+; CHECK-NEXT:    ret float [[FMA]]
+;
+  %x.fneg = fneg float %x
+  %fma = call float @llvm.fma.f32(float %x.fneg, float fneg (float bitcast (i32 ptrtoint (i32* @external to i32) to float)), float %z)
+  ret float %fma
+}
+
 define float @fma_fabs_x_fabs_y(float %x, float %y, float %z) {
 ; CHECK-LABEL: @fma_fabs_x_fabs_y(
 ; CHECK-NEXT:    [[X_FABS:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
@@ -116,6 +169,17 @@ define float @fmuladd_fneg_x_fneg_y(floa
   ret float %fmuladd
 }
 
+define float @fmuladd_unary_fneg_x_unary_fneg_y(float %x, float %y, float %z) {
+; CHECK-LABEL: @fmuladd_unary_fneg_x_unary_fneg_y(
+; CHECK-NEXT:    [[FMULADD:%.*]] = call float @llvm.fmuladd.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
+; CHECK-NEXT:    ret float [[FMULADD]]
+;
+  %x.fneg = fneg float %x
+  %y.fneg = fneg float %y
+  %fmuladd = call float @llvm.fmuladd.f32(float %x.fneg, float %y.fneg, float %z)
+  ret float %fmuladd
+}
+
 define float @fmuladd_fneg_x_fneg_y_fast(float %x, float %y, float %z) {
 ; CHECK-LABEL: @fmuladd_fneg_x_fneg_y_fast(
 ; CHECK-NEXT:    [[TMP1:%.*]] = fmul fast float [[X:%.*]], [[Y:%.*]]
@@ -128,6 +192,18 @@ define float @fmuladd_fneg_x_fneg_y_fast
   ret float %fmuladd
 }
 
+define float @fmuladd_unary_fneg_x_unary_fneg_y_fast(float %x, float %y, float %z) {
+; CHECK-LABEL: @fmuladd_unary_fneg_x_unary_fneg_y_fast(
+; CHECK-NEXT:    [[TMP1:%.*]] = fmul fast float [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    [[FMULADD:%.*]] = fadd fast float [[TMP1]], [[Z:%.*]]
+; CHECK-NEXT:    ret float [[FMULADD]]
+;
+  %x.fneg = fneg float %x
+  %y.fneg = fneg float %y
+  %fmuladd = call fast float @llvm.fmuladd.f32(float %x.fneg, float %y.fneg, float %z)
+  ret float %fmuladd
+}
+
 define float @fmuladd_fneg_const_fneg_y(float %y, float %z) {
 ; CHECK-LABEL: @fmuladd_fneg_const_fneg_y(
 ; CHECK-NEXT:    [[FMULADD:%.*]] = call float @llvm.fmuladd.f32(float [[Y:%.*]], float bitcast (i32 ptrtoint (i32* @external to i32) to float), float [[Z:%.*]])
@@ -138,6 +214,16 @@ define float @fmuladd_fneg_const_fneg_y(
   ret float %fmuladd
 }
 
+define float @fmuladd_unary_fneg_const_unary_fneg_y(float %y, float %z) {
+; CHECK-LABEL: @fmuladd_unary_fneg_const_unary_fneg_y(
+; CHECK-NEXT:    [[FMULADD:%.*]] = call float @llvm.fmuladd.f32(float [[Y:%.*]], float bitcast (i32 ptrtoint (i32* @external to i32) to float), float [[Z:%.*]])
+; CHECK-NEXT:    ret float [[FMULADD]]
+;
+  %y.fneg = fneg float %y
+  %fmuladd = call float @llvm.fmuladd.f32(float fneg (float bitcast (i32 ptrtoint (i32* @external to i32) to float)), float %y.fneg, float %z)
+  ret float %fmuladd
+}
+
 define float @fmuladd_fneg_x_fneg_const(float %x, float %z) {
 ; CHECK-LABEL: @fmuladd_fneg_x_fneg_const(
 ; CHECK-NEXT:    [[FMULADD:%.*]] = call float @llvm.fmuladd.f32(float [[X:%.*]], float bitcast (i32 ptrtoint (i32* @external to i32) to float), float [[Z:%.*]])
@@ -148,6 +234,16 @@ define float @fmuladd_fneg_x_fneg_const(
   ret float %fmuladd
 }
 
+define float @fmuladd_unary_fneg_x_unary_fneg_const(float %x, float %z) {
+; CHECK-LABEL: @fmuladd_unary_fneg_x_unary_fneg_const(
+; CHECK-NEXT:    [[FMULADD:%.*]] = call float @llvm.fmuladd.f32(float [[X:%.*]], float bitcast (i32 ptrtoint (i32* @external to i32) to float), float [[Z:%.*]])
+; CHECK-NEXT:    ret float [[FMULADD]]
+;
+  %x.fneg = fneg float %x
+  %fmuladd = call float @llvm.fmuladd.f32(float %x.fneg, float fneg (float bitcast (i32 ptrtoint (i32* @external to i32) to float)), float %z)
+  ret float %fmuladd
+}
+
 define float @fmuladd_fabs_x_fabs_y(float %x, float %y, float %z) {
 ; CHECK-LABEL: @fmuladd_fabs_x_fabs_y(
 ; CHECK-NEXT:    [[X_FABS:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])




More information about the llvm-commits mailing list