[llvm] r218431 - [X86,AVX] Add an isel pattern for X86VBroadcast.

Akira Hatanaka ahatanaka at apple.com
Wed Sep 24 17:26:16 PDT 2014


Author: ahatanak
Date: Wed Sep 24 19:26:15 2014
New Revision: 218431

URL: http://llvm.org/viewvc/llvm-project?rev=218431&view=rev
Log:
[X86,AVX] Add an isel pattern for X86VBroadcast.

This fixes PR21050 and rdar://problem/18434607.

Modified:
    llvm/trunk/lib/Target/X86/X86InstrSSE.td
    llvm/trunk/test/CodeGen/X86/avx-movdup.ll

Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=218431&r1=218430&r2=218431&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Wed Sep 24 19:26:15 2014
@@ -8775,6 +8775,9 @@ let Predicates = [HasAVX] in {
               (VPSHUFDri (COPY_TO_REGCLASS GR64:$src, VR128), 0x44), sub_xmm),
               (VPSHUFDri (COPY_TO_REGCLASS GR64:$src, VR128), 0x44), 1)>;
   }
+
+  def : Pat<(v2f64 (X86VBroadcast f64:$src)),
+            (VMOVDDUPrr (COPY_TO_REGCLASS FR64:$src, VR128))>;
 }
 
 //===----------------------------------------------------------------------===//

Modified: llvm/trunk/test/CodeGen/X86/avx-movdup.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-movdup.ll?rev=218431&r1=218430&r2=218431&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx-movdup.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx-movdup.ll Wed Sep 24 19:26:15 2014
@@ -32,3 +32,22 @@ entry:
   ret <4 x i64> %1
 }
 
+; Check that there is a pattern (v2f64 (X86VBroadcast f64:$src)).
+
+; CHECK-LABEL: _vbroadcast_v128_f64
+; CHECK: vmovsd LCPI{{[0-9]+}}_0(%rip), %xmm[[R0:[0-9]+]]
+; CHECK: vmovddup %xmm[[R0]], %xmm{{[0-9]+}}
+
+ at E1 = external global [5 x double], align 16
+ at .str3 = external unnamed_addr constant [44 x i8], align 1
+
+define void @vbroadcast_v128_f64() #0 {
+entry:
+  store <2 x double> <double -1.000000e+00, double -1.000000e+00>, <2 x double>* bitcast (double* getelementptr inbounds ([5 x double]* @E1, i64 0, i64 2) to <2 x double>*), align 16
+  tail call void @foo1(double -1.000000e+00)
+  ret void
+}
+
+declare void @foo1(double)
+
+attributes #0 = { optsize }





More information about the llvm-commits mailing list