[llvm] r362741 - [NFC][CodeGen] Add unary fneg tests to X86/fma-scalar-combine.ll
Cameron McInally via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 13:11:30 PDT 2019
Author: mcinally
Date: Thu Jun 6 13:11:30 2019
New Revision: 362741
URL: http://llvm.org/viewvc/llvm-project?rev=362741&view=rev
Log:
[NFC][CodeGen] Add unary fneg tests to X86/fma-scalar-combine.ll
Modified:
llvm/trunk/test/CodeGen/X86/fma-scalar-combine.ll
Modified: llvm/trunk/test/CodeGen/X86/fma-scalar-combine.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fma-scalar-combine.ll?rev=362741&r1=362740&r2=362741&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fma-scalar-combine.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fma-scalar-combine.ll Thu Jun 6 13:11:30 2019
@@ -428,6 +428,31 @@ entry:
ret <2 x double> %12
}
+define <2 x double> @combine_scalar_mask_fnmsub_f32_unary_fneg(<2 x double> %a, i8 zeroext %k, <2 x double> %b, <2 x double> %c) {
+; CHECK-LABEL: combine_scalar_mask_fnmsub_f32_unary_fneg:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: kmovw %edi, %k1 # encoding: [0xc5,0xf8,0x92,0xcf]
+; CHECK-NEXT: vfnmsub213ss %xmm2, %xmm1, %xmm0 {%k1} # encoding: [0x62,0xf2,0x75,0x09,0xaf,0xc2]
+; CHECK-NEXT: # xmm0 = -(xmm1 * xmm0) - xmm2
+; CHECK-NEXT: retq # encoding: [0xc3]
+entry:
+ %0 = bitcast <2 x double> %a to <4 x float>
+ %1 = bitcast <2 x double> %b to <4 x float>
+ %2 = bitcast <2 x double> %c to <4 x float>
+ %3 = extractelement <4 x float> %0, i64 0
+ %4 = extractelement <4 x float> %1, i64 0
+ %5 = extractelement <4 x float> %2, i64 0
+ %sub = fneg fast float %5
+ %6 = fmul fast float %4, %3
+ %7 = fsub fast float %sub, %6
+ %8 = bitcast i8 %k to <8 x i1>
+ %9 = extractelement <8 x i1> %8, i64 0
+ %10 = select i1 %9, float %7, float %3
+ %11 = insertelement <4 x float> %0, float %10, i64 0
+ %12 = bitcast <4 x float> %11 to <2 x double>
+ ret <2 x double> %12
+}
+
define <2 x double> @combine_scalar_mask_fnmsub_f64(<2 x double> %a, i8 zeroext %k, <2 x double> %b, <2 x double> %c) {
; CHECK-LABEL: combine_scalar_mask_fnmsub_f64:
; CHECK: # %bb.0: # %entry
@@ -449,6 +474,27 @@ entry:
ret <2 x double> %8
}
+define <2 x double> @combine_scalar_mask_fnmsub_f64_unary_fneg(<2 x double> %a, i8 zeroext %k, <2 x double> %b, <2 x double> %c) {
+; CHECK-LABEL: combine_scalar_mask_fnmsub_f64_unary_fneg:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: kmovw %edi, %k1 # encoding: [0xc5,0xf8,0x92,0xcf]
+; CHECK-NEXT: vfnmsub213sd %xmm2, %xmm1, %xmm0 {%k1} # encoding: [0x62,0xf2,0xf5,0x09,0xaf,0xc2]
+; CHECK-NEXT: # xmm0 = -(xmm1 * xmm0) - xmm2
+; CHECK-NEXT: retq # encoding: [0xc3]
+entry:
+ %0 = extractelement <2 x double> %a, i64 0
+ %1 = extractelement <2 x double> %b, i64 0
+ %2 = extractelement <2 x double> %c, i64 0
+ %sub = fneg fast double %2
+ %3 = fmul fast double %1, %0
+ %4 = fsub fast double %sub, %3
+ %5 = bitcast i8 %k to <8 x i1>
+ %6 = extractelement <8 x i1> %5, i64 0
+ %7 = select i1 %6, double %4, double %0
+ %8 = insertelement <2 x double> %a, double %7, i64 0
+ ret <2 x double> %8
+}
+
define <2 x double> @combine_scalar_maskz_fnmsub_32(i8 zeroext %k, <2 x double> %a, <2 x double> %b, <2 x double> %c) {
; CHECK-LABEL: combine_scalar_maskz_fnmsub_32:
; CHECK: # %bb.0: # %entry
@@ -474,8 +520,8 @@ entry:
ret <2 x double> %12
}
-define <2 x double> @combine_scalar_maskz_fnmsub_64(i8 zeroext %k, <2 x double> %a, <2 x double> %b, <2 x double> %c) {
-; CHECK-LABEL: combine_scalar_maskz_fnmsub_64:
+define <2 x double> @combine_scalar_maskz_fnmsub_64_unary_fneg(i8 zeroext %k, <2 x double> %a, <2 x double> %b, <2 x double> %c) {
+; CHECK-LABEL: combine_scalar_maskz_fnmsub_64_unary_fneg:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: kmovw %edi, %k1 # encoding: [0xc5,0xf8,0x92,0xcf]
; CHECK-NEXT: vfnmsub213sd %xmm2, %xmm1, %xmm0 {%k1} {z} # encoding: [0x62,0xf2,0xf5,0x89,0xaf,0xc2]
@@ -485,7 +531,7 @@ entry:
%0 = extractelement <2 x double> %a, i64 0
%1 = extractelement <2 x double> %b, i64 0
%2 = extractelement <2 x double> %c, i64 0
- %sub = fsub fast double -0.000000e+00, %2
+ %sub = fneg fast double %2
%3 = fmul fast double %1, %0
%4 = fsub fast double %sub, %3
%5 = bitcast i8 %k to <8 x i1>
@@ -521,6 +567,32 @@ entry:
ret <2 x double> %12
}
+define <2 x double> @combine_scalar_mask3_fnmsub_32_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c, i8 zeroext %k) {
+; CHECK-LABEL: combine_scalar_mask3_fnmsub_32_unary_fneg:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: kmovw %edi, %k1 # encoding: [0xc5,0xf8,0x92,0xcf]
+; CHECK-NEXT: vfnmsub231ss %xmm0, %xmm1, %xmm2 {%k1} # encoding: [0x62,0xf2,0x75,0x09,0xbf,0xd0]
+; CHECK-NEXT: # xmm2 = -(xmm1 * xmm0) - xmm2
+; CHECK-NEXT: vmovaps %xmm2, %xmm0 # encoding: [0xc5,0xf8,0x28,0xc2]
+; CHECK-NEXT: retq # encoding: [0xc3]
+entry:
+ %0 = bitcast <2 x double> %a to <4 x float>
+ %1 = bitcast <2 x double> %b to <4 x float>
+ %2 = bitcast <2 x double> %c to <4 x float>
+ %3 = extractelement <4 x float> %0, i64 0
+ %4 = extractelement <4 x float> %1, i64 0
+ %5 = extractelement <4 x float> %2, i64 0
+ %sub = fneg fast float %5
+ %6 = fmul fast float %4, %3
+ %7 = fsub fast float %sub, %6
+ %8 = bitcast i8 %k to <8 x i1>
+ %9 = extractelement <8 x i1> %8, i64 0
+ %10 = select i1 %9, float %7, float %5
+ %11 = insertelement <4 x float> %2, float %10, i64 0
+ %12 = bitcast <4 x float> %11 to <2 x double>
+ ret <2 x double> %12
+}
+
define <2 x double> @combine_scalar_mask3_fnmsub_64(<2 x double> %a, <2 x double> %b, <2 x double> %c, i8 zeroext %k) {
; CHECK-LABEL: combine_scalar_mask3_fnmsub_64:
; CHECK: # %bb.0: # %entry
@@ -537,6 +609,28 @@ entry:
%3 = fmul fast double %1, %0
%4 = fsub fast double %sub, %3
%5 = bitcast i8 %k to <8 x i1>
+ %6 = extractelement <8 x i1> %5, i64 0
+ %7 = select i1 %6, double %4, double %2
+ %8 = insertelement <2 x double> %c, double %7, i64 0
+ ret <2 x double> %8
+}
+
+define <2 x double> @combine_scalar_mask3_fnmsub_64_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c, i8 zeroext %k) {
+; CHECK-LABEL: combine_scalar_mask3_fnmsub_64_unary_fneg:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: kmovw %edi, %k1 # encoding: [0xc5,0xf8,0x92,0xcf]
+; CHECK-NEXT: vfnmsub231sd %xmm0, %xmm1, %xmm2 {%k1} # encoding: [0x62,0xf2,0xf5,0x09,0xbf,0xd0]
+; CHECK-NEXT: # xmm2 = -(xmm1 * xmm0) - xmm2
+; CHECK-NEXT: vmovapd %xmm2, %xmm0 # encoding: [0xc5,0xf9,0x28,0xc2]
+; CHECK-NEXT: retq # encoding: [0xc3]
+entry:
+ %0 = extractelement <2 x double> %a, i64 0
+ %1 = extractelement <2 x double> %b, i64 0
+ %2 = extractelement <2 x double> %c, i64 0
+ %sub = fneg fast double %2
+ %3 = fmul fast double %1, %0
+ %4 = fsub fast double %sub, %3
+ %5 = bitcast i8 %k to <8 x i1>
%6 = extractelement <8 x i1> %5, i64 0
%7 = select i1 %6, double %4, double %2
%8 = insertelement <2 x double> %c, double %7, i64 0
More information about the llvm-commits
mailing list