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

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218431 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka 2014-09-25 00:26:15 +00:00
parent bdecfeb723
commit 0253523c92
2 changed files with 22 additions and 0 deletions

View File

@ -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))>;
}
//===----------------------------------------------------------------------===//

View File

@ -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]+}}
@E1 = external global [5 x double], align 16
@.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 }