aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaraz Shahbazker <fshahbazker@wavecomp.com>2019-05-06 09:29:20 -0700
committerFaraz Shahbazker <fshahbazker@wavecomp.com>2019-05-10 21:36:32 -0700
commit387e762476ff224ee40760910e73a3905a2c380a (patch)
tree8cbc344599f40ab24af2cc94dbc05858f51949f2 /gas/config/tc-mips.c
parentPowerPC objdump -Mraw (diff)
downloadbinutils-gdb-387e762476ff224ee40760910e73a3905a2c380a.tar.gz
binutils-gdb-387e762476ff224ee40760910e73a3905a2c380a.tar.bz2
binutils-gdb-387e762476ff224ee40760910e73a3905a2c380a.zip
Add macro expansions for ADD, SUB, DADD and DSUB for MIPS r6
Release 6 of the MIPS architecture does not have an ADDI instruction. ADD/SUB instructions with immediate operands can be expanded to load and immediate value and then perform the operation. gas/ * config/tc-mips.c (macro) <M_ADD_I, M_SUB_I, M_DADD_I, M_DSUB_I>: Add expansions for MIPS r6. * testsuite/gas/mips/add.s: Enable tests for R6. * testsuite/gas/mips/daddi.s: Annotate to test DADD for R6. * testsuite/gas/mips/mipsr6@add.d: Likewise. * gas/testsuite/gas/mips/mipsr6@dadd.d: New test. * gas/testsuite/gas/mips/mips.exp: Run the new test. opcodes/ * mips-opc.c (mips_opcodes): Enable ADD, SUB, DADD and DSUB macros for R6.
Diffstat (limited to 'gas/config/tc-mips.c')
-rw-r--r--gas/config/tc-mips.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 6a945e31568..05527d8084d 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -10350,7 +10350,10 @@ macro (struct mips_cl_insn *ip, char *str)
case M_ADD_I:
s = "addi";
s2 = "add";
- goto do_addi;
+ if (ISA_IS_R6 (mips_opts.isa))
+ goto do_addi_i;
+ else
+ goto do_addi;
case M_ADDU_I:
s = "addiu";
s2 = "addu";
@@ -10359,10 +10362,11 @@ macro (struct mips_cl_insn *ip, char *str)
dbl = 1;
s = "daddi";
s2 = "dadd";
- if (!mips_opts.micromips)
+ if (!mips_opts.micromips && !ISA_IS_R6 (mips_opts.isa))
goto do_addi;
if (imm_expr.X_add_number >= -0x200
- && imm_expr.X_add_number < 0x200)
+ && imm_expr.X_add_number < 0x200
+ && !ISA_IS_R6 (mips_opts.isa))
{
macro_build (NULL, s, "t,r,.", op[0], op[1],
(int) imm_expr.X_add_number);
@@ -13716,7 +13720,10 @@ macro (struct mips_cl_insn *ip, char *str)
case M_SUB_I:
s = "addi";
s2 = "sub";
- goto do_subi;
+ if (ISA_IS_R6 (mips_opts.isa))
+ goto do_subi_i;
+ else
+ goto do_subi;
case M_SUBU_I:
s = "addiu";
s2 = "subu";
@@ -13725,10 +13732,11 @@ macro (struct mips_cl_insn *ip, char *str)
dbl = 1;
s = "daddi";
s2 = "dsub";
- if (!mips_opts.micromips)
+ if (!mips_opts.micromips && !ISA_IS_R6 (mips_opts.isa))
goto do_subi;
if (imm_expr.X_add_number > -0x200
- && imm_expr.X_add_number <= 0x200)
+ && imm_expr.X_add_number <= 0x200
+ && !ISA_IS_R6 (mips_opts.isa))
{
macro_build (NULL, s, "t,r,.", op[0], op[1],
(int) -imm_expr.X_add_number);