GNU Binutils with patches for OS216
Revision | 44e4546fa278122fb1ad708cf8d4835a5af0a11c (tree) |
---|---|
Zeit | 2020-02-03 14:29:08 |
Autor | Alan Modra <amodra@gmai...> |
Commiter | Alan Modra |
ubsan: m32c: left shift of negative value
cpu/
* m32c.cpu (f-dsp-64-s16): Mask before shifting signed value.
opcodes/
* m32c-ibld.c: Regenerate.
@@ -1,3 +1,7 @@ | ||
1 | +2020-02-03 Alan Modra <amodra@gmail.com> | |
2 | + | |
3 | + * m32c.cpu (f-dsp-64-s16): Mask before shifting signed value. | |
4 | + | |
1 | 5 | 2020-02-01 Alan Modra <amodra@gmail.com> |
2 | 6 | |
3 | 7 | * frv.cpu (f-u12): Multiply rather than left shift signed values. |
@@ -781,12 +781,12 @@ | ||
781 | 781 | (df f-dsp-64-s16 " 16 bit signed" (all-isas) 64 16 INT |
782 | 782 | ((value pc) (ext INT |
783 | 783 | (trunc HI |
784 | - (or (and (srl value 8) #x00ff) | |
785 | - (and (sll value 8) #xff00))))) ; insert | |
784 | + (or (and (srl value 8) #xff) | |
785 | + (sll (and value #xff) 8))))) ; insert | |
786 | 786 | ((value pc) (ext INT |
787 | 787 | (trunc HI |
788 | - (or (and (srl value 8) #x00ff) | |
789 | - (and (sll value 8) #xff00))))) ; extract | |
788 | + (or (and (srl value 8) #xff) | |
789 | + (sll (and value #xff) 8))))) ; extract | |
790 | 790 | ) |
791 | 791 | |
792 | 792 | ;------------------------------------------------------------- |
@@ -1,3 +1,7 @@ | ||
1 | +2020-02-03 Alan Modra <amodra@gmail.com> | |
2 | + | |
3 | + * m32c-ibld.c: Regenerate. | |
4 | + | |
1 | 5 | 2020-02-01 Alan Modra <amodra@gmail.com> |
2 | 6 | |
3 | 7 | * frv-ibld.c: Regenerate. |
@@ -1401,7 +1401,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd, | ||
1401 | 1401 | case M32C_OPERAND_IMM_64_HI : |
1402 | 1402 | { |
1403 | 1403 | long value = fields->f_dsp_64_s16; |
1404 | - value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))))))); | |
1404 | + value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))))))); | |
1405 | 1405 | errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 64, 0, 16, 32, total_length, buffer); |
1406 | 1406 | } |
1407 | 1407 | break; |
@@ -2561,7 +2561,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd, | ||
2561 | 2561 | { |
2562 | 2562 | long value; |
2563 | 2563 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 64, 0, 16, 32, total_length, pc, & value); |
2564 | - value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))))))); | |
2564 | + value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))))))); | |
2565 | 2565 | fields->f_dsp_64_s16 = value; |
2566 | 2566 | } |
2567 | 2567 | break; |