blob: 260a7f41989940858e2028b6a611d78512364d77 [file] [log] [blame]
Scott Michel9de5d0d2008-01-11 02:53:15 +00001; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
Scott Michel497e8882008-01-11 21:01:19 +00002; RUN: llvm-as -o - %s | llc -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
Chris Lattner994d6cf2008-01-18 19:53:43 +00006; RUN: grep cbd %t1.s | count 3
7; RUN: grep chd %t1.s | count 1
8; RUN: grep cwd %t1.s | count 3
9; RUN: grep shufb %t1.s | count 7
Scott Michel053c1da2008-01-29 02:16:57 +000010; RUN: grep stqd %t1.s | count 7
11; RUN: grep iohl %t2.s | count 16
12; RUN: grep ilhu %t2.s | count 16
13; RUN: grep lqd %t2.s | count 16
14; RUN: grep rotqbyi %t2.s | count 7
Scott Michel053c1da2008-01-29 02:16:57 +000015; RUN: grep cbd %t2.s | count 3
16; RUN: grep chd %t2.s | count 1
17; RUN: grep cwd %t2.s | count 3
Chris Lattner994d6cf2008-01-18 19:53:43 +000018; RUN: grep shufb %t2.s | count 7
Scott Michel053c1da2008-01-29 02:16:57 +000019; RUN: grep stqd %t2.s | count 7
Scott Michel497e8882008-01-11 21:01:19 +000020
Scott Michel9de5d0d2008-01-11 02:53:15 +000021; ModuleID = 'struct_1.bc'
22target 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"
23target triple = "spu"
24
25; struct hackstate {
26; unsigned char c1; // offset 0 (rotate left by 13 bytes to byte 3)
27; unsigned char c2; // offset 1 (rotate left by 14 bytes to byte 3)
28; unsigned char c3; // offset 2 (rotate left by 15 bytes to byte 3)
29; int i1; // offset 4 (rotate left by 4 bytes to byte 0)
30; short s1; // offset 8 (rotate left by 6 bytes to byte 2)
31; int i2; // offset 12 [ignored]
32; unsigned char c4; // offset 16 [ignored]
33; unsigned char c5; // offset 17 [ignored]
Scott Michelf0569be2008-12-27 04:51:36 +000034; unsigned char c6; // offset 18 (rotate left by 14 bytes to byte 3)
Scott Michel9de5d0d2008-01-11 02:53:15 +000035; unsigned char c7; // offset 19 (no rotate, in preferred slot)
36; int i3; // offset 20 [ignored]
37; int i4; // offset 24 [ignored]
38; int i5; // offset 28 [ignored]
39; int i6; // offset 32 (no rotate, in preferred slot)
40; }
41%struct.hackstate = type { i8, i8, i8, i32, i16, i32, i8, i8, i8, i8, i32, i32, i32, i32 }
42
43; struct hackstate state = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
44@state = global %struct.hackstate zeroinitializer, align 16
45
Scott Michel053c1da2008-01-29 02:16:57 +000046define i8 @get_hackstate_c1() zeroext nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000047entry:
Scott Michel53dec472008-03-05 23:00:19 +000048 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 0), align 16
49 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000050}
51
Scott Michel053c1da2008-01-29 02:16:57 +000052define i8 @get_hackstate_c2() zeroext nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000053entry:
Scott Michel53dec472008-03-05 23:00:19 +000054 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 1), align 16
55 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000056}
57
Scott Michel053c1da2008-01-29 02:16:57 +000058define i8 @get_hackstate_c3() zeroext nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000059entry:
Scott Michel53dec472008-03-05 23:00:19 +000060 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 2), align 16
61 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000062}
63
Scott Michel053c1da2008-01-29 02:16:57 +000064define i32 @get_hackstate_i1() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000065entry:
Scott Michel53dec472008-03-05 23:00:19 +000066 %tmp2 = load i32* getelementptr (%struct.hackstate* @state, i32 0, i32 3), align 16
67 ret i32 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000068}
69
Scott Michel053c1da2008-01-29 02:16:57 +000070define i16 @get_hackstate_s1() signext nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000071entry:
Scott Michel53dec472008-03-05 23:00:19 +000072 %tmp2 = load i16* getelementptr (%struct.hackstate* @state, i32 0, i32 4), align 16
73 ret i16 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000074}
75
Scott Michel053c1da2008-01-29 02:16:57 +000076define i8 @get_hackstate_c6() zeroext nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000077entry:
Scott Michel53dec472008-03-05 23:00:19 +000078 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 8), align 16
79 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000080}
81
Scott Michel053c1da2008-01-29 02:16:57 +000082define i8 @get_hackstate_c7() zeroext nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000083entry:
Scott Michel53dec472008-03-05 23:00:19 +000084 %tmp2 = load i8* getelementptr (%struct.hackstate* @state, i32 0, i32 9), align 16
85 ret i8 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000086}
87
Scott Michel053c1da2008-01-29 02:16:57 +000088define i32 @get_hackstate_i3() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000089entry:
Scott Michel53dec472008-03-05 23:00:19 +000090 %tmp2 = load i32* getelementptr (%struct.hackstate* @state, i32 0, i32 10), align 16
91 ret i32 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000092}
93
Scott Michel053c1da2008-01-29 02:16:57 +000094define i32 @get_hackstate_i6() nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +000095entry:
Scott Michel53dec472008-03-05 23:00:19 +000096 %tmp2 = load i32* getelementptr (%struct.hackstate* @state, i32 0, i32 13), align 16
97 ret i32 %tmp2
Scott Michel9de5d0d2008-01-11 02:53:15 +000098}
99
Scott Michel053c1da2008-01-29 02:16:57 +0000100define void @set_hackstate_c1(i8 zeroext %c) nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +0000101entry:
Scott Michel53dec472008-03-05 23:00:19 +0000102 store i8 %c, i8* getelementptr (%struct.hackstate* @state, i32 0, i32 0), align 16
103 ret void
Scott Michel9de5d0d2008-01-11 02:53:15 +0000104}
105
Scott Michel053c1da2008-01-29 02:16:57 +0000106define void @set_hackstate_c2(i8 zeroext %c) nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +0000107entry:
Scott Michel53dec472008-03-05 23:00:19 +0000108 store i8 %c, i8* getelementptr (%struct.hackstate* @state, i32 0, i32 1), align 16
109 ret void
Scott Michel9de5d0d2008-01-11 02:53:15 +0000110}
111
Scott Michel053c1da2008-01-29 02:16:57 +0000112define void @set_hackstate_c3(i8 zeroext %c) nounwind {
Scott Michel9de5d0d2008-01-11 02:53:15 +0000113entry:
Scott Michel53dec472008-03-05 23:00:19 +0000114 store i8 %c, i8* getelementptr (%struct.hackstate* @state, i32 0, i32 2), align 16
115 ret void
Scott Michel9de5d0d2008-01-11 02:53:15 +0000116}
Scott Michel497e8882008-01-11 21:01:19 +0000117
Scott Michel053c1da2008-01-29 02:16:57 +0000118define void @set_hackstate_i1(i32 %i) nounwind {
Scott Michel497e8882008-01-11 21:01:19 +0000119entry:
Scott Michel53dec472008-03-05 23:00:19 +0000120 store i32 %i, i32* getelementptr (%struct.hackstate* @state, i32 0, i32 3), align 16
121 ret void
Scott Michel497e8882008-01-11 21:01:19 +0000122}
123
Scott Michel053c1da2008-01-29 02:16:57 +0000124define void @set_hackstate_s1(i16 signext %s) nounwind {
Scott Michel497e8882008-01-11 21:01:19 +0000125entry:
Scott Michel53dec472008-03-05 23:00:19 +0000126 store i16 %s, i16* getelementptr (%struct.hackstate* @state, i32 0, i32 4), align 16
127 ret void
Scott Michel497e8882008-01-11 21:01:19 +0000128}
129
Scott Michel053c1da2008-01-29 02:16:57 +0000130define void @set_hackstate_i3(i32 %i) nounwind {
131entry:
Scott Michel53dec472008-03-05 23:00:19 +0000132 store i32 %i, i32* getelementptr (%struct.hackstate* @state, i32 0, i32 10), align 16
133 ret void
Scott Michel053c1da2008-01-29 02:16:57 +0000134}
135
136define void @set_hackstate_i6(i32 %i) nounwind {
137entry:
Scott Michel53dec472008-03-05 23:00:19 +0000138 store i32 %i, i32* getelementptr (%struct.hackstate* @state, i32 0, i32 13), align 16
139 ret void
Scott Michel053c1da2008-01-29 02:16:57 +0000140}