diff options
author | Faraz Shahbazker <fshahbazker@wavecomp.com> | 2019-05-06 09:29:20 -0700 |
---|---|---|
committer | Faraz Shahbazker <fshahbazker@wavecomp.com> | 2019-05-10 21:36:32 -0700 |
commit | 387e762476ff224ee40760910e73a3905a2c380a (patch) | |
tree | 8cbc344599f40ab24af2cc94dbc05858f51949f2 /gas | |
parent | 0067be51e9436c5bbd961a4f54c10dbd50c491ea (diff) | |
download | gdb-387e762476ff224ee40760910e73a3905a2c380a.zip gdb-387e762476ff224ee40760910e73a3905a2c380a.tar.gz gdb-387e762476ff224ee40760910e73a3905a2c380a.tar.bz2 |
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')
-rw-r--r-- | gas/ChangeLog | 10 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 20 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/add.s | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/daddi.s | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips.exp | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mipsr6@add.d | 15 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mipsr6@dadd.d | 21 |
7 files changed, 62 insertions, 10 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 5307d23..c524fec 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2019-05-10 Faraz Shahbazker <fshahbazker@wavecomp.com> + + * 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. + 2019-05-09 Matthew Malcomson <matthew.malcomson@arm.com> * testsuite/gas/aarch64/sve2.d: Remove file format restriction. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 6a945e3..05527d80 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); diff --git a/gas/testsuite/gas/mips/add.s b/gas/testsuite/gas/mips/add.s index 5702d92..d1c70ed 100644 --- a/gas/testsuite/gas/mips/add.s +++ b/gas/testsuite/gas/mips/add.s @@ -1,14 +1,12 @@ # Source file used to test the add macro. foo: - .ifndef r6 add $4,$4,0 add $4,$4,1 add $4,$4,0x8000 add $4,$4,-0x8000 add $4,$4,0x10000 add $4,$4,0x1a5a5 - .endif # addu is handled the same way add is; just confirm that it isn't # totally broken. diff --git a/gas/testsuite/gas/mips/daddi.s b/gas/testsuite/gas/mips/daddi.s index b06dbee..b942a9f 100644 --- a/gas/testsuite/gas/mips/daddi.s +++ b/gas/testsuite/gas/mips/daddi.s @@ -5,7 +5,7 @@ .text text_label: - + .ifndef r6 daddi $3, $2, 511 daddi $5, $4, -512 @@ -17,6 +17,7 @@ text_label: daddi $9, $8, -513 daddi $11, $10, 32767 daddi $13, $12, -32768 + .endif # 16 bits accepted for standard MIPS code. .ifndef micromips diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 3e66fcf..4db6683 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -1502,6 +1502,7 @@ if { [istarget mips*-*-vxworks*] } { [mips_arch_list_matching mips32] ] ] run_dump_test_arches "daddi" [mips_arch_list_matching mips3 \ !mips32r6] + run_dump_test_arches "dadd" [mips_arch_list_matching mips64r6] run_dump_test_arches "pref" [lsort -dictionary -unique [concat \ [mips_arch_list_matching mips4] \ [mips_arch_list_matching mips32] ] ] diff --git a/gas/testsuite/gas/mips/mipsr6@add.d b/gas/testsuite/gas/mips/mipsr6@add.d index 65a5214..fe32999 100644 --- a/gas/testsuite/gas/mips/mipsr6@add.d +++ b/gas/testsuite/gas/mips/mipsr6@add.d @@ -8,5 +8,18 @@ .*: +file format .*mips.* Disassembly of section .text: -0+0000 <[^>]*> addiu a0,a0,1 +[0-9a-f]+ <[^>]*> li at,0 +[0-9a-f]+ <[^>]*> add a0,a0,at +[0-9a-f]+ <[^>]*> li at,1 +[0-9a-f]+ <[^>]*> add a0,a0,at +[0-9a-f]+ <[^>]*> li at,0x8000 +[0-9a-f]+ <[^>]*> add a0,a0,at +[0-9a-f]+ <[^>]*> li at,-32768 +[0-9a-f]+ <[^>]*> add a0,a0,at +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> add a0,a0,at +[0-9a-f]+ <[^>]*> lui at,0x1 +[0-9a-f]+ <[^>]*> ori at,at,0xa5a5 +[0-9a-f]+ <[^>]*> add a0,a0,at +[0-9a-f]+ <[^>]*> addiu a0,a0,1 \.\.\. diff --git a/gas/testsuite/gas/mips/mipsr6@dadd.d b/gas/testsuite/gas/mips/mipsr6@dadd.d new file mode 100644 index 0000000..0701f26 --- /dev/null +++ b/gas/testsuite/gas/mips/mipsr6@dadd.d @@ -0,0 +1,21 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS DADD immediate expansion for R6 +#as: -32 +#source: daddi.s + +# Check MIPS DADD macro expansion with an immediate operand. + +.*: +file format .*mips.* + +Disassembly of section \.text: +[0-9a-f]+ <[^>]*> 34018000 li at,0x8000 +[0-9a-f]+ <[^>]*> 01c1782c dadd t7,t6,at +[0-9a-f]+ <[^>]*> 3c01ffff lui at,0xffff +[0-9a-f]+ <[^>]*> 34217fff ori at,at,0x7fff +[0-9a-f]+ <[^>]*> 0201882c dadd s1,s0,at +[0-9a-f]+ <[^>]*> 34018200 li at,0x8200 +[0-9a-f]+ <[^>]*> 0241982c dadd s3,s2,at +[0-9a-f]+ <[^>]*> 3c01ffff lui at,0xffff +[0-9a-f]+ <[^>]*> 34217dff ori at,at,0x7dff +[0-9a-f]+ <[^>]*> 0281a82c dadd s5,s4,at + \.\.\. |