mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
[X86] Fix pattern match for 32-to-64-bit zext in the presence of AssertSext
This fixes an issue with matching trunc -> assertsext -> zext on x86-64, which would not zero the high 32-bits. See PR20494 for details. Recommitting - This time, with a hopefully working test. Differential Revision: http://reviews.llvm.org/D6128 llvm-svn: 221672
This commit is contained in:
parent
b2da355215
commit
cd941e090d
@ -1191,6 +1191,7 @@ def def32 : PatLeaf<(i32 GR32:$src), [{
|
||||
return N->getOpcode() != ISD::TRUNCATE &&
|
||||
N->getOpcode() != TargetOpcode::EXTRACT_SUBREG &&
|
||||
N->getOpcode() != ISD::CopyFromReg &&
|
||||
N->getOpcode() != ISD::AssertSext &&
|
||||
N->getOpcode() != X86ISD::CMOV;
|
||||
}]>;
|
||||
|
||||
|
16
test/CodeGen/X86/TruncAssertZext.ll
Normal file
16
test/CodeGen/X86/TruncAssertZext.ll
Normal file
@ -0,0 +1,16 @@
|
||||
; RUN: llc < %s -O2 -march=x86-64 | FileCheck %s
|
||||
; Checks that a zeroing mov is inserted for the trunc/zext pair even when
|
||||
; the source of the zext is an AssertSext node
|
||||
; PR20494
|
||||
|
||||
define i64 @main(i64 %a) {
|
||||
; CHECK-LABEL: main
|
||||
; CHECK: movl %e{{..}}, %eax
|
||||
; CHECK: ret
|
||||
%or = or i64 %a, -2
|
||||
%trunc = trunc i64 %or to i32
|
||||
br label %l
|
||||
l:
|
||||
%ext = zext i32 %trunc to i64
|
||||
ret i64 %ext
|
||||
}
|
Loading…
Reference in New Issue
Block a user