• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=msp430 < %s | FileCheck %s
2target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"
3target triple = "msp430-generic-generic"
4@foo = common global i16 0, align 2
5@bar = common global i16 0, align 2
6
7define void @mov() nounwind {
8; CHECK-LABEL: mov:
9; CHECK: mov	&bar, &foo
10        %1 = load i16, i16* @bar
11        store i16 %1, i16* @foo
12        ret void
13}
14
15define void @add() nounwind {
16; CHECK-LABEL: add:
17; CHECK: add	&bar, &foo
18	%1 = load i16, i16* @bar
19	%2 = load i16, i16* @foo
20	%3 = add i16 %2, %1
21	store i16 %3, i16* @foo
22	ret void
23}
24
25define void @and() nounwind {
26; CHECK-LABEL: and:
27; CHECK: and	&bar, &foo
28	%1 = load i16, i16* @bar
29	%2 = load i16, i16* @foo
30	%3 = and i16 %2, %1
31	store i16 %3, i16* @foo
32	ret void
33}
34
35define void @bis() nounwind {
36; CHECK-LABEL: bis:
37; CHECK: bis	&bar, &foo
38	%1 = load i16, i16* @bar
39	%2 = load i16, i16* @foo
40	%3 = or i16 %2, %1
41	store i16 %3, i16* @foo
42	ret void
43}
44
45define void @xor() nounwind {
46; CHECK-LABEL: xor:
47; CHECK: xor	&bar, &foo
48	%1 = load i16, i16* @bar
49	%2 = load i16, i16* @foo
50	%3 = xor i16 %2, %1
51	store i16 %3, i16* @foo
52	ret void
53}
54
55define i16 @mov2() nounwind {
56entry:
57 %retval = alloca i16                            ; <i16*> [#uses=3]
58 %x = alloca i32, align 2                        ; <i32*> [#uses=1]
59 %y = alloca i32, align 2                        ; <i32*> [#uses=1]
60 store i16 0, i16* %retval
61 %tmp = load i32, i32* %y                             ; <i32> [#uses=1]
62 store i32 %tmp, i32* %x
63 store i16 0, i16* %retval
64 %0 = load i16, i16* %retval                          ; <i16> [#uses=1]
65 ret i16 %0
66; CHECK-LABEL: mov2:
67; CHECK-DAG:	mov	2(r1), 6(r1)
68; CHECK-DAG:	mov	0(r1), 4(r1)
69}
70
71define void @cmp(i16* %g, i16* %i) {
72entry:
73; CHECK-LABEL: cmp:
74; CHECK: cmp 8(r12), 4(r13)
75  %add.ptr = getelementptr inbounds i16, i16* %g, i16 4
76  %0 = load i16, i16* %add.ptr, align 2
77  %add.ptr1 = getelementptr inbounds i16, i16* %i, i16 2
78  %1 = load i16, i16* %add.ptr1, align 2
79  %cmp = icmp sgt i16 %0, %1
80  br i1 %cmp, label %if.then, label %if.end
81
82if.then:                                          ; preds = %entry
83  store i16 0, i16* %g, align 2
84  br label %if.end
85
86if.end:                                           ; preds = %if.then, %entry
87  ret void
88}
89