xref: /llvm-project/llvm/test/CodeGen/ARM/trunc_ldr.ll (revision bed1c7f061aa12417aa081e334afdba45767b938)
1; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s
2
3	%struct.A = type { i8, i8, i8, i8, i16, i8, i8, ptr }
4	%struct.B = type { float, float, i32, i32, i32, [0 x i8] }
5
6define i8 @f1(ptr %d) {
7	%tmp2 = getelementptr %struct.A, ptr %d, i32 0, i32 4
8	%tmp4 = load i32, ptr %tmp2
9	%tmp512 = lshr i32 %tmp4, 24
10	%tmp56 = trunc i32 %tmp512 to i8
11	ret i8 %tmp56
12}
13
14define i32 @f2(ptr %d) {
15	%tmp2 = getelementptr %struct.A, ptr %d, i32 0, i32 4
16	%tmp4 = load i32, ptr %tmp2
17	%tmp512 = lshr i32 %tmp4, 24
18	%tmp56 = trunc i32 %tmp512 to i8
19        %tmp57 = sext i8 %tmp56 to i32
20	ret i32 %tmp57
21}
22
23; CHECK: ldrb{{.*}}7
24; CHECK-NOT: ldrb{{.*}}7
25
26; CHECK: ldrsb{{.*}}7
27; CHECK-NOT: ldrsb{{.*}}7
28
29