]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/X86/vec_splat.ll
Vendor import of llvm RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
[FreeBSD/FreeBSD.git] / test / CodeGen / X86 / vec_splat.ll
1 ; RUN: llc < %s -march=x86 -mcpu=pentium4 -mattr=+sse2 | FileCheck %s -check-prefix=SSE2
2 ; RUN: llc < %s -march=x86 -mcpu=pentium4 -mattr=+sse3 | FileCheck %s -check-prefix=SSE3
3
4 define void @test_v4sf(<4 x float>* %P, <4 x float>* %Q, float %X) nounwind {
5         %tmp = insertelement <4 x float> zeroinitializer, float %X, i32 0               ; <<4 x float>> [#uses=1]
6         %tmp2 = insertelement <4 x float> %tmp, float %X, i32 1         ; <<4 x float>> [#uses=1]
7         %tmp4 = insertelement <4 x float> %tmp2, float %X, i32 2                ; <<4 x float>> [#uses=1]
8         %tmp6 = insertelement <4 x float> %tmp4, float %X, i32 3                ; <<4 x float>> [#uses=1]
9         %tmp8 = load <4 x float>* %Q            ; <<4 x float>> [#uses=1]
10         %tmp10 = fmul <4 x float> %tmp8, %tmp6          ; <<4 x float>> [#uses=1]
11         store <4 x float> %tmp10, <4 x float>* %P
12         ret void
13
14 ; SSE2-LABEL: test_v4sf:
15 ; SSE2: pshufd $0
16
17 ; SSE3-LABEL: test_v4sf:
18 ; SSE3: pshufd $0
19 }
20
21 define void @test_v2sd(<2 x double>* %P, <2 x double>* %Q, double %X) nounwind {
22         %tmp = insertelement <2 x double> zeroinitializer, double %X, i32 0             ; <<2 x double>> [#uses=1]
23         %tmp2 = insertelement <2 x double> %tmp, double %X, i32 1               ; <<2 x double>> [#uses=1]
24         %tmp4 = load <2 x double>* %Q           ; <<2 x double>> [#uses=1]
25         %tmp6 = fmul <2 x double> %tmp4, %tmp2          ; <<2 x double>> [#uses=1]
26         store <2 x double> %tmp6, <2 x double>* %P
27         ret void
28
29 ; SSE2-LABEL: test_v2sd:
30 ; SSE2: shufpd $0
31
32 ; SSE3-LABEL: test_v2sd:
33 ; SSE3: movddup
34 }
35
36 ; Fold extract of a load into the load's address computation. This avoids spilling to the stack.
37 define <4 x float> @load_extract_splat(<4 x float>* nocapture readonly %ptr, i64 %i, i64 %j) nounwind {
38   %1 = getelementptr inbounds <4 x float>* %ptr, i64 %i
39   %2 = load <4 x float>* %1, align 16
40   %3 = extractelement <4 x float> %2, i64 %j
41   %4 = insertelement <4 x float> undef, float %3, i32 0
42   %5 = insertelement <4 x float> %4, float %3, i32 1
43   %6 = insertelement <4 x float> %5, float %3, i32 2
44   %7 = insertelement <4 x float> %6, float %3, i32 3
45   ret <4 x float> %7
46   
47 ; AVX-LABEL: load_extract_splat
48 ; AVX-NOT: movs
49 ; AVX: vbroadcastss
50 }