xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/fast-isel-fold.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-apple-darwin | FileCheck %s --check-prefix=ARM
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi | FileCheck %s --check-prefix=ARM
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-darwin | FileCheck %s --check-prefix=THUMB
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker@a = global i8 1, align 1
6*9880d681SAndroid Build Coastguard Worker@b = global i16 2, align 2
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine void @t1() nounwind uwtable ssp {
9*9880d681SAndroid Build Coastguard Worker; ARM: t1
10*9880d681SAndroid Build Coastguard Worker; ARM: ldrb
11*9880d681SAndroid Build Coastguard Worker; ARM-NOT: uxtb
12*9880d681SAndroid Build Coastguard Worker; ARM-NOT: and{{.*}}, #255
13*9880d681SAndroid Build Coastguard Worker; THUMB: t1
14*9880d681SAndroid Build Coastguard Worker; THUMB: ldrb
15*9880d681SAndroid Build Coastguard Worker; THUMB-NOT: uxtb
16*9880d681SAndroid Build Coastguard Worker; THUMB-NOT: and{{.*}}, #255
17*9880d681SAndroid Build Coastguard Worker  %1 = load i8, i8* @a, align 1
18*9880d681SAndroid Build Coastguard Worker  call void @foo1(i8 zeroext %1)
19*9880d681SAndroid Build Coastguard Worker  ret void
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Workerdefine void @t2() nounwind uwtable ssp {
23*9880d681SAndroid Build Coastguard Worker; ARM: t2
24*9880d681SAndroid Build Coastguard Worker; ARM: ldrh
25*9880d681SAndroid Build Coastguard Worker; ARM-NOT: uxth
26*9880d681SAndroid Build Coastguard Worker; THUMB: t2
27*9880d681SAndroid Build Coastguard Worker; THUMB: ldrh
28*9880d681SAndroid Build Coastguard Worker; THUMB-NOT: uxth
29*9880d681SAndroid Build Coastguard Worker  %1 = load i16, i16* @b, align 2
30*9880d681SAndroid Build Coastguard Worker  call void @foo2(i16 zeroext %1)
31*9880d681SAndroid Build Coastguard Worker  ret void
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdeclare void @foo1(i8 zeroext)
35*9880d681SAndroid Build Coastguard Workerdeclare void @foo2(i16 zeroext)
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerdefine i32 @t3() nounwind uwtable ssp {
38*9880d681SAndroid Build Coastguard Worker; ARM: t3
39*9880d681SAndroid Build Coastguard Worker; ARM: ldrb
40*9880d681SAndroid Build Coastguard Worker; ARM-NOT: uxtb
41*9880d681SAndroid Build Coastguard Worker; ARM-NOT: and{{.*}}, #255
42*9880d681SAndroid Build Coastguard Worker; THUMB: t3
43*9880d681SAndroid Build Coastguard Worker; THUMB: ldrb
44*9880d681SAndroid Build Coastguard Worker; THUMB-NOT: uxtb
45*9880d681SAndroid Build Coastguard Worker; THUMB-NOT: and{{.*}}, #255
46*9880d681SAndroid Build Coastguard Worker  %1 = load i8, i8* @a, align 1
47*9880d681SAndroid Build Coastguard Worker  %2 = zext i8 %1 to i32
48*9880d681SAndroid Build Coastguard Worker  ret i32 %2
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerdefine i32 @t4() nounwind uwtable ssp {
52*9880d681SAndroid Build Coastguard Worker; ARM: t4
53*9880d681SAndroid Build Coastguard Worker; ARM: ldrh
54*9880d681SAndroid Build Coastguard Worker; ARM-NOT: uxth
55*9880d681SAndroid Build Coastguard Worker; THUMB: t4
56*9880d681SAndroid Build Coastguard Worker; THUMB: ldrh
57*9880d681SAndroid Build Coastguard Worker; THUMB-NOT: uxth
58*9880d681SAndroid Build Coastguard Worker  %1 = load i16, i16* @b, align 2
59*9880d681SAndroid Build Coastguard Worker  %2 = zext i16 %1 to i32
60*9880d681SAndroid Build Coastguard Worker  ret i32 %2
61*9880d681SAndroid Build Coastguard Worker}
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Workerdefine i32 @t5() nounwind uwtable ssp {
64*9880d681SAndroid Build Coastguard Worker; ARM: t5
65*9880d681SAndroid Build Coastguard Worker; ARM: ldrsh
66*9880d681SAndroid Build Coastguard Worker; ARM-NOT: sxth
67*9880d681SAndroid Build Coastguard Worker; THUMB: t5
68*9880d681SAndroid Build Coastguard Worker; THUMB: ldrsh
69*9880d681SAndroid Build Coastguard Worker; THUMB-NOT: sxth
70*9880d681SAndroid Build Coastguard Worker  %1 = load i16, i16* @b, align 2
71*9880d681SAndroid Build Coastguard Worker  %2 = sext i16 %1 to i32
72*9880d681SAndroid Build Coastguard Worker  ret i32 %2
73*9880d681SAndroid Build Coastguard Worker}
74*9880d681SAndroid Build Coastguard Worker
75*9880d681SAndroid Build Coastguard Workerdefine i32 @t6() nounwind uwtable ssp {
76*9880d681SAndroid Build Coastguard Worker; ARM: t6
77*9880d681SAndroid Build Coastguard Worker; ARM: ldrsb
78*9880d681SAndroid Build Coastguard Worker; ARM-NOT: sxtb
79*9880d681SAndroid Build Coastguard Worker; THUMB: t6
80*9880d681SAndroid Build Coastguard Worker; THUMB: ldrsb
81*9880d681SAndroid Build Coastguard Worker; THUMB-NOT: sxtb
82*9880d681SAndroid Build Coastguard Worker  %1 = load i8, i8* @a, align 2
83*9880d681SAndroid Build Coastguard Worker  %2 = sext i8 %1 to i32
84*9880d681SAndroid Build Coastguard Worker  ret i32 %2
85*9880d681SAndroid Build Coastguard Worker}
86