Displaying 2 results from an estimated 2 matches for "22b2f363".
2012 Aug 06
0
[LLVMdev] Casting from float to unsigned char - incorrect output?
>
> I didn't realize the code was undefined, I'll let my professor know; but
> for code comparison purposes we're still seeking advice on producing the
> output that matches the other compilers (even if it involves doing a
> translation on the .ll file or additional translation to the produced
> assembly). We can't fairly compare the code if it doesn't do the
2012 Aug 06
4
[LLVMdev] Casting from float to unsigned char - incorrect output?
I am compiling the following code for the MIPS architecture:
unsigned char trunc(float f) {
return (unsigned char) f;
}
and it produces the following assembly (directives removed for convenience:
trunc:
trunc.w.s $f0, $f12
mfc1 $2, $f0
jr $ra
nop
However, this does not seem to produce the correct output for negative
numbers. When I run the following code, I get