Option to make unsigned->signed conversion always well-defined?

Florian Weimer fw@deneb.enyo.de
Fri Oct 7 23:36:00 GMT 2011


* Ulf Magnusson:

> Good machine code would be fun to see, though I might need to brush up
> on my ARM.

It turns out that ARM doesn't seem to have 8-bit overflow detection,
so something like this has to be used (with the arguments in R1 and
R2, result in the lower bit of R3):


  MOV    R3, R1, LSL #24
  ADDS   R3, R2, R3, LSL #24
  ADDVS  R3, R3, #1

Not sure if this is correct, I don't really know ARM assembly.



More information about the Gcc mailing list