fold: Make sure 32-bit constants get sign extended when necessary

This commit is contained in:
Michael Forney 2019-04-27 12:22:57 -07:00 committed by Quentin Carbonneaux
parent e2bc0ad396
commit 0384d73e8d
2 changed files with 28 additions and 3 deletions

25
test/fold1.ssa Normal file
View file

@ -0,0 +1,25 @@
export
function w $f1() {
@start
%x =w sar 2147483648, 31
ret %x
}
export
function w $f2() {
@start
%x =w div 4294967040, 8 # -256 / 8
ret %x
}
export
function w $f3() {
@start
%x =w rem 4294967284, 7 # -12 % 7
ret %x
}
# >>> driver
# extern int f1(), f2(), f3();
# int main() { return !(f1() == -1 && f2() == -32 && f3() == -5); }
# <<<