xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/fast-isel-load-store-verify.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-ios | FileCheck %s --check-prefix=ALL
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=ALL
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; FIXME Add tests for thumbv7, they currently fail MI verification because
5*9880d681SAndroid Build Coastguard Worker;       of a mismatch in register classes in uses.
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; This test verifies that load/store instructions are properly generated,
8*9880d681SAndroid Build Coastguard Worker; and that they pass MI verification (wasn't the case until 2013-06-08).
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker@a = global i8 1, align 1
11*9880d681SAndroid Build Coastguard Worker@b = global i16 2, align 2
12*9880d681SAndroid Build Coastguard Worker@c = global i32 4, align 4
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; ldr
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerdefine i8 @t1() nounwind uwtable ssp {
17*9880d681SAndroid Build Coastguard Worker; ALL: @t1
18*9880d681SAndroid Build Coastguard Worker; ALL: ldrb
19*9880d681SAndroid Build Coastguard Worker; ALL: add
20*9880d681SAndroid Build Coastguard Worker  %1 = load i8, i8* @a, align 1
21*9880d681SAndroid Build Coastguard Worker  %2 = add nsw i8 %1, 1
22*9880d681SAndroid Build Coastguard Worker  ret i8 %2
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerdefine i16 @t2() nounwind uwtable ssp {
26*9880d681SAndroid Build Coastguard Worker; ALL: @t2
27*9880d681SAndroid Build Coastguard Worker; ALL: ldrh
28*9880d681SAndroid Build Coastguard Worker; ALL: add
29*9880d681SAndroid Build Coastguard Worker  %1 = load i16, i16* @b, align 2
30*9880d681SAndroid Build Coastguard Worker  %2 = add nsw i16 %1, 1
31*9880d681SAndroid Build Coastguard Worker  ret i16 %2
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdefine i32 @t3() nounwind uwtable ssp {
35*9880d681SAndroid Build Coastguard Worker; ALL: @t3
36*9880d681SAndroid Build Coastguard Worker; ALL: ldr
37*9880d681SAndroid Build Coastguard Worker; ALL: add
38*9880d681SAndroid Build Coastguard Worker  %1 = load i32, i32* @c, align 4
39*9880d681SAndroid Build Coastguard Worker  %2 = add nsw i32 %1, 1
40*9880d681SAndroid Build Coastguard Worker  ret i32 %2
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker; str
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Workerdefine void @t4(i8 %v) nounwind uwtable ssp {
46*9880d681SAndroid Build Coastguard Worker; ALL: @t4
47*9880d681SAndroid Build Coastguard Worker; ALL: add
48*9880d681SAndroid Build Coastguard Worker; ALL: strb
49*9880d681SAndroid Build Coastguard Worker  %1 = add nsw i8 %v, 1
50*9880d681SAndroid Build Coastguard Worker  store i8 %1, i8* @a, align 1
51*9880d681SAndroid Build Coastguard Worker  ret void
52*9880d681SAndroid Build Coastguard Worker}
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerdefine void @t5(i16 %v) nounwind uwtable ssp {
55*9880d681SAndroid Build Coastguard Worker; ALL: @t5
56*9880d681SAndroid Build Coastguard Worker; ALL: add
57*9880d681SAndroid Build Coastguard Worker; ALL: strh
58*9880d681SAndroid Build Coastguard Worker  %1 = add nsw i16 %v, 1
59*9880d681SAndroid Build Coastguard Worker  store i16 %1, i16* @b, align 2
60*9880d681SAndroid Build Coastguard Worker  ret void
61*9880d681SAndroid Build Coastguard Worker}
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Workerdefine void @t6(i32 %v) nounwind uwtable ssp {
64*9880d681SAndroid Build Coastguard Worker; ALL: @t6
65*9880d681SAndroid Build Coastguard Worker; ALL: add
66*9880d681SAndroid Build Coastguard Worker; ALL: str
67*9880d681SAndroid Build Coastguard Worker  %1 = add nsw i32 %v, 1
68*9880d681SAndroid Build Coastguard Worker  store i32 %1, i32* @c, align 4
69*9880d681SAndroid Build Coastguard Worker  ret void
70*9880d681SAndroid Build Coastguard Worker}
71