Displaying 1 result from an estimated 1 matches for "idiv8".
Did you mean:
idiv
2012 Jun 27
2
[LLVMdev] 8-bit DIV IR irregularities
Hi,
I noticed that when dividing with signed 8-bit values the IR uses a 32-bit signed divide, however, when unsigned 8-bit values are used the IR uses an 8-bit unsigned divide. Why not use a 8-bit signed divide when using 8-bit signed values?
Here is the C code and IR:
char idiv8(char a, char b)
{
char c = a / b;
return c;
}
define signext i8 @idiv8(i8 signext %a, i8 signext %b) nounwind readnone {
entry:
%conv = sext i8 %a to i32
%conv1 = sext i8 %b to i32
%div = sdiv i32 %conv, %conv1
%conv2 = trunc i32 %div to i8
ret i8 %conv2
}
unsigned char div8(unsigne...