• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=msp430 | FileCheck %s
2target datalayout = "e-p:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:16:16"
3target triple = "msp430-generic-generic"
4
5define void @am1(i16* %a, i16 %b) nounwind {
6	store i16 %b, i16* %a
7	ret void
8}
9; CHECK-LABEL: am1:
10; CHECK:		mov	r13, 0(r12)
11
12@foo = external global i16
13
14define void @am2(i16 %a) nounwind {
15	store i16 %a, i16* @foo
16	ret void
17}
18; CHECK-LABEL: am2:
19; CHECK:		mov	r12, &foo
20
21@bar = external global [2 x i8]
22
23define void @am3(i16 %i, i8 %a) nounwind {
24	%1 = getelementptr [2 x i8], [2 x i8]* @bar, i16 0, i16 %i
25	store i8 %a, i8* %1
26	ret void
27}
28; CHECK-LABEL: am3:
29; CHECK:		mov.b	r13, bar(r12)
30
31define void @am4(i16 %a) nounwind {
32	store volatile i16 %a, i16* inttoptr(i16 32 to i16*)
33	ret void
34}
35; CHECK-LABEL: am4:
36; CHECK:		mov	r12, &32
37
38define void @am5(i16* nocapture %p, i16 %a) nounwind readonly {
39	%1 = getelementptr inbounds i16, i16* %p, i16 2
40	store i16 %a, i16* %1
41	ret void
42}
43; CHECK-LABEL: am5:
44; CHECK:		mov	r13, 4(r12)
45
46%S = type { i16, i16 }
47@baz = common global %S zeroinitializer, align 1
48
49define void @am6(i16 %a) nounwind {
50	store i16 %a, i16* getelementptr (%S, %S* @baz, i32 0, i32 1)
51	ret void
52}
53; CHECK-LABEL: am6:
54; CHECK:		mov	r12, &baz+2
55
56%T = type { i16, [2 x i8] }
57@duh = external global %T
58
59define void @am7(i16 %n, i8 %a) nounwind {
60	%1 = getelementptr %T, %T* @duh, i32 0, i32 1
61	%2 = getelementptr [2 x i8], [2 x i8]* %1, i16 0, i16 %n
62	store i8 %a, i8* %2
63	ret void
64}
65; CHECK-LABEL: am7:
66; CHECK:		mov.b	r13, duh+2(r12)
67
68