aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-01-04 19:53:19 +1030
committerAlan Modra <amodra@gmail.com>2020-01-06 21:53:51 +1030
commitcc6aa1a6e0a8f2b3eda496aef0b3579a8c2b5951 (patch)
tree2e7d6d72669759333e04abf39647fd9a5afee675
parent85d8681747faa317c9934f658dcf8749e945ea8c (diff)
downloadgdb-cc6aa1a6e0a8f2b3eda496aef0b3579a8c2b5951.zip
gdb-cc6aa1a6e0a8f2b3eda496aef0b3579a8c2b5951.tar.gz
gdb-cc6aa1a6e0a8f2b3eda496aef0b3579a8c2b5951.tar.bz2
ubsan: m32c: left shift of negative value
There are probably a lot more of these still here. cpu/ * m32c.cpu (f-dsp-8-u16, f-dsp-8-s16): Rearrange to mask any sign bits before shifting rather than masking after shifting. (f-dsp-16-u16, f-dsp-16-s16, f-dsp-32-u16, f-dsp-32-s16): Likewise. (f-dsp-40-u16, f-dsp-40-s16, f-dsp-48-u16, f-dsp-48-s16): Likewise. (f-dsp-64-u16, f-dsp-8-s24): Likewise. (f-bitbase32-16-s19-unprefixed): Avoid signed left shift. opcodes/ * m32c-ibld.c: Regenerate.
-rw-r--r--cpu/ChangeLog11
-rw-r--r--cpu/m32c.cpu105
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/m32c-ibld.c122
4 files changed, 129 insertions, 113 deletions
diff --git a/cpu/ChangeLog b/cpu/ChangeLog
index 09311d1..a5d0843 100644
--- a/cpu/ChangeLog
+++ b/cpu/ChangeLog
@@ -1,4 +1,13 @@
-2020-02-04 Alan Modra <amodra@gmail.com>
+2020-01-06 Alan Modra <amodra@gmail.com>
+
+ * m32c.cpu (f-dsp-8-u16, f-dsp-8-s16): Rearrange to mask any sign
+ bits before shifting rather than masking after shifting.
+ (f-dsp-16-u16, f-dsp-16-s16, f-dsp-32-u16, f-dsp-32-s16): Likewise.
+ (f-dsp-40-u16, f-dsp-40-s16, f-dsp-48-u16, f-dsp-48-s16): Likewise.
+ (f-dsp-64-u16, f-dsp-8-s24): Likewise.
+ (f-bitbase32-16-s19-unprefixed): Avoid signed left shift.
+
+2020-01-04 Alan Modra <amodra@gmail.com>
* m32r.cpu (f-disp8): Avoid left shift of negative values.
(f-disp16, f-disp24): Likewise.
diff --git a/cpu/m32c.cpu b/cpu/m32c.cpu
index 5a38f1b..1e630a4 100644
--- a/cpu/m32c.cpu
+++ b/cpu/m32c.cpu
@@ -436,42 +436,42 @@
(df f-dsp-8-u16 "16 bit unsigned" (all-isas) 8 16 UINT
((value pc) (or UHI
- (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))) ; insert
+ (and (srl value 8) #xff)
+ (sll (and value #xff) 8))) ; insert
((value pc) (or UHI
- (and UHI (srl UHI value 8) #x00ff)
- (and UHI (sll UHI value 8) #xff00))) ; extract
+ (and UHI (srl UHI value 8) #xff)
+ (sll UHI (and UHI value #xff) 8))) ; extract
)
(df f-dsp-8-s16 "8 bit signed" (all-isas) 8 16 INT
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; insert
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; insert
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; extract
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; extract
)
(df f-dsp-16-u16 "16 bit unsigned" (all-isas) 16 16 UINT
((value pc) (or UHI
- (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))) ; insert
+ (and (srl value 8) #xff)
+ (sll (and value #xff) 8))) ; insert
((value pc) (or UHI
- (and UHI (srl UHI value 8) #x00ff)
- (and UHI (sll UHI value 8) #xff00))) ; extract
+ (and UHI (srl UHI value 8) #xff)
+ (sll UHI (and UHI value #xff) 8))) ; extract
)
(df f-dsp-16-s16 "16 bit signed" (all-isas) 16 16 INT
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; insert
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; insert
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; extract
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; extract
)
(dnmf f-dsp-24-u16 "16 bit unsigned" (all-isas) UINT
@@ -504,79 +504,82 @@
(df f-dsp-32-u16 "16 bit unsigned" (all-isas) 32 16 UINT
((value pc) (or UHI
- (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))) ; insert
+ (and (srl value 8) #xff)
+ (sll (and value #xff) 8))) ; insert
((value pc) (or UHI
- (and UHI (srl UHI value 8) #x00ff)
- (and UHI (sll UHI value 8) #xff00))) ; extract
+ (and UHI (srl UHI value 8) #xff)
+ (sll UHI (and UHI value #xff) 8))) ; extract
)
(df f-dsp-32-s16 "16 bit signed" (all-isas) 32 16 INT
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; insert
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; insert
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; extract
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; extract
)
(df f-dsp-40-u16 "16 bit unsigned" (all-isas) 40 16 UINT
((value pc) (or UHI
- (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))) ; insert
+ (and (srl value 8) #xff)
+ (sll (and value #xff) 8))) ; insert
((value pc) (or UHI
- (and UHI (srl UHI value 8) #x00ff)
- (and UHI (sll UHI value 8) #xff00))) ; extract
+ (and UHI (srl UHI value 8) #xff)
+ (sll UHI (and UHI value #xff) 8))) ; extract
)
(df f-dsp-40-s16 "16 bit signed" (all-isas) 40 16 INT
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; insert
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; insert
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; extract
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; extract
)
(df f-dsp-48-u16 "16 bit unsigned" (all-isas) 48 16 UINT
((value pc) (or UHI
- (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))) ; insert
+ (and (srl value 8) #xff)
+ (sll (and value #xff) 8))) ; insert
((value pc) (or UHI
- (and UHI (srl UHI value 8) #x00ff)
- (and UHI (sll UHI value 8) #xff00))) ; extract
+ (and UHI (srl UHI value 8) #xff)
+ (sll UHI (and UHI value #xff) 8))) ; extract
)
(df f-dsp-48-s16 "16 bit signed" (all-isas) 48 16 INT
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; insert
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; insert
((value pc) (ext INT
(trunc HI
- (or (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))))) ; extract
+ (or (and (srl value 8) #xff)
+ (sll (and value #xff) 8))))) ; extract
)
(df f-dsp-64-u16 "16 bit unsigned" (all-isas) 64 16 UINT
((value pc) (or UHI
- (and (srl value 8) #x00ff)
- (and (sll value 8) #xff00))) ; insert
+ (and (srl value 8) #xff)
+ (sll (and value #xff) 8))) ; insert
((value pc) (or UHI
- (and UHI (srl UHI value 8) #x00ff)
- (and UHI (sll UHI value 8) #xff00))) ; extract
+ (and UHI (srl UHI value 8) #xff)
+ (sll UHI (and UHI value #xff) 8))) ; extract
)
(df f-dsp-8-s24 "24 bit signed" (all-isas) 8 24 INT
- ((value pc) (or SI
- (or (and (srl value 16) #xff) (and value #xff00))
- (sll (ext INT (trunc QI (and value #xff))) 16)))
- ((value pc) (or SI
- (or (and (srl value 16) #xff) (and value #xff00))
- (sll (ext INT (trunc QI (and value #xff))) 16)))
+ ((value pc) (sub SI (xor (or SI (or (and (srl value 16) #xff)
+ (and value #xff00))
+ (sll (and value #xff) 16))
+ #x800000) #x800000))
+ ((value pc) (sub SI (xor (or SI
+ (or (and (srl value 16) #xff)
+ (and value #xff00))
+ (sll (and value #xff) 16))
+ #x800000) #x800000))
)
(df f-dsp-8-u24 "24 bit unsigned" (all-isas) 8 24 UINT
@@ -846,7 +849,7 @@
(set (ifield f-dsp-16-s16) (sra INT (ifield f-bitbase32-16-s19-unprefixed) 3))
)
(sequence () ; extract
- (set (ifield f-bitbase32-16-s19-unprefixed) (or (sll (ifield f-dsp-16-s16) 3)
+ (set (ifield f-bitbase32-16-s19-unprefixed) (or (mul (ifield f-dsp-16-s16) 8)
(ifield f-bitno32-unprefixed)))
)
)
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 92ba655..e80e62855 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,9 @@
2020-01-06 Alan Modra <amodra@gmail.com>
+ * m32c-ibld.c: Regenerate.
+
+2020-01-06 Alan Modra <amodra@gmail.com>
+
PR 25344
* z80-dis.c (suffix): Don't use a local struct buffer copy.
Peek at next byte to prevent recursion on repeated prefix bytes.
diff --git a/opcodes/m32c-ibld.c b/opcodes/m32c-ibld.c
index d1b476f..976b70b 100644
--- a/opcodes/m32c-ibld.c
+++ b/opcodes/m32c-ibld.c
@@ -626,7 +626,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_BITBASE16_16_U16 :
{
long value = fields->f_dsp_16_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
}
break;
@@ -672,7 +672,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
break;
{
long value = fields->f_dsp_16_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -704,7 +704,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
break;
{
long value = fields->f_dsp_16_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -723,7 +723,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
break;
{
long value = fields->f_dsp_16_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -812,7 +812,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
break;
{
long value = fields->f_dsp_32_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -834,7 +834,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_16_S16 :
{
long value = fields->f_dsp_16_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
}
break;
@@ -844,7 +844,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_16_U16 :
{
long value = fields->f_dsp_16_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
}
break;
@@ -856,7 +856,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
}
{
long value = fields->f_dsp_16_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -874,7 +874,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
}
{
long value = fields->f_dsp_16_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -929,7 +929,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
break;
{
long value = fields->f_dsp_32_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -947,7 +947,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
break;
{
long value = fields->f_dsp_32_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -960,7 +960,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_32_S16 :
{
long value = fields->f_dsp_32_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, buffer);
}
break;
@@ -970,7 +970,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_32_U16 :
{
long value = fields->f_dsp_32_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
}
break;
@@ -994,7 +994,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_40_S16 :
{
long value = fields->f_dsp_40_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, buffer);
}
break;
@@ -1004,7 +1004,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_40_U16 :
{
long value = fields->f_dsp_40_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 8, 16, 32, total_length, buffer);
}
break;
@@ -1028,7 +1028,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_48_S16 :
{
long value = fields->f_dsp_48_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, buffer);
}
break;
@@ -1038,7 +1038,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_48_U16 :
{
long value = fields->f_dsp_48_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 16, 16, 32, total_length, buffer);
}
break;
@@ -1050,7 +1050,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
}
{
long value = fields->f_dsp_48_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 16, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -1068,7 +1068,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
}
{
long value = fields->f_dsp_48_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 16, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -1084,7 +1084,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_8_S24 :
{
long value = fields->f_dsp_8_s24;
- value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((EXTQISI (TRUNCSIQI (((value) & (255))))) << (16))));
+ value = ((((((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) & (255))) << (16))))) ^ (8388608))) - (8388608));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 24, 32, total_length, buffer);
}
break;
@@ -1094,7 +1094,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_DSP_8_U16 :
{
long value = fields->f_dsp_8_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 0, 8, 16, 32, total_length, buffer);
}
break;
@@ -1237,7 +1237,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_IMM_16_HI :
{
long value = fields->f_dsp_16_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
}
break;
@@ -1252,14 +1252,14 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
}
{
long value = fields->f_dsp_16_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 0, 16, 16, 32, total_length, buffer);
}
if (errmsg)
break;
{
long value = fields->f_dsp_32_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 0, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -1307,7 +1307,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_IMM_32_HI :
{
long value = fields->f_dsp_32_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, buffer);
}
break;
@@ -1324,7 +1324,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_IMM_40_HI :
{
long value = fields->f_dsp_40_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, buffer);
}
break;
@@ -1352,7 +1352,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_IMM_48_HI :
{
long value = fields->f_dsp_48_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, buffer);
}
break;
@@ -1367,14 +1367,14 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
}
{
long value = fields->f_dsp_48_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 32, 16, 16, 32, total_length, buffer);
}
if (errmsg)
break;
{
long value = fields->f_dsp_64_u16;
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
errmsg = insert_normal (cd, value, 0, 64, 0, 16, 32, total_length, buffer);
}
if (errmsg)
@@ -1408,7 +1408,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
case M32C_OPERAND_IMM_8_HI :
{
long value = fields->f_dsp_8_s16;
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 16, 32, total_length, buffer);
}
break;
@@ -1826,7 +1826,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
}
break;
@@ -1862,12 +1862,12 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_16_s16 = value;
}
if (length <= 0) break;
{
- FLD (f_bitbase32_16_s19_unprefixed) = ((((FLD (f_dsp_16_s16)) << (3))) | (FLD (f_bitno32_unprefixed)));
+ FLD (f_bitbase32_16_s19_unprefixed) = ((((FLD (f_dsp_16_s16)) * (8))) | (FLD (f_bitno32_unprefixed)));
}
}
break;
@@ -1889,7 +1889,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
}
if (length <= 0) break;
@@ -1905,7 +1905,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
}
if (length <= 0) break;
@@ -1973,7 +1973,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
}
if (length <= 0) break;
@@ -1998,7 +1998,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_16_s16 = value;
}
break;
@@ -2009,7 +2009,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
}
break;
@@ -2018,7 +2018,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
}
if (length <= 0) break;
@@ -2034,7 +2034,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
}
if (length <= 0) break;
@@ -2080,7 +2080,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
}
if (length <= 0) break;
@@ -2096,7 +2096,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
}
if (length <= 0) break;
@@ -2112,7 +2112,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_32_s16 = value;
}
break;
@@ -2123,7 +2123,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
}
break;
@@ -2150,7 +2150,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_40_s16 = value;
}
break;
@@ -2161,7 +2161,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_40_u16 = value;
}
break;
@@ -2188,7 +2188,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_48_s16 = value;
}
break;
@@ -2199,7 +2199,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_48_u16 = value;
}
break;
@@ -2208,7 +2208,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_48_u16 = value;
}
if (length <= 0) break;
@@ -2224,7 +2224,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_48_u16 = value;
}
if (length <= 0) break;
@@ -2242,7 +2242,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 24, 32, total_length, pc, & value);
- value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((EXTQISI (TRUNCSIQI (((value) & (255))))) << (16))));
+ value = ((((((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) & (255))) << (16))))) ^ (8388608))) - (8388608));
fields->f_dsp_8_s24 = value;
}
break;
@@ -2253,7 +2253,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_8_u16 = value;
}
break;
@@ -2404,7 +2404,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_16_s16 = value;
}
break;
@@ -2416,14 +2416,14 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_16_u16 = value;
}
if (length <= 0) break;
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_32_u16 = value;
}
if (length <= 0) break;
@@ -2469,7 +2469,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 0, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_32_s16 = value;
}
break;
@@ -2488,7 +2488,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 8, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_40_s16 = value;
}
break;
@@ -2515,7 +2515,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 32, 16, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_48_s16 = value;
}
break;
@@ -2527,14 +2527,14 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_48_u16 = value;
}
if (length <= 0) break;
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0, 64, 0, 16, 32, total_length, pc, & value);
- value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280))));
+ value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8))));
fields->f_dsp_64_u16 = value;
}
if (length <= 0) break;
@@ -2569,7 +2569,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
{
long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 16, 32, total_length, pc, & value);
- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
fields->f_dsp_8_s16 = value;
}
break;