Patch D56593 by @courbet results in calls to `bcmp()` in some cases, should the target support the it. Unless `TTI::MemCmpExpansionOptions()` is overridden by the target. In a proprietary benchmark we see a performance drop of about 12% on PNG compression before this patch, though it passes all tests. This patch mirrors X86 for AArch64 and initializes `TTI::MemCmpExpansionOptions()` to then expand calls to `bcmp()` when appropriate. No tuning of the parameters was performed, but, at this point, it's enough to recover the performance drop above. This problem also exists on ARM. Once a consensus is reached for AArch64, we can work to fix ARM as well. Authors: - Evandro Menezes (@evandro) <e.menezes@samsung.com> - Brian Rzycki (@brzycki) <b.rzycki@samsung.com> Differential revision: https://reviews.llvm.org/D64805 llvm-svn: 367898
45 lines
1.1 KiB
LLVM
45 lines
1.1 KiB
LLVM
; RUN: llc -O2 < %s -mtriple=aarch64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECKN
|
|
; RUN: llc -O2 < %s -mtriple=aarch64-linux-gnu -mattr=strict-align | FileCheck %s --check-prefixes=CHECK,CHECKS
|
|
|
|
declare i32 @bcmp(i8*, i8*, i64) nounwind readonly
|
|
declare i32 @memcmp(i8*, i8*, i64) nounwind readonly
|
|
|
|
define i1 @bcmp_b2(i8* %s1, i8* %s2) {
|
|
entry:
|
|
%bcmp = call i32 @bcmp(i8* %s1, i8* %s2, i64 15)
|
|
%ret = icmp eq i32 %bcmp, 0
|
|
ret i1 %ret
|
|
|
|
; CHECK-LABEL: bcmp_b2:
|
|
; CHECK-NOT: bl bcmp
|
|
; CHECKN: ldr x
|
|
; CHECKN-NEXT: ldr x
|
|
; CHECKN-NEXT: ldur x
|
|
; CHECKN-NEXT: ldur x
|
|
; CHECKS: ldr x
|
|
; CHECKS-NEXT: ldr x
|
|
; CHECKS-NEXT: ldr w
|
|
; CHECKS-NEXT: ldr w
|
|
; CHECKS-NEXT: ldrh w
|
|
; CHECKS-NEXT: ldrh w
|
|
; CHECKS-NEXT: ldrb w
|
|
; CHECKS-NEXT: ldrb w
|
|
}
|
|
|
|
define i1 @bcmp_bs(i8* %s1, i8* %s2) optsize {
|
|
entry:
|
|
%memcmp = call i32 @memcmp(i8* %s1, i8* %s2, i64 31)
|
|
%ret = icmp eq i32 %memcmp, 0
|
|
ret i1 %ret
|
|
|
|
; CHECK-LABEL: bcmp_bs:
|
|
; CHECKN-NOT: bl memcmp
|
|
; CHECKN: ldp x
|
|
; CHECKN-NEXT: ldp x
|
|
; CHECKN-NEXT: ldr x
|
|
; CHECKN-NEXT: ldr x
|
|
; CHECKN-NEXT: ldur x
|
|
; CHECKN-NEXT: ldur x
|
|
; CHECKS: bl memcmp
|
|
}
|