aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-s12z.c24
2 files changed, 18 insertions, 11 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 91af84b..637fc65 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
2018-09-20 Maciej W. Rozycki <macro@linux-mips.org>
+ * config/tc-s12z.c (lex_opr): Use an auxiliary unsigned variable
+ in encoding a constant operand.
+
+2018-09-20 Maciej W. Rozycki <macro@linux-mips.org>
+
* config/tc-ppc.c (ppc_dwsect): Use `valueT' rather than
`offsetT' as the type of `flag'.
diff --git a/gas/config/tc-s12z.c b/gas/config/tc-s12z.c
index 736f062..d3b2ea4 100644
--- a/gas/config/tc-s12z.c
+++ b/gas/config/tc-s12z.c
@@ -614,31 +614,33 @@ lex_opr (uint8_t *buffer, int *n_bytes, expressionS *exp)
buffer[3] = 0;
if (exp->X_op == O_constant)
{
- if (exp->X_add_number < (0x1U << 14))
+ valueT value = exp->X_add_number;
+
+ if (value < (0x1U << 14))
{
*xb = 0x00;
*n_bytes = 2;
- *xb |= exp->X_add_number >> 8;
- buffer[1] = exp->X_add_number;
+ *xb |= value >> 8;
+ buffer[1] = value;
}
- else if (exp->X_add_number < (0x1U << 19))
+ else if (value < (0x1U << 19))
{
*xb = 0xf8;
- if (exp->X_add_number & (0x1U << 17))
+ if (value & (0x1U << 17))
*xb |= 0x04;
- if (exp->X_add_number & (0x1U << 16))
+ if (value & (0x1U << 16))
*xb |= 0x01;
*n_bytes = 3;
- buffer[1] = exp->X_add_number >> 8;
- buffer[2] = exp->X_add_number;
+ buffer[1] = value >> 8;
+ buffer[2] = value;
}
else
{
*xb = 0xfa;
*n_bytes = 4;
- buffer[1] = exp->X_add_number >> 16;
- buffer[2] = exp->X_add_number >> 8;
- buffer[3] = exp->X_add_number;
+ buffer[1] = value >> 16;
+ buffer[2] = value >> 8;
+ buffer[3] = value;
}
}
return 1;