[llvm-bugs] [Bug 51677] New: llvm.smul.fix.sat.i8(-128, -128, 0) equals -128
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Aug 30 09:09:47 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51677
Bug ID: 51677
Summary: llvm.smul.fix.sat.i8(-128, -128, 0) equals -128
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: twostepted at gmail.com
CC: llvm-bugs at lists.llvm.org
The result of this operation should be 127.
This was confirmed in irc
> <LebedevRI> for scale=0, i would still say this is a bug
$ cat test.ll
; test.ll - smul.fix.sat i8min * i8min should == i8max
define i8 @main() {
entry:
%res = call i8 @llvm.smul.fix.sat.i8(i8 -128, i8 -128, i32 0)
%x = sub i8 %res, 127
ret i8 %x
}
declare i8 @llvm.smul.fix.sat.i8(i8, i8, i32)
$ lli-12 test.ll
$ echo $?
1
$ cat test2.ll
; test2.ll - smul.fix.sat i8max * i8max should == i8max
define i8 @main() {
entry:
%res = call i8 @llvm.smul.fix.sat.i8(i8 127, i8 127, i32 0)
%x = sub i8 %res, 127
ret i8 %x
}
declare i8 @llvm.smul.fix.sat.i8(i8, i8, i32)
$ lli-12 test2.ll
$ echo $?
1
So it seems like there is a signedness error when dealing with signed type
maximums and minimums. I observed the same using i128. This doesn't seem to
happend with the unsigned umul.fix.sat intrinsics.
The same results were observed using trunk.
Not sure i've chosen the correct component 'Common Code Generator Code' in the
drop-down above.
--
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/20210830/99bf187f/attachment-0001.html>
More information about the llvm-bugs
mailing list