[llvm-bugs] [Bug 49162] New: Wrong code generated for code sequence shl/ashr/trunc/ashr
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Feb 12 09:01:34 PST 2021
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: unassignedbugs at nondot.org
Reporter: carrot at google.com
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, pengfei.wang at intel.com,
spatel+llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210212/3e00680b/attachment.html>
More information about the llvm-bugs
mailing list