1 ; RUN: llc -aarch64-use-tbi -mtriple=arm64-apple-ios8.0.0 < %s \
2 ; RUN: | FileCheck --check-prefix=TBI --check-prefix=BOTH %s
3 ; RUN: llc -aarch64-use-tbi -mtriple=arm64-apple-ios7.1.0 < %s \
4 ; RUN: | FileCheck --check-prefix=NO_TBI --check-prefix=BOTH %s
9 define i32 @ld_and32(i64 %p) {
10 %and = and i64 %p, 72057594037927935
11 %cast = inttoptr i64 %and to ptr
12 %load = load i32, ptr %cast
17 ; BOTH-LABEL:ld_and_plus_offset:
20 define i32 @ld_and_plus_offset(i64 %p) {
21 %and = and i64 %p, 72057594037927935
22 %cast = inttoptr i64 %and to ptr
23 %gep = getelementptr i32, ptr %cast, i64 4
24 %load = load i32, ptr %gep
28 ; load (r & WIDER_MASK)
29 ; BOTH-LABEL:ld_and32_wider:
32 define i32 @ld_and32_wider(i64 %p) {
33 %and = and i64 %p, 1152921504606846975
34 %cast = inttoptr i64 %and to ptr
35 %load = load i32, ptr %cast
39 ; BOTH-LABEL:ld_and64:
42 define i64 @ld_and64(i64 %p) {
43 %and = and i64 %p, 72057594037927935
44 %cast = inttoptr i64 %and to ptr
45 %load = load i64, ptr %cast
49 ; BOTH-LABEL:st_and32:
52 define void @st_and32(i64 %p, i32 %v) {
53 %and = and i64 %p, 72057594037927935
54 %cast = inttoptr i64 %and to ptr
55 store i32 %v, ptr %cast
59 ; load (x1 + x2) & MASK
63 define i32 @ld_ro(i64 %a, i64 %b) {
65 %and = and i64 %p, 72057594037927935
66 %cast = inttoptr i64 %and to ptr
67 %load = load i32, ptr %cast
71 ; load (r1 & MASK) + r2
75 define i32 @ld_ro2(i64 %a, i64 %b) {
76 %and = and i64 %a, 72057594037927935
78 %cast = inttoptr i64 %p to ptr
79 %load = load i32, ptr %cast
83 ; load (r1 & MASK) | r2
84 ; BOTH-LABEL:ld_indirect_and:
87 define i32 @ld_indirect_and(i64 %r1, i64 %r2) {
88 %and = and i64 %r1, 72057594037927935
90 %cast = inttoptr i64 %p to ptr
91 %load = load i32, ptr %cast
95 ; BOTH-LABEL:ld_and32_narrower:
97 define i32 @ld_and32_narrower(i64 %p) {
98 %and = and i64 %p, 36028797018963967
99 %cast = inttoptr i64 %and to ptr
100 %load = load i32, ptr %cast
104 ; BOTH-LABEL:ld_and8:
106 define i32 @ld_and8(i64 %base, i8 %off) {
107 %off_masked = and i8 %off, 63
108 %off_64 = zext i8 %off_masked to i64
109 %p = add i64 %base, %off_64
110 %cast = inttoptr i64 %p to ptr
111 %load = load i32, ptr %cast