1;RUN: llc --march=cellspu %s -o - | FileCheck %s
2%vec = type <2 x i32>
3
4define %vec @test_ret(%vec %param)
5{
6;CHECK:	bi	$lr
7  ret %vec %param
8}
9
10define %vec @test_add(%vec %param)
11{
12;CHECK: a {{\$.}}, $3, $3
13  %1 = add %vec %param, %param
14;CHECK: bi $lr
15  ret %vec %1
16}
17
18define %vec @test_sub(%vec %param)
19{
20;CHECK: sf {{\$.}}, $4, $3
21  %1 = sub %vec %param, <i32 1, i32 1>
22
23;CHECK: bi $lr
24  ret %vec %1
25}
26
27define %vec @test_mul(%vec %param)
28{
29;CHECK: mpyu
30;CHECK: mpyh
31;CHECK: a {{\$., \$., \$.}}
32;CHECK: a {{\$., \$., \$.}}
33  %1 = mul %vec %param, %param
34
35;CHECK: bi $lr
36  ret %vec %1
37}
38
39define <2 x i32> @test_splat(i32 %param ) {
40;see svn log for why this is here...
41;CHECK-NOT: or $3, $3, $3
42;CHECK: lqa
43;CHECK: shufb
44  %sv = insertelement <1 x i32> undef, i32 %param, i32 0
45  %rv = shufflevector <1 x i32> %sv, <1 x i32> undef, <2 x i32> zeroinitializer
46;CHECK: bi $lr
47  ret <2 x i32> %rv
48}
49
50define i32 @test_extract() {
51;CHECK: shufb $3
52  %rv = extractelement <2 x i32> zeroinitializer, i32 undef ; <i32> [#uses=1]
53;CHECK: bi $lr
54  ret i32 %rv
55}
56
57define void @test_store( %vec %val, %vec* %ptr)
58{
59;CHECK: stqd $3, 0(${{.}})
60;CHECK: bi $lr
61  store %vec %val, %vec* %ptr
62  ret void
63}
64
65;Alignment of <2 x i32> is not *directly* defined in the ABI
66;It probably is safe to interpret it as an array, thus having 8 byte
67;alignment (according to ABI). This tests that the size of
68;[2 x <2 x i32>] is 16 bytes, i.e. there is no padding between the
69;two arrays
70define <2 x i32>* @test_alignment( [2 x <2 x i32>]* %ptr)
71{
72; CHECK-NOT:	ai	$3, $3, 16
73; CHECK:	ai	$3, $3, 8
74; CHECK:	bi	$lr
75   %rv = getelementptr [2 x <2 x i32>]* %ptr, i32 0, i32 1
76   ret <2 x i32>* %rv
77}
78