comparison test/CodeGen/X86/vec_set-3.ll @ 77:54457678186b LLVM3.6

LLVM 3.6
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Mon, 08 Sep 2014 22:06:00 +0900
parents 95c75e76d11b
children 60c9769439b8
comparison
equal deleted inserted replaced
34:e874dbf0ad9d 77:54457678186b
1 ; RUN: llc < %s -march=x86 -mattr=+sse2 -mcpu=penryn -o %t 1 ; RUN: llc < %s -march=x86 -mattr=+sse2 -mcpu=penryn | FileCheck %s
2 ; RUN: grep pshufd %t | count 2 2 ; RUN: llc < %s -march=x86 -mattr=+sse2 -mcpu=penryn -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=CHECK-EXP
3 3
4 define <4 x float> @test(float %a) nounwind { 4 define <4 x float> @test(float %a) {
5 %tmp = insertelement <4 x float> zeroinitializer, float %a, i32 1 ; <<4 x float>> [#uses=1] 5 ; CHECK-LABEL: test:
6 %tmp5 = insertelement <4 x float> %tmp, float 0.000000e+00, i32 2 ; <<4 x float>> [#uses=1] 6 ; CHECK: movss {{.*}}, %xmm0
7 %tmp6 = insertelement <4 x float> %tmp5, float 0.000000e+00, i32 3 ; <<4 x float>> [#uses=1] 7 ; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,0,1,1]
8 ret <4 x float> %tmp6 8 ; CHECK-NEXT: retl
9 ;
10 ; CHECK-EXP-LABEL: test:
11 ; CHECK-EXP: insertps $29, {{.*}}, %xmm0
12 ; CHECK-EXP-NEXT: retl
13
14 entry:
15 %tmp = insertelement <4 x float> zeroinitializer, float %a, i32 1
16 %tmp5 = insertelement <4 x float> %tmp, float 0.000000e+00, i32 2
17 %tmp6 = insertelement <4 x float> %tmp5, float 0.000000e+00, i32 3
18 ret <4 x float> %tmp6
9 } 19 }
10 20
11 define <2 x i64> @test2(i32 %a) nounwind { 21 define <2 x i64> @test2(i32 %a) {
12 %tmp7 = insertelement <4 x i32> zeroinitializer, i32 %a, i32 2 ; <<4 x i32>> [#uses=1] 22 ; CHECK-LABEL: test2:
13 %tmp9 = insertelement <4 x i32> %tmp7, i32 0, i32 3 ; <<4 x i32>> [#uses=1] 23 ; CHECK: movd {{.*}}, %xmm0
14 %tmp10 = bitcast <4 x i32> %tmp9 to <2 x i64> ; <<2 x i64>> [#uses=1] 24 ; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,0,1]
15 ret <2 x i64> %tmp10 25 ; CHECK-NEXT: retl
26 ;
27 ; CHECK-EXP-LABEL: test2:
28 ; CHECK-EXP: movd {{.*}}, %xmm0
29 ; CHECK-EXP-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,0,1]
30 ; CHECK-EXP-NEXT: retl
31
32 entry:
33 %tmp7 = insertelement <4 x i32> zeroinitializer, i32 %a, i32 2
34 %tmp9 = insertelement <4 x i32> %tmp7, i32 0, i32 3
35 %tmp10 = bitcast <4 x i32> %tmp9 to <2 x i64>
36 ret <2 x i64> %tmp10
16 } 37 }
17 38
39 define <4 x float> @test3(<4 x float> %A) {
40 ; CHECK-LABEL: test3:
41 ; CHECK: xorps %[[X1:xmm[0-9]+]], %[[X1]]
42 ; CHECK-NEXT: movss %xmm0, %[[X1]]
43 ; CHECK-NEXT: pshufd {{.*#+}} xmm0 = [[X1]][1,0,1,1]
44 ; CHECK-NEXT: retl
45 ;
46 ; CHECK-EXP-LABEL: test3:
47 ; CHECK-EXP: insertps {{.*#+}} xmm0 = zero,xmm0[0],zero,zero
48 ; CHECK-EXP-NEXT: retl
49
50 %tmp0 = extractelement <4 x float> %A, i32 0
51 %tmp1 = insertelement <4 x float> <float 0.000000e+00, float undef, float undef, float undef >, float %tmp0, i32 1
52 %tmp2 = insertelement <4 x float> %tmp1, float 0.000000e+00, i32 2
53 ret <4 x float> %tmp2
54 }