1; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s -check-prefix=V5
2; RUN: llc -mtriple=thumb-eabi -mattr=+v6 %s -o - | FileCheck %s -check-prefix=V6
3
4; rdar://7176514
5
6define i32 @test1(i8* %t1) nounwind {
7; V5: ldrb
8
9; V6: ldrb
10    %tmp.u = load i8, i8* %t1
11    %tmp1.s = zext i8 %tmp.u to i32
12    ret i32 %tmp1.s
13}
14
15define i32 @test2(i16* %t1) nounwind {
16; V5: ldrh
17
18; V6: ldrh
19    %tmp.u = load i16, i16* %t1
20    %tmp1.s = zext i16 %tmp.u to i32
21    ret i32 %tmp1.s
22}
23
24define i32 @test3(i8* %t0) nounwind {
25; V5: ldrb
26; V5: lsls
27; V5: asrs
28
29; V6: ldrb
30; V6: sxtb
31    %tmp.s = load i8, i8* %t0
32    %tmp1.s = sext i8 %tmp.s to i32
33    ret i32 %tmp1.s
34}
35
36define i32 @test4(i16* %t0) nounwind {
37; V5: ldrh
38; V5: lsls
39; V5: asrs
40
41; V6: ldrh
42; V6: sxth
43    %tmp.s = load i16, i16* %t0
44    %tmp1.s = sext i16 %tmp.s to i32
45    ret i32 %tmp1.s
46}
47
48define i32 @test5() nounwind {
49; V5: movs r0, #0
50; V5: ldrsh
51
52; V6: movs r0, #0
53; V6: ldrsh
54    %tmp.s = load i16, i16* null
55    %tmp1.s = sext i16 %tmp.s to i32
56    ret i32 %tmp1.s
57}
58