blob: e8ed8cbf34e94a06765d128b8f2418970554401a [file] [log] [blame]
Chad Rosier89831582012-11-17 00:42:06 +00001; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=armv7-apple-darwin | FileCheck %s --check-prefix=ARM
JF Bastien18db1f22013-06-14 02:49:43 +00002; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi | FileCheck %s --check-prefix=ARM
Chad Rosier89831582012-11-17 00:42:06 +00003; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-darwin | FileCheck %s --check-prefix=THUMB
Chad Rosierc8cfd3a2011-11-13 02:23:59 +00004
5@a = global i8 1, align 1
6@b = global i16 2, align 2
7
8define void @t1() nounwind uwtable ssp {
9; ARM: t1
10; ARM: ldrb
11; ARM-NOT: uxtb
JF Bastien06ce03d2013-06-07 20:10:37 +000012; ARM-NOT: and{{.*}}, #255
Chad Rosierc8cfd3a2011-11-13 02:23:59 +000013; THUMB: t1
14; THUMB: ldrb
15; THUMB-NOT: uxtb
JF Bastien06ce03d2013-06-07 20:10:37 +000016; THUMB-NOT: and{{.*}}, #255
Chad Rosierc8cfd3a2011-11-13 02:23:59 +000017 %1 = load i8* @a, align 1
18 call void @foo1(i8 zeroext %1)
19 ret void
20}
21
22define void @t2() nounwind uwtable ssp {
23; ARM: t2
24; ARM: ldrh
25; ARM-NOT: uxth
26; THUMB: t2
27; THUMB: ldrh
28; THUMB-NOT: uxth
29 %1 = load i16* @b, align 2
30 call void @foo2(i16 zeroext %1)
31 ret void
32}
33
34declare void @foo1(i8 zeroext)
35declare void @foo2(i16 zeroext)
36
37define i32 @t3() nounwind uwtable ssp {
38; ARM: t3
39; ARM: ldrb
40; ARM-NOT: uxtb
JF Bastien06ce03d2013-06-07 20:10:37 +000041; ARM-NOT: and{{.*}}, #255
Chad Rosierc8cfd3a2011-11-13 02:23:59 +000042; THUMB: t3
43; THUMB: ldrb
44; THUMB-NOT: uxtb
JF Bastien06ce03d2013-06-07 20:10:37 +000045; THUMB-NOT: and{{.*}}, #255
Chad Rosierc8cfd3a2011-11-13 02:23:59 +000046 %1 = load i8* @a, align 1
47 %2 = zext i8 %1 to i32
48 ret i32 %2
49}
50
51define i32 @t4() nounwind uwtable ssp {
52; ARM: t4
53; ARM: ldrh
54; ARM-NOT: uxth
55; THUMB: t4
56; THUMB: ldrh
57; THUMB-NOT: uxth
58 %1 = load i16* @b, align 2
59 %2 = zext i16 %1 to i32
60 ret i32 %2
61}
62
63define i32 @t5() nounwind uwtable ssp {
64; ARM: t5
65; ARM: ldrsh
66; ARM-NOT: sxth
67; THUMB: t5
68; THUMB: ldrsh
69; THUMB-NOT: sxth
70 %1 = load i16* @b, align 2
71 %2 = sext i16 %1 to i32
72 ret i32 %2
73}
74
75define i32 @t6() nounwind uwtable ssp {
76; ARM: t6
77; ARM: ldrsb
78; ARM-NOT: sxtb
79; THUMB: t6
80; THUMB: ldrsb
81; THUMB-NOT: sxtb
82 %1 = load i8* @a, align 2
83 %2 = sext i8 %1 to i32
84 ret i32 %2
85}