blob: 8c3275080c69445b28f22029159828fda80a03ba [file] [log] [blame]
Dan Gohmanb7c0b242009-09-11 18:36:27 +00001; RUN: llc < %s -march=cellspu > %t1.s
2; RUN: llc < %s -march=cellspu -mattr=large_mem > %t2.s
Scott Michel053c1da2008-01-29 02:16:57 +00003; RUN: grep lqa %t1.s | count 5
4; RUN: grep lqd %t1.s | count 11
5; RUN: grep rotqbyi %t1.s | count 7
Evan Cheng3927f432009-03-25 20:20:11 +00006; RUN: grep xshw %t1.s | count 1
7; RUN: grep andi %t1.s | count 5
Chris Lattner994d6cf2008-01-18 19:53:43 +00008; RUN: grep cbd %t1.s | count 3
9; RUN: grep chd %t1.s | count 1
10; RUN: grep cwd %t1.s | count 3
11; RUN: grep shufb %t1.s | count 7
Scott Michel053c1da2008-01-29 02:16:57 +000012; RUN: grep stqd %t1.s | count 7
13; RUN: grep iohl %t2.s | count 16
14; RUN: grep ilhu %t2.s | count 16
15; RUN: grep lqd %t2.s | count 16
16; RUN: grep rotqbyi %t2.s | count 7
Evan Cheng3927f432009-03-25 20:20:11 +000017; RUN: grep xshw %t2.s | count 1
18; RUN: grep andi %t2.s | count 5
Scott Michel053c1da2008-01-29 02:16:57 +000019; RUN: grep cbd %t2.s | count 3
20; RUN: grep chd %t2.s | count 1
21; RUN: grep cwd %t2.s | count 3
Chris Lattner994d6cf2008-01-18 19:53:43 +000022; RUN: grep shufb %t2.s | count 7
Scott Michel053c1da2008-01-29 02:16:57 +000023; RUN: grep stqd %t2.s | count 7
Scott Michel497e8882008-01-11 21:01:19 +000024
Dan Gohman65fd6562011-11-03 21:49:52 +000025; CellSPU legalization is over-sensitive to Legalize's traversal order.
26; XFAIL: *
27
Scott Michel9de5d0d2008-01-11 02:53:15 +000028; ModuleID = 'struct_1.bc'
29target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128"
30target triple = "spu"
31
32; struct hackstate {
33; unsigned char c1; // offset 0 (rotate left by 13 bytes to byte 3)
34; unsigned char c2; // offset 1 (rotate left by 14 bytes to byte 3)
35; unsigned char c3; // offset 2 (rotate left by 15 bytes to byte 3)
36; int i1; // offset 4 (rotate left by 4 bytes to byte 0)
37; short s1; // offset 8 (rotate left by 6 bytes to byte 2)
38; int i2; // offset 12 [ignored]
39; unsigned char c4; // offset 16 [ignored]
40; unsigned char c5; // offset 17 [ignored]
Scott Michelf0569be2008-12-27 04:51:36 +000041; unsigned char c6; // offset 18 (rotate left by 14 bytes to byte 3)
Scott Michel9de5d0d2008-01-11 02:53:15 +000042; unsigned char c7; // offset 19 (no rotate, in preferred slot)
43; int i3; // offset 20 [ignored]
44; int i4; // offset 24 [ignored]
45; int i5; // offset 28 [ignored]
46; int i6; // offset 32 (no rotate, in preferred slot)
47; }
48%struct.hackstate = type { i8, i8, i8, i32, i16, i32, i8, i8, i8, i8, i32, i32, i32, i32 }
49
50; struct hackstate state = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
51@state = global %struct.hackstate zeroinitializer, align 16
52
Chris Lattner26b00002011-06-17 03:14:27 +000053define zeroext i8 @get_hackstate_c1() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000054entry:
Scott Michel53dec472008-03-05 23:00:19 +000055 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 0), align 16
56 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000057}
58
Chris Lattner26b00002011-06-17 03:14:27 +000059define zeroext i8 @get_hackstate_c2() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000060entry:
Scott Michel53dec472008-03-05 23:00:19 +000061 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 1), align 16
62 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000063}
64
Chris Lattner26b00002011-06-17 03:14:27 +000065define zeroext i8 @get_hackstate_c3() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000066entry:
Scott Michel53dec472008-03-05 23:00:19 +000067 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 2), align 16
68 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000069}
70
Scott Michel053c1da2008-01-29 02:16:57 +000071define i32 @get_hackstate_i1() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000072entry:
Scott Michel53dec472008-03-05 23:00:19 +000073 %tmp2 = load i32* getelementptr (%struct.hackstate* @state, i32 0, i32 3), align 16
74 ret i32 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000075}
76
Chris Lattner26b00002011-06-17 03:14:27 +000077define signext i16 @get_hackstate_s1() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000078entry:
Scott Michel53dec472008-03-05 23:00:19 +000079 %tmp2 = load i16* getelementptr (%struct.hackstate* @state, i32 0, i32 4), align 16
80 ret i16 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000081}
82
Chris Lattner26b00002011-06-17 03:14:27 +000083define zeroext i8 @get_hackstate_c6() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000084entry:
Scott Michel53dec472008-03-05 23:00:19 +000085 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 8), align 16
86 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000087}
88
Chris Lattner26b00002011-06-17 03:14:27 +000089define zeroext i8 @get_hackstate_c7() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000090entry:
Scott Michel53dec472008-03-05 23:00:19 +000091 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 9), align 16
92 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000093}
94
Scott Michel053c1da2008-01-29 02:16:57 +000095define i32 @get_hackstate_i3() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000096entry:
Scott Michel53dec472008-03-05 23:00:19 +000097 %tmp2 = load i32* getelementptr (%struct.hackstate* @state, i32 0, i32 10), align 16
98 ret i32 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000099}
100
Scott Michel053c1da2008-01-29 02:16:57 +0000101define i32 @get_hackstate_i6() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +0000102entry:
Scott Michel53dec472008-03-05 23:00:19 +0000103 %tmp2 = load i32* getelementptr (%struct.hackstate* @state, i32 0, i32 13), align 16
104 ret i32 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +0000105}
106
Scott Michel053c1da2008-01-29 02:16:57 +0000107define void @set_hackstate_c1(i8 zeroext %c) nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +0000108entry:
Scott Michel53dec472008-03-05 23:00:19 +0000109 store i8 %c, i8* getelementptr (%struct.hackstate* @state, i32 0, i32 0), align 16
110 ret void
Scott Michel9de5d0d2008-01-11 02:53:15 +0000111}
112
Scott Michel053c1da2008-01-29 02:16:57 +0000113define void @set_hackstate_c2(i8 zeroext %c) nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +0000114entry:
Scott Michel53dec472008-03-05 23:00:19 +0000115 store i8 %c, i8* getelementptr (%struct.hackstate* @state, i32 0, i32 1), align 16
116 ret void
Scott Michel9de5d0d2008-01-11 02:53:15 +0000117}
118
Scott Michel053c1da2008-01-29 02:16:57 +0000119define void @set_hackstate_c3(i8 zeroext %c) nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +0000120entry:
Scott Michel53dec472008-03-05 23:00:19 +0000121 store i8 %c, i8* getelementptr (%struct.hackstate* @state, i32 0, i32 2), align 16
122 ret void
Scott Michel9de5d0d2008-01-11 02:53:15 +0000123}
Scott Michel497e8882008-01-11 21:01:19 +0000124
Scott Michel053c1da2008-01-29 02:16:57 +0000125define void @set_hackstate_i1(i32 %i) nounwind {
Scott Michel497e8882008-01-11 21:01:19 +0000126entry:
Scott Michel53dec472008-03-05 23:00:19 +0000127 store i32 %i, i32* getelementptr (%struct.hackstate* @state, i32 0, i32 3), align 16
128 ret void
Scott Michel497e8882008-01-11 21:01:19 +0000129}
130
Scott Michel053c1da2008-01-29 02:16:57 +0000131define void @set_hackstate_s1(i16 signext %s) nounwind {
Scott Michel497e8882008-01-11 21:01:19 +0000132entry:
Scott Michel53dec472008-03-05 23:00:19 +0000133 store i16 %s, i16* getelementptr (%struct.hackstate* @state, i32 0, i32 4), align 16
134 ret void
Scott Michel497e8882008-01-11 21:01:19 +0000135}
136
Scott Michel053c1da2008-01-29 02:16:57 +0000137define void @set_hackstate_i3(i32 %i) nounwind {
138entry:
Scott Michel53dec472008-03-05 23:00:19 +0000139 store i32 %i, i32* getelementptr (%struct.hackstate* @state, i32 0, i32 10), align 16
140 ret void
Scott Michel053c1da2008-01-29 02:16:57 +0000141}
142
143define void @set_hackstate_i6(i32 %i) nounwind {
144entry:
Scott Michel53dec472008-03-05 23:00:19 +0000145 store i32 %i, i32* getelementptr (%struct.hackstate* @state, i32 0, i32 13), align 16
146 ret void
Scott Michel053c1da2008-01-29 02:16:57 +0000147}