summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-08-20 13:25:55 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-08-20 13:25:55 +0000
commitcec028fc14dda68c80e489b861adcf28944151f6 (patch)
tree23332308cd1745a2049ee1dd5c92882a9f87ccf9
parent50fdaaf5b88414d181cb896c6a5b5a3806b8a740 (diff)
downloadbcm5719-llvm-cec028fc14dda68c80e489b861adcf28944151f6.tar.gz
bcm5719-llvm-cec028fc14dda68c80e489b861adcf28944151f6.zip
[X86][FMA] Add FMA 'negated expression' combine tests for D63141
llvm-svn: 369384
-rw-r--r--llvm/test/CodeGen/X86/fma-fneg-combine-2.ll89
1 files changed, 89 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fma-fneg-combine-2.ll b/llvm/test/CodeGen/X86/fma-fneg-combine-2.ll
new file mode 100644
index 00000000000..1f520f9a398
--- /dev/null
+++ b/llvm/test/CodeGen/X86/fma-fneg-combine-2.ll
@@ -0,0 +1,89 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx,fma | FileCheck %s --check-prefixes=CHECK,FMA3
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx,fma4 | FileCheck %s --check-prefixes=CHECK,FMA4
+
+define float @test_fneg_fma_subx_y_negz_f32(float %w, float %x, float %y, float %z) {
+; FMA3-LABEL: test_fneg_fma_subx_y_negz_f32:
+; FMA3: # %bb.0: # %entry
+; FMA3-NEXT: vsubss %xmm1, %xmm0, %xmm0
+; FMA3-NEXT: vfnmadd213ss {{.*#+}} xmm0 = -(xmm2 * xmm0) + xmm3
+; FMA3-NEXT: retq
+;
+; FMA4-LABEL: test_fneg_fma_subx_y_negz_f32:
+; FMA4: # %bb.0: # %entry
+; FMA4-NEXT: vsubss %xmm1, %xmm0, %xmm0
+; FMA4-NEXT: vfnmaddss %xmm3, %xmm2, %xmm0, %xmm0
+; FMA4-NEXT: retq
+entry:
+ %subx = fsub nsz float %w, %x
+ %negz = fsub float -0.000000e+00, %z
+ %0 = tail call nsz float @llvm.fma.f32(float %subx, float %y, float %negz)
+ %1 = fsub float -0.000000e+00, %0
+ ret float %1
+}
+
+define float @test_fneg_fma_x_suby_negz_f32(float %w, float %x, float %y, float %z) {
+; FMA3-LABEL: test_fneg_fma_x_suby_negz_f32:
+; FMA3: # %bb.0: # %entry
+; FMA3-NEXT: vsubss %xmm2, %xmm0, %xmm0
+; FMA3-NEXT: vfnmadd213ss {{.*#+}} xmm0 = -(xmm1 * xmm0) + xmm3
+; FMA3-NEXT: retq
+;
+; FMA4-LABEL: test_fneg_fma_x_suby_negz_f32:
+; FMA4: # %bb.0: # %entry
+; FMA4-NEXT: vsubss %xmm2, %xmm0, %xmm0
+; FMA4-NEXT: vfnmaddss %xmm3, %xmm0, %xmm1, %xmm0
+; FMA4-NEXT: retq
+entry:
+ %suby = fsub nsz float %w, %y
+ %negz = fsub float -0.000000e+00, %z
+ %0 = tail call nsz float @llvm.fma.f32(float %x, float %suby, float %negz)
+ %1 = fsub float -0.000000e+00, %0
+ ret float %1
+}
+
+define float @test_fneg_fma_subx_suby_negz_f32(float %w, float %x, float %y, float %z) {
+; FMA3-LABEL: test_fneg_fma_subx_suby_negz_f32:
+; FMA3: # %bb.0: # %entry
+; FMA3-NEXT: vsubss %xmm1, %xmm0, %xmm1
+; FMA3-NEXT: vsubss %xmm2, %xmm0, %xmm0
+; FMA3-NEXT: vfnmadd213ss {{.*#+}} xmm0 = -(xmm1 * xmm0) + xmm3
+; FMA3-NEXT: retq
+;
+; FMA4-LABEL: test_fneg_fma_subx_suby_negz_f32:
+; FMA4: # %bb.0: # %entry
+; FMA4-NEXT: vsubss %xmm1, %xmm0, %xmm1
+; FMA4-NEXT: vsubss %xmm2, %xmm0, %xmm0
+; FMA4-NEXT: vfnmaddss %xmm3, %xmm0, %xmm1, %xmm0
+; FMA4-NEXT: retq
+entry:
+ %subx = fsub nsz float %w, %x
+ %suby = fsub nsz float %w, %y
+ %negz = fsub float -0.000000e+00, %z
+ %0 = tail call nsz float @llvm.fma.f32(float %subx, float %suby, float %negz)
+ %1 = fsub float -0.000000e+00, %0
+ ret float %1
+}
+
+define float @test_fneg_fma_subx_negy_negz_f32(float %w, float %x, float %y, float %z) {
+; FMA3-LABEL: test_fneg_fma_subx_negy_negz_f32:
+; FMA3: # %bb.0: # %entry
+; FMA3-NEXT: vsubss %xmm1, %xmm0, %xmm0
+; FMA3-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm2 * xmm0) + xmm3
+; FMA3-NEXT: retq
+;
+; FMA4-LABEL: test_fneg_fma_subx_negy_negz_f32:
+; FMA4: # %bb.0: # %entry
+; FMA4-NEXT: vsubss %xmm1, %xmm0, %xmm0
+; FMA4-NEXT: vfmaddss %xmm3, %xmm2, %xmm0, %xmm0
+; FMA4-NEXT: retq
+entry:
+ %subx = fsub nsz float %w, %x
+ %negy = fsub float -0.000000e+00, %y
+ %negz = fsub float -0.000000e+00, %z
+ %0 = tail call nsz float @llvm.fma.f32(float %subx, float %negy, float %negz)
+ %1 = fsub float -0.000000e+00, %0
+ ret float %1
+}
+
+declare float @llvm.fma.f32(float, float, float)
OpenPOWER on IntegriCloud