https://bugs.llvm.org/show_bug.cgi?id=49162
Bug ID: 49162
Summary: Wrong code generated for code sequence
shl/ashr/trunc/ashr
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: car...@google.com
CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
llvm-...@redking.me.uk, pengfei.w...@intel.com,
spatel+l...@rotateright.com
This bug entry is requested by @RKSimon, trunc llvm generates wrong code for
the following test case
define i32* @PRXXXXXX(i32* %base, i160* %ptr160) {
%load160 = load i160, i160* %ptr160, align 4
%shl = shl i160 %load160, 80
%ashr160 = ashr i160 %shl, 112
%trunc = trunc i160 %ashr160 to i64
%ashr64 = ashr i64 %trunc, 32
%gep = getelementptr inbounds i32, i32* %base, i64 %ashr64
ret i32* %gep
}
PRXXXXXX: # @PRXXXXXX
lea rax, [rdi - 4]
ret
Correct result should be
PRXXXXXX: # @PRXXXXXX
mov eax, dword ptr [rsi + 8]
shl eax, 16
cdqe
sar rax, 16
lea rax, [rdi + 4*rax]
ret
It is also demonstrated by https://godbolt.org/z/snajbG.
It is caused by patch
https://reviews.llvm.org/rG69bc0990a9181e6eb86228276d2f59435a7fae67.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs