114 lines · plain
1; RUN: llc -aarch64-use-tbi -mtriple=arm64-apple-ios8.0.0 < %s \2; RUN: | FileCheck --check-prefix=TBI --check-prefix=BOTH %s3; RUN: llc -aarch64-use-tbi -mtriple=arm64-apple-ios7.1.0 < %s \4; RUN: | FileCheck --check-prefix=NO_TBI --check-prefix=BOTH %s5 6; BOTH-LABEL:ld_and32:7; TBI-NOT: and x8; NO_TBI: and x9define i32 @ld_and32(i64 %p) {10 %and = and i64 %p, 7205759403792793511 %cast = inttoptr i64 %and to ptr12 %load = load i32, ptr %cast13 ret i32 %load14}15 16; load (r & MASK) + 417; BOTH-LABEL:ld_and_plus_offset:18; TBI-NOT: and x19; NO_TBI: and x20define i32 @ld_and_plus_offset(i64 %p) {21 %and = and i64 %p, 7205759403792793522 %cast = inttoptr i64 %and to ptr23 %gep = getelementptr i32, ptr %cast, i64 424 %load = load i32, ptr %gep25 ret i32 %load26}27 28; load (r & WIDER_MASK)29; BOTH-LABEL:ld_and32_wider:30; TBI-NOT: and x31; NO_TBI: and x32define i32 @ld_and32_wider(i64 %p) {33 %and = and i64 %p, 115292150460684697534 %cast = inttoptr i64 %and to ptr35 %load = load i32, ptr %cast36 ret i32 %load37}38 39; BOTH-LABEL:ld_and64:40; TBI-NOT: and x41; NO_TBI: and x42define i64 @ld_and64(i64 %p) {43 %and = and i64 %p, 7205759403792793544 %cast = inttoptr i64 %and to ptr45 %load = load i64, ptr %cast46 ret i64 %load47}48 49; BOTH-LABEL:st_and32:50; TBI-NOT: and x51; NO_TBI: and x52define void @st_and32(i64 %p, i32 %v) {53 %and = and i64 %p, 7205759403792793554 %cast = inttoptr i64 %and to ptr55 store i32 %v, ptr %cast56 ret void57}58 59; load (x1 + x2) & MASK60; BOTH-LABEL:ld_ro:61; TBI-NOT: and x62; NO_TBI: and x63define i32 @ld_ro(i64 %a, i64 %b) {64 %p = add i64 %a, %b65 %and = and i64 %p, 7205759403792793566 %cast = inttoptr i64 %and to ptr67 %load = load i32, ptr %cast68 ret i32 %load69}70 71; load (r1 & MASK) + r272; BOTH-LABEL:ld_ro2:73; TBI-NOT: and x74; NO_TBI: and x75define i32 @ld_ro2(i64 %a, i64 %b) {76 %and = and i64 %a, 7205759403792793577 %p = add i64 %and, %b78 %cast = inttoptr i64 %p to ptr79 %load = load i32, ptr %cast80 ret i32 %load81}82 83; load (r1 & MASK) | r284; BOTH-LABEL:ld_indirect_and:85; TBI-NOT: and x86; NO_TBI: and x87define i32 @ld_indirect_and(i64 %r1, i64 %r2) {88 %and = and i64 %r1, 7205759403792793589 %p = or i64 %and, %r290 %cast = inttoptr i64 %p to ptr91 %load = load i32, ptr %cast92 ret i32 %load93}94 95; BOTH-LABEL:ld_and32_narrower:96; BOTH: and x97define i32 @ld_and32_narrower(i64 %p) {98 %and = and i64 %p, 3602879701896396799 %cast = inttoptr i64 %and to ptr100 %load = load i32, ptr %cast101 ret i32 %load102}103 104; BOTH-LABEL:ld_and8:105; BOTH: and x106define i32 @ld_and8(i64 %base, i8 %off) {107 %off_masked = and i8 %off, 63108 %off_64 = zext i8 %off_masked to i64109 %p = add i64 %base, %off_64110 %cast = inttoptr i64 %p to ptr111 %load = load i32, ptr %cast112 ret i32 %load113}114