[llvm] r334308 - [x86] add tests for node-level FMF; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 8 10:54:28 PDT 2018


Author: spatel
Date: Fri Jun  8 10:54:28 2018
New Revision: 334308

URL: http://llvm.org/viewvc/llvm-project?rev=334308&view=rev
Log:
[x86] add tests for node-level FMF; NFC

These cases should be optimized using the change from D47911.

Modified:
    llvm/trunk/test/CodeGen/X86/fmul-combines.ll

Modified: llvm/trunk/test/CodeGen/X86/fmul-combines.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fmul-combines.ll?rev=334308&r1=334307&r2=334308&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fmul-combines.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fmul-combines.ll Fri Jun  8 10:54:28 2018
@@ -86,6 +86,32 @@ define <4 x float> @fmul_v4f32_two_const
   ret <4 x float> %z
 }
 
+; Node-level FMF and no function-level attributes.
+
+define <4 x float> @fmul_v4f32_two_consts_no_splat_reassoc(<4 x float> %x) {
+; CHECK-LABEL: fmul_v4f32_two_consts_no_splat_reassoc:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    mulps {{.*}}(%rip), %xmm0
+; CHECK-NEXT:    mulps {{.*}}(%rip), %xmm0
+; CHECK-NEXT:    retq
+  %y = fmul <4 x float> %x, <float 1.0, float 2.0, float 3.0, float 4.0>
+  %z = fmul reassoc <4 x float> %y, <float 5.0, float 6.0, float 7.0, float 8.0>
+  ret <4 x float> %z
+}
+
+; Multiplication by 2.0 is a special case because that gets converted to fadd x, x.
+
+define <4 x float> @fmul_v4f32_two_consts_no_splat_reassoc_2(<4 x float> %x) {
+; CHECK-LABEL: fmul_v4f32_two_consts_no_splat_reassoc_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    addps %xmm0, %xmm0
+; CHECK-NEXT:    mulps {{.*}}(%rip), %xmm0
+; CHECK-NEXT:    retq
+  %y = fadd <4 x float> %x, %x
+  %z = fmul reassoc <4 x float> %y, <float 5.0, float 6.0, float 7.0, float 8.0>
+  ret <4 x float> %z
+}
+
 ; CHECK: float 6
 ; CHECK: float 14
 ; CHECK: float 24




More information about the llvm-commits mailing list