From dcec492d93142daa7ac7ecd98ae63fd734bed334 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 2 Oct 2019 12:32:37 +0000 Subject: [PATCH] [InstCombine] Precommit tests for D68265 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373458 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/fma.ll | 206 ++++++++++++++++++++++++++++- 1 file changed, 204 insertions(+), 2 deletions(-) diff --git a/test/Transforms/InstCombine/fma.ll b/test/Transforms/InstCombine/fma.ll index 33dc8100b58..f123f5d56b8 100644 --- a/test/Transforms/InstCombine/fma.ll +++ b/test/Transforms/InstCombine/fma.ll @@ -182,7 +182,7 @@ define float @fmuladd_unary_fneg_x_unary_fneg_y(float %x, float %y, float %z) { 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:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = fmul fast float [[Y:%.*]], [[X:%.*]] ; CHECK-NEXT: [[FMULADD:%.*]] = fadd fast float [[TMP1]], [[Z:%.*]] ; CHECK-NEXT: ret float [[FMULADD]] ; @@ -194,7 +194,7 @@ define float @fmuladd_fneg_x_fneg_y_fast(float %x, float %y, float %z) { 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: [[TMP1:%.*]] = fmul fast float [[Y:%.*]], [[X:%.*]] ; CHECK-NEXT: [[FMULADD:%.*]] = fadd fast float [[TMP1]], [[Z:%.*]] ; CHECK-NEXT: ret float [[FMULADD]] ; @@ -499,6 +499,129 @@ entry: ret <2 x double> %res } +define <2 x double> @fma_nan_and_const_0(<2 x double> %b) { +; CHECK-LABEL: @fma_nan_and_const_0( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> , <2 x double> , <2 x double> %b) + ret <2 x double> %res +} + +define <2 x double> @fma_nan_and_const_1(<2 x double> %b) { +; CHECK-LABEL: @fma_nan_and_const_1( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> , <2 x double> , <2 x double> %b) + ret <2 x double> %res +} + +define <2 x double> @fma_nan_and_const_2(<2 x double> %b) { +; CHECK-LABEL: @fma_nan_and_const_2( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> , <2 x double> %b, <2 x double> ) + ret <2 x double> %res +} + +define <2 x double> @fma_undef_0(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fma_undef_0( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> , <2 x double> %b, <2 x double> %c) + ret <2 x double> %res +} + +define <2 x double> @fma_undef_1(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fma_undef_1( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> , <2 x double> %c) + ret <2 x double> %res +} + +define <2 x double> @fma_undef_2(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fma_undef_2( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> %c, <2 x double> ) + ret <2 x double> %res +} + +define <2 x double> @fma_partial_undef_0(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fma_partial_undef_0( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[RES:%.*]] = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> [[B:%.*]], <2 x double> , <2 x double> [[C:%.*]]) +; CHECK-NEXT: ret <2 x double> [[RES]] +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> , <2 x double> %b, <2 x double> %c) + ret <2 x double> %res +} + +define <2 x double> @fma_partial_undef_1(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fma_partial_undef_1( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[RES:%.*]] = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> [[B:%.*]], <2 x double> , <2 x double> [[C:%.*]]) +; CHECK-NEXT: ret <2 x double> [[RES]] +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> , <2 x double> %c) + ret <2 x double> %res +} + +define <2 x double> @fma_partial_undef_2(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fma_partial_undef_2( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[RES:%.*]] = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> [[B:%.*]], <2 x double> [[C:%.*]], <2 x double> ) +; CHECK-NEXT: ret <2 x double> [[RES]] +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> %c, <2 x double> ) + ret <2 x double> %res +} + + +define <2 x double> @fma_nan_0(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fma_nan_0( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> , <2 x double> %b, <2 x double> %c) + ret <2 x double> %res +} +define <2 x double> @fma_nan_1(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fma_nan_1( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> , <2 x double> %c) + ret <2 x double> %res +} + +define <2 x double> @fma_nan_2(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fma_nan_2( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> %c, <2 x double> ) + ret <2 x double> %res +} + define <2 x double> @fmuladd_const_fmul(<2 x double> %b) { ; CHECK-LABEL: @fmuladd_const_fmul( ; CHECK-NEXT: entry: @@ -510,6 +633,85 @@ entry: ret <2 x double> %res } +define <2 x double> @fmuladd_nan_and_const_0(<2 x double> %b) { +; CHECK-LABEL: @fmuladd_nan_and_const_0( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> , <2 x double> , <2 x double> %b) + ret <2 x double> %res +} + +define <2 x double> @fmuladd_nan_and_const_1(<2 x double> %b) { +; CHECK-LABEL: @fmuladd_nan_and_const_1( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> , <2 x double> , <2 x double> %b) + ret <2 x double> %res +} + +define <2 x double> @fmuladd_nan_and_const_2(<2 x double> %b) { +; CHECK-LABEL: @fmuladd_nan_and_const_2( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> , <2 x double> %b, <2 x double> ) + ret <2 x double> %res +} + +define <2 x double> @fmuladd_nan_0(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fmuladd_nan_0( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> , <2 x double> %b, <2 x double> %c) + ret <2 x double> %res +} + +define <2 x double> @fmuladd_nan_1(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fmuladd_nan_1( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> %b, <2 x double> , <2 x double> %c) + ret <2 x double> %res +} + +define <2 x double> @fmuladd_undef_0(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fmuladd_undef_0( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> , <2 x double> %b, <2 x double> %c) + ret <2 x double> %res +} + +define <2 x double> @fmuladd_undef_1(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fmuladd_undef_1( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> %b, <2 x double> , <2 x double> %c) + ret <2 x double> %res +} + +define <2 x double> @fmuladd_undef_2(<2 x double> %b, <2 x double> %c) { +; CHECK-LABEL: @fmuladd_undef_2( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret <2 x double> +; +entry: + %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> %b, <2 x double> %c, <2 x double> ) + ret <2 x double> %res +} declare <2 x double> @llvm.fma.v2f64(<2 x double>, <2 x double>, <2 x double>) declare <2 x double> @llvm.sqrt.v2f64(<2 x double>) -- 2.40.0