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/testsuite | |
parent | 0067be51e9436c5bbd961a4f54c10dbd50c491ea (diff) | |
download | binutils-gdb-387e762476ff224ee40760910e73a3905a2c380a.tar.gz |
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/testsuite')
-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 |
5 files changed, 38 insertions, 4 deletions
diff --git a/gas/testsuite/gas/mips/add.s b/gas/testsuite/gas/mips/add.s index 5702d921a7c..d1c70edcf80 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 b06dbee7f60..b942a9fe185 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 3e66fcf323e..4db66833d01 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 65a5214459f..fe329991e7c 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 00000000000..0701f266981 --- /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 + \.\.\. |