Taints upcoming store and adds bogus conditional branches else where. Now as a separa...
[oota-llvm.git] / test / CodeGen / XCore / load.ll
1 ; RUN: llc < %s -march=xcore | FileCheck %s
2
3 define i32 @load32(i32* %p, i32 %offset) nounwind {
4 entry:
5 ; CHECK-LABEL: load32:
6 ; CHECK: ldw r0, r0[r1]
7         %0 = getelementptr i32, i32* %p, i32 %offset
8         %1 = load i32, i32* %0, align 4
9         ret i32 %1
10 }
11
12 define i32 @load32_imm(i32* %p) nounwind {
13 entry:
14 ; CHECK-LABEL: load32_imm:
15 ; CHECK: ldw r0, r0[11]
16         %0 = getelementptr i32, i32* %p, i32 11
17         %1 = load i32, i32* %0, align 4
18         ret i32 %1
19 }
20
21 define i32 @load16(i16* %p, i32 %offset) nounwind {
22 entry:
23 ; CHECK-LABEL: load16:
24 ; CHECK: ld16s r0, r0[r1]
25 ; CHECK-NOT: sext
26         %0 = getelementptr i16, i16* %p, i32 %offset
27         %1 = load i16, i16* %0, align 2
28         %2 = sext i16 %1 to i32
29         ret i32 %2
30 }
31
32 define i32 @load8(i8* %p, i32 %offset) nounwind {
33 entry:
34 ; CHECK-LABEL: load8:
35 ; CHECK: ld8u r0, r0[r1]
36 ; CHECK-NOT: zext
37         %0 = getelementptr i8, i8* %p, i32 %offset
38         %1 = load i8, i8* %0, align 1
39         %2 = zext i8 %1 to i32
40         ret i32 %2
41 }
42
43 @GConst = internal constant i32 42
44 define i32 @load_cp() nounwind {
45 entry:
46 ; CHECK-LABEL: load_cp:
47 ; CHECK: ldw r0, cp[GConst]
48   %0 = load i32, i32* @GConst
49   ret i32 %0
50 }