Displaying 3 results from an estimated 3 matches for "overflow_happened".
2008 Mar 26
2
[LLVMdev] Checked arithmetic
Hi Chris,
> > what's the point? We have this today with apint codegen (if you turn on
> > LegalizeTypes). For example, this function
>
> The desired code is something like:
>
> foo:
> addl %eax, %ecx
> jo overflow_happened
> use(%ecx)
how's an intrinsic going to help with this? Also, is there any chance
of codegen being capable one day of combining carry arithmetic coming
from apint and the appropriate conditional branch into a "jo"?
Ciao,
Duncan.
2008 Mar 26
2
[LLVMdev] Checked arithmetic
Hi Chris,
> Why not define an "add with overflow" intrinsic that returns its value and
> overflow bit as an i1?
what's the point? We have this today with apint codegen (if you turn on
LegalizeTypes). For example, this function
define i1 @cc(i32 %x, i32 %y) {
%xx = zext i32 %x to i33
%yy = zext i32 %y to i33
%s = add i33 %xx, %yy
%tmp = lshr i33 %s, 32
%b = trunc
2008 Mar 26
0
[LLVMdev] Checked arithmetic
...;add with overflow" intrinsic that returns its value and
>> overflow bit as an i1?
>
> what's the point? We have this today with apint codegen (if you turn on
> LegalizeTypes). For example, this function
The desired code is something like:
foo:
addl %eax, %ecx
jo overflow_happened
use(%ecx)
etc.
-Chris
> define i1 @cc(i32 %x, i32 %y) {
> %xx = zext i32 %x to i33
> %yy = zext i32 %y to i33
> %s = add i33 %xx, %yy
> %tmp = lshr i33 %s, 32
> %b = trunc i33 %tmp to i1
> ret i1 %b
> }
>
> codegens (on x86-32) to
>
> cc:
>...