mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[ExpandMemCmp] Trigger on bcmp too.
Summary: Fixes 41150. Reviewers: gchatelet Subscribers: hiraditya, llvm-commits, ckennelly, sbenza, jyknight Tags: #llvm Differential Revision: https://reviews.llvm.org/D59593 llvm-svn: 356550
This commit is contained in:
parent
1e0c591375
commit
39ecd2c585
@ -823,7 +823,8 @@ bool ExpandMemCmpPass::runOnBlock(
|
||||
}
|
||||
LibFunc Func;
|
||||
if (TLI->getLibFunc(ImmutableCallSite(CI), Func) &&
|
||||
Func == LibFunc_memcmp && expandMemCmp(CI, TTI, TL, &DL)) {
|
||||
(Func == LibFunc_memcmp || Func == LibFunc_bcmp) &&
|
||||
expandMemCmp(CI, TTI, TL, &DL)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
@.str = private constant [65 x i8] c"0123456789012345678901234567890123456789012345678901234567890123\00", align 1
|
||||
|
||||
declare i32 @memcmp(i8*, i8*, i64)
|
||||
declare i32 @bcmp(i8*, i8*, i64)
|
||||
|
||||
define i32 @length2(i8* %X, i8* %Y) nounwind optsize {
|
||||
; X86-LABEL: length2:
|
||||
@ -982,3 +983,31 @@ define i1 @length64_eq_const(i8* %X) nounwind optsize {
|
||||
ret i1 %c
|
||||
}
|
||||
|
||||
define i32 @bcmp_length2(i8* %X, i8* %Y) nounwind optsize {
|
||||
; X86-LABEL: bcmp_length2:
|
||||
; X86: # %bb.0:
|
||||
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
|
||||
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
|
||||
; X86-NEXT: movzwl (%ecx), %ecx
|
||||
; X86-NEXT: movzwl (%eax), %edx
|
||||
; X86-NEXT: rolw $8, %cx
|
||||
; X86-NEXT: rolw $8, %dx
|
||||
; X86-NEXT: movzwl %cx, %eax
|
||||
; X86-NEXT: movzwl %dx, %ecx
|
||||
; X86-NEXT: subl %ecx, %eax
|
||||
; X86-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: bcmp_length2:
|
||||
; X64: # %bb.0:
|
||||
; X64-NEXT: movzwl (%rdi), %eax
|
||||
; X64-NEXT: movzwl (%rsi), %ecx
|
||||
; X64-NEXT: rolw $8, %ax
|
||||
; X64-NEXT: rolw $8, %cx
|
||||
; X64-NEXT: movzwl %ax, %eax
|
||||
; X64-NEXT: movzwl %cx, %ecx
|
||||
; X64-NEXT: subl %ecx, %eax
|
||||
; X64-NEXT: retq
|
||||
%m = tail call i32 @bcmp(i8* %X, i8* %Y, i64 2) nounwind
|
||||
ret i32 %m
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user