1; RUN: llc -O2 < %s -mtriple=aarch64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECKN 2; RUN: llc -O2 < %s -mtriple=aarch64-linux-gnu -mattr=strict-align | FileCheck %s --check-prefixes=CHECK,CHECKS 3 4declare i32 @bcmp(i8*, i8*, i64) nounwind readonly 5declare i32 @memcmp(i8*, i8*, i64) nounwind readonly 6 7define i1 @test_b2(i8* %s1, i8* %s2) { 8entry: 9 %bcmp = call i32 @bcmp(i8* %s1, i8* %s2, i64 15) 10 %ret = icmp eq i32 %bcmp, 0 11 ret i1 %ret 12 13; CHECK-LABEL: test_b2: 14; CHECKN-NOT: bl bcmp 15; CHECKN: ldr x 16; CHECKN-NEXT: ldr x 17; CHECKN-NEXT: ldur x 18; CHECKN-NEXT: ldur x 19; CHECKS: bl bcmp 20} 21 22define i1 @test_b2_align8(i8* align 8 %s1, i8* align 8 %s2) { 23entry: 24 %bcmp = call i32 @bcmp(i8* %s1, i8* %s2, i64 15) 25 %ret = icmp eq i32 %bcmp, 0 26 ret i1 %ret 27 28; CHECK-LABEL: test_b2_align8: 29; CHECKN-NOT: bl bcmp 30; CHECKN: ldr x 31; CHECKN-NEXT: ldr x 32; CHECKN-NEXT: ldur x 33; CHECKN-NEXT: ldur x 34; TODO: Four loads should be within the limit, but the heuristic isn't implemented. 35; CHECKS: bl bcmp 36} 37 38define i1 @test_bs(i8* %s1, i8* %s2) optsize { 39entry: 40 %memcmp = call i32 @memcmp(i8* %s1, i8* %s2, i64 31) 41 %ret = icmp eq i32 %memcmp, 0 42 ret i1 %ret 43 44; CHECK-LABEL: test_bs: 45; CHECKN-NOT: bl memcmp 46; CHECKN: ldp x 47; CHECKN-NEXT: ldp x 48; CHECKN-NEXT: ldr x 49; CHECKN-NEXT: ldr x 50; CHECKN-NEXT: ldur x 51; CHECKN-NEXT: ldur x 52; CHECKS: bl memcmp 53} 54