Skip to content
Snippets Groups Projects
  • Alan Modra's avatar
    0c115f84
    ubsan: m32c: left shift of negative value · 0c115f84
    Alan Modra authored
    More nonsense fixing "bugs" with left shifts of signed values.  Yes,
    the C standard does say this is undefined (and right shifts of signed
    values are implementation defined BTW) but in practice there is no
    problem with current machines.  1's complement is a thing of the past.
    
    cpu/
    	* m32c.cpu (f-src32-rn-unprefixed-QI): Shift before inverting.
    	(f-src32-rn-prefixed-QI, f-dst32-rn-unprefixed-QI): Likewise.
    	(f-dst32-rn-prefixed-QI): Likewise.
    	(f-dsp-32-s32): Mask before shifting left.
    	(f-dsp-48-u32, f-dsp-48-s32): Likewise.
    	(f-bitbase32-16-s11-unprefixed): Multiply signed field rather than
    	shifting left.
    	(f-bitbase32-24-s11-prefixed, f-bitbase32-24-s19-prefixed): Likewise.
    	(h-gr-SI): Mask before shifting.
    opcodes/
    	* m32c-ibld.c: Regenerate.
    0c115f84
    History
    ubsan: m32c: left shift of negative value
    Alan Modra authored
    More nonsense fixing "bugs" with left shifts of signed values.  Yes,
    the C standard does say this is undefined (and right shifts of signed
    values are implementation defined BTW) but in practice there is no
    problem with current machines.  1's complement is a thing of the past.
    
    cpu/
    	* m32c.cpu (f-src32-rn-unprefixed-QI): Shift before inverting.
    	(f-src32-rn-prefixed-QI, f-dst32-rn-unprefixed-QI): Likewise.
    	(f-dst32-rn-prefixed-QI): Likewise.
    	(f-dsp-32-s32): Mask before shifting left.
    	(f-dsp-48-u32, f-dsp-48-s32): Likewise.
    	(f-bitbase32-16-s11-unprefixed): Multiply signed field rather than
    	shifting left.
    	(f-bitbase32-24-s11-prefixed, f-bitbase32-24-s19-prefixed): Likewise.
    	(h-gr-SI): Mask before shifting.
    opcodes/
    	* m32c-ibld.c: Regenerate.
To find the state of this project's repository at the time of any of these versions, check out the tags.