• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
2
3define i64 @_f0(i64* %p) {
4; CHECK: f0:
5; CHECK: ldur x0, [x0, #-8]
6; CHECK-NEXT: ret
7  %tmp = getelementptr inbounds i64, i64* %p, i64 -1
8  %ret = load i64, i64* %tmp, align 2
9  ret i64 %ret
10}
11define i32 @_f1(i32* %p) {
12; CHECK: f1:
13; CHECK: ldur w0, [x0, #-4]
14; CHECK-NEXT: ret
15  %tmp = getelementptr inbounds i32, i32* %p, i64 -1
16  %ret = load i32, i32* %tmp, align 2
17  ret i32 %ret
18}
19define i16 @_f2(i16* %p) {
20; CHECK: f2:
21; CHECK: ldurh w0, [x0, #-2]
22; CHECK-NEXT: ret
23  %tmp = getelementptr inbounds i16, i16* %p, i64 -1
24  %ret = load i16, i16* %tmp, align 2
25  ret i16 %ret
26}
27define i8 @_f3(i8* %p) {
28; CHECK: f3:
29; CHECK: ldurb w0, [x0, #-1]
30; CHECK-NEXT: ret
31  %tmp = getelementptr inbounds i8, i8* %p, i64 -1
32  %ret = load i8, i8* %tmp, align 2
33  ret i8 %ret
34}
35
36define i64 @zext32(i8* %a) nounwind ssp {
37; CHECK-LABEL: zext32:
38; CHECK: ldur w0, [x0, #-12]
39; CHECK-NEXT: ret
40  %p = getelementptr inbounds i8, i8* %a, i64 -12
41  %tmp1 = bitcast i8* %p to i32*
42  %tmp2 = load i32, i32* %tmp1, align 4
43  %ret = zext i32 %tmp2 to i64
44
45  ret i64 %ret
46}
47define i64 @zext16(i8* %a) nounwind ssp {
48; CHECK-LABEL: zext16:
49; CHECK: ldurh w0, [x0, #-12]
50; CHECK-NEXT: ret
51  %p = getelementptr inbounds i8, i8* %a, i64 -12
52  %tmp1 = bitcast i8* %p to i16*
53  %tmp2 = load i16, i16* %tmp1, align 2
54  %ret = zext i16 %tmp2 to i64
55
56  ret i64 %ret
57}
58define i64 @zext8(i8* %a) nounwind ssp {
59; CHECK-LABEL: zext8:
60; CHECK: ldurb w0, [x0, #-12]
61; CHECK-NEXT: ret
62  %p = getelementptr inbounds i8, i8* %a, i64 -12
63  %tmp2 = load i8, i8* %p, align 1
64  %ret = zext i8 %tmp2 to i64
65
66  ret i64 %ret
67}
68