diff options
author | Scott Egerton <scott.egerton@imgtec.com> | 2018-06-13 15:39:05 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@mips.com> | 2018-06-13 15:39:05 +0100 |
commit | 730c31740a69eaee73e0fc5430d80daa683c26e7 (patch) | |
tree | ecfb431685aa1375d38532ccb2218195f8142050 /gas/testsuite | |
parent | a08ac84b963facb4c4a85c4d5df057d44e2a276d (diff) | |
download | gdb-730c31740a69eaee73e0fc5430d80daa683c26e7.zip gdb-730c31740a69eaee73e0fc5430d80daa683c26e7.tar.gz gdb-730c31740a69eaee73e0fc5430d80daa683c26e7.tar.bz2 |
MIPS: Add CRC ASE support
Add support for the CRC Application Specific Extension for Release 6 of
the MIPS Architecture.
[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
Instruction Set Manual", Imagination Technologies Ltd., Document
Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2
"Alphabetical List of Instructions", pp. 143-148
[2] "MIPS Architecture for Programmers Volume II-A: The MIPS64
Instruction Set Manual", Imagination Technologies Ltd., Document
Number: MD00087, Revision 6.06, December 15, 2016, Section 3.2
"Alphabetical List of Instructions", pp. 165-170
ChangeLog:
bfd/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
* elfxx-mips.c (print_mips_ases): Add CRC.
binutils/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
* readelf.c (print_mips_ases): Add CRC.
gas/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
Maciej W. Rozycki <macro@mips.com>
* config/tc-mips.c (options): Add OPTION_CRC and OPTION_NO_CRC.
(md_longopts): Likewise.
(md_show_usage): Add help for -mcrc and -mno-crc.
(mips_ases): Define availability for CRC and CRC64.
(mips_convert_ase_flags): Map ASE_CRC to AFL_ASE_CRC.
* doc/as.texinfo: Document -mcrc, -mno-crc.
* doc/c-mips.texi: Document -mcrc, -mno-crc, .set crc and
.set no-crc.
* testsuite/gas/mips/ase-errors-1.l: Add error checks for CRC
ASE.
* testsuite/gas/mips/ase-errors-2.l: Likewise.
* testsuite/gas/mips/ase-errors-1.s: Likewise.
* testsuite/gas/mips/ase-errors-2.s: Likewise.
* testsuite/gas/mips/crc.d: New test.
* testsuite/gas/mips/crc64.d: New test.
* testsuite/gas/mips/crc-err.d: New test.
* testsuite/gas/mips/crc64-err.d: New test.
* testsuite/gas/mips/crc-err.l: New test stderr output.
* testsuite/gas/mips/crc64-err.l: New test stderr output.
* testsuite/gas/mips/crc.s: New test source.
* testsuite/gas/mips/crc64.s: New test source.
* testsuite/gas/mips/crc-err.s: New test source.
* testsuite/gas/mips/crc64-err.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
include/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
* elf/mips.h (AFL_ASE_CRC): New macro.
(AFL_ASE_MASK): Update to include AFL_ASE_CRC.
* opcode/mips.h (ASE_CRC): New macro.
* opcode/mips.h (ASE_CRC64): Likewise.
opcodes/
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>
* mips-dis.c (mips_arch_choices): Add CRC and CRC64 ASEs.
* mips-opc.c (CRC, CRC64): New macros.
(mips_builtin_opcodes): Define crc32b, crc32h, crc32w,
crc32cb, crc32ch and crc32cw for CRC. Define crc32d and
crc32cd for CRC64.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/mips/ase-errors-1.l | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/ase-errors-1.s | 9 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/ase-errors-2.l | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/ase-errors-2.s | 11 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc-err.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc-err.l | 19 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc-err.s | 32 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc.d | 21 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc.s | 12 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc64-err.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc64-err.l | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc64-err.s | 12 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc64.d | 17 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/crc64.s | 8 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/mips.exp | 5 |
15 files changed, 167 insertions, 0 deletions
diff --git a/gas/testsuite/gas/mips/ase-errors-1.l b/gas/testsuite/gas/mips/ase-errors-1.l index f989982..7f7bba5 100644 --- a/gas/testsuite/gas/mips/ase-errors-1.l +++ b/gas/testsuite/gas/mips/ase-errors-1.l @@ -40,3 +40,7 @@ # ---------------------------------------------------------------------------- .*:100: Warning: the `eva' extension requires MIPS32 revision 2 or greater .*:103: Error: opcode not supported.* `lbue \$4,16\(\$5\)' +# ---------------------------------------------------------------------------- +.*:108: Error: opcode not supported.* `crc32d \$4,\$7,\$4' +.*:109: Warning: the `crc' extension requires MIPS32 revision 6 or greater +.*:112: Error: opcode not supported.* `crc32b \$4,\$7,\$4' diff --git a/gas/testsuite/gas/mips/ase-errors-1.s b/gas/testsuite/gas/mips/ase-errors-1.s index c5201c3..811f719 100644 --- a/gas/testsuite/gas/mips/ase-errors-1.s +++ b/gas/testsuite/gas/mips/ase-errors-1.s @@ -102,6 +102,15 @@ .set noeva lbue $4,16($5) # ERROR: eva not enabled + .set mips32r6 + .set crc # OK + crc32b $4,$7,$4 # OK + crc32d $4,$7,$4 # ERROR: 64-bit only + .set mips32r5 # ERROR: too low + crc32b $4,$7,$4 # OK + .set nocrc + crc32b $4,$7,$4 # ERROR: crc not enabled + # There should be no errors after this. .set fp=32 .set mips1 diff --git a/gas/testsuite/gas/mips/ase-errors-2.l b/gas/testsuite/gas/mips/ase-errors-2.l index 4c24690..652c27c 100644 --- a/gas/testsuite/gas/mips/ase-errors-2.l +++ b/gas/testsuite/gas/mips/ase-errors-2.l @@ -32,3 +32,7 @@ # ---------------------------------------------------------------------------- .*:84: Warning: the `eva' extension requires MIPS64 revision 2 or greater .*:87: Error: opcode not supported.* `lbue \$4,16\(\$5\)' +# ---------------------------------------------------------------------------- +.*:93: Warning: the `crc' extension requires MIPS64 revision 6 or greater +.*:97: Error: opcode not supported.* `crc32b \$4,\$7,\$4' +.*:98: Error: opcode not supported.* `crc32d \$4,\$7,\$4' diff --git a/gas/testsuite/gas/mips/ase-errors-2.s b/gas/testsuite/gas/mips/ase-errors-2.s index 4a17e4f..7ef363e 100644 --- a/gas/testsuite/gas/mips/ase-errors-2.s +++ b/gas/testsuite/gas/mips/ase-errors-2.s @@ -86,6 +86,17 @@ .set noeva lbue $4,16($5) # ERROR: eva not enabled + .set mips64r6 + .set crc # OK + crc32b $4,$7,$4 # OK + crc32d $4,$7,$4 # OK + .set mips64r5 # ERROR: too low + crc32b $4,$7,$4 # OK + crc32d $4,$7,$4 # OK + .set nocrc + crc32b $4,$7,$4 # ERROR: crc not enabled + crc32d $4,$7,$4 # ERROR: crc not enabled + # There should be no errors after this. .set fp=32 .set mips4 diff --git a/gas/testsuite/gas/mips/crc-err.d b/gas/testsuite/gas/mips/crc-err.d new file mode 100644 index 0000000..88d61d3 --- /dev/null +++ b/gas/testsuite/gas/mips/crc-err.d @@ -0,0 +1,3 @@ +#name: MIPS CRC instruction errors +#as: -32 -mcrc +#error-output: crc-err.l diff --git a/gas/testsuite/gas/mips/crc-err.l b/gas/testsuite/gas/mips/crc-err.l new file mode 100644 index 0000000..8fbd195 --- /dev/null +++ b/gas/testsuite/gas/mips/crc-err.l @@ -0,0 +1,19 @@ +.*: Assembler messages: +.*:4: Error: invalid operands `crc32b \$5,\$4,\$4' +.*:6: Error: invalid operands `crc32b \$4,\$4,\$5' +.*:7: Error: invalid operands `crc32b \$4,\$5,\$6' +.*:9: Error: invalid operands `crc32h \$5,\$4,\$4' +.*:11: Error: invalid operands `crc32h \$4,\$4,\$5' +.*:12: Error: invalid operands `crc32h \$4,\$5,\$6' +.*:14: Error: invalid operands `crc32w \$5,\$4,\$4' +.*:16: Error: invalid operands `crc32w \$4,\$4,\$5' +.*:17: Error: invalid operands `crc32w \$4,\$5,\$6' +.*:19: Error: invalid operands `crc32cb \$5,\$4,\$4' +.*:21: Error: invalid operands `crc32cb \$4,\$4,\$5' +.*:22: Error: invalid operands `crc32cb \$4,\$5,\$6' +.*:24: Error: invalid operands `crc32ch \$5,\$4,\$4' +.*:26: Error: invalid operands `crc32ch \$4,\$4,\$5' +.*:27: Error: invalid operands `crc32ch \$4,\$5,\$6' +.*:29: Error: invalid operands `crc32cw \$5,\$4,\$4' +.*:31: Error: invalid operands `crc32cw \$4,\$4,\$5' +.*:32: Error: invalid operands `crc32cw \$4,\$5,\$6' diff --git a/gas/testsuite/gas/mips/crc-err.s b/gas/testsuite/gas/mips/crc-err.s new file mode 100644 index 0000000..b3e60fa --- /dev/null +++ b/gas/testsuite/gas/mips/crc-err.s @@ -0,0 +1,32 @@ + .text +test_crc: + crc32b $4,$4,$4 + crc32b $5,$4,$4 + crc32b $4,$5,$4 + crc32b $4,$4,$5 + crc32b $4,$5,$6 + crc32h $4,$4,$4 + crc32h $5,$4,$4 + crc32h $4,$5,$4 + crc32h $4,$4,$5 + crc32h $4,$5,$6 + crc32w $4,$4,$4 + crc32w $5,$4,$4 + crc32w $4,$5,$4 + crc32w $4,$4,$5 + crc32w $4,$5,$6 + crc32cb $4,$4,$4 + crc32cb $5,$4,$4 + crc32cb $4,$5,$4 + crc32cb $4,$4,$5 + crc32cb $4,$5,$6 + crc32ch $4,$4,$4 + crc32ch $5,$4,$4 + crc32ch $4,$5,$4 + crc32ch $4,$4,$5 + crc32ch $4,$5,$6 + crc32cw $4,$4,$4 + crc32cw $5,$4,$4 + crc32cw $4,$5,$4 + crc32cw $4,$4,$5 + crc32cw $4,$5,$6 diff --git a/gas/testsuite/gas/mips/crc.d b/gas/testsuite/gas/mips/crc.d new file mode 100644 index 0000000..913ead6 --- /dev/null +++ b/gas/testsuite/gas/mips/crc.d @@ -0,0 +1,21 @@ +#objdump: -pdr --prefix-addresses --show-raw-insn +#name: MIPS CRC +#as: -mcrc -32 + +# Test the CRC instructions + +.*: +file format .*mips.* +#... +ASEs: +#... + CRC ASE +#... + +Disassembly of section \.text: +[0-9a-f]+ <[^>]*> 7ce4000f crc32b a0,a3,a0 +[0-9a-f]+ <[^>]*> 7ce4004f crc32h a0,a3,a0 +[0-9a-f]+ <[^>]*> 7ce4008f crc32w a0,a3,a0 +[0-9a-f]+ <[^>]*> 7ce4010f crc32cb a0,a3,a0 +[0-9a-f]+ <[^>]*> 7ce4014f crc32ch a0,a3,a0 +[0-9a-f]+ <[^>]*> 7ce4018f crc32cw a0,a3,a0 + \.\.\. diff --git a/gas/testsuite/gas/mips/crc.s b/gas/testsuite/gas/mips/crc.s new file mode 100644 index 0000000..74d80ed --- /dev/null +++ b/gas/testsuite/gas/mips/crc.s @@ -0,0 +1,12 @@ + .text +test_crc: + crc32b $4,$7,$4 + crc32h $4,$7,$4 + crc32w $4,$7,$4 + crc32cb $4,$7,$4 + crc32ch $4,$7,$4 + crc32cw $4,$7,$4 + +# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 2 + .space 8 diff --git a/gas/testsuite/gas/mips/crc64-err.d b/gas/testsuite/gas/mips/crc64-err.d new file mode 100644 index 0000000..93e6a54 --- /dev/null +++ b/gas/testsuite/gas/mips/crc64-err.d @@ -0,0 +1,3 @@ +#name: MIPS CRC64 instruction errors +#as: -mcrc +#error-output: crc64-err.l diff --git a/gas/testsuite/gas/mips/crc64-err.l b/gas/testsuite/gas/mips/crc64-err.l new file mode 100644 index 0000000..6e4c943 --- /dev/null +++ b/gas/testsuite/gas/mips/crc64-err.l @@ -0,0 +1,7 @@ +.*: Assembler messages: +.*:4: Error: invalid operands `crc32d \$5,\$4,\$4' +.*:6: Error: invalid operands `crc32d \$4,\$4,\$5' +.*:7: Error: invalid operands `crc32d \$4,\$5,\$6' +.*:9: Error: invalid operands `crc32cd \$5,\$4,\$4' +.*:11: Error: invalid operands `crc32cd \$4,\$4,\$5' +.*:12: Error: invalid operands `crc32cd \$4,\$5,\$6' diff --git a/gas/testsuite/gas/mips/crc64-err.s b/gas/testsuite/gas/mips/crc64-err.s new file mode 100644 index 0000000..72394e2 --- /dev/null +++ b/gas/testsuite/gas/mips/crc64-err.s @@ -0,0 +1,12 @@ + .text +test_crc: + crc32d $4,$4,$4 + crc32d $5,$4,$4 + crc32d $4,$5,$4 + crc32d $4,$4,$5 + crc32d $4,$5,$6 + crc32cd $4,$4,$4 + crc32cd $5,$4,$4 + crc32cd $4,$5,$4 + crc32cd $4,$4,$5 + crc32cd $4,$5,$6 diff --git a/gas/testsuite/gas/mips/crc64.d b/gas/testsuite/gas/mips/crc64.d new file mode 100644 index 0000000..59a0ade --- /dev/null +++ b/gas/testsuite/gas/mips/crc64.d @@ -0,0 +1,17 @@ +#objdump: -pdr --prefix-addresses --show-raw-insn +#name: MIPS CRC64 +#as: -mcrc + +# Test the CRC64 instructions + +.*: +file format .*mips.* +#... +ASEs: +#... + CRC ASE +#... + +Disassembly of section \.text: +[0-9a-f]+ <[^>]*> 7ce400cf crc32d a0,a3,a0 +[0-9a-f]+ <[^>]*> 7ce401cf crc32cd a0,a3,a0 + \.\.\. diff --git a/gas/testsuite/gas/mips/crc64.s b/gas/testsuite/gas/mips/crc64.s new file mode 100644 index 0000000..926fdca --- /dev/null +++ b/gas/testsuite/gas/mips/crc64.s @@ -0,0 +1,8 @@ + .text +test_crc: + crc32d $4,$7,$4 + crc32cd $4,$7,$4 + +# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 2 + .space 8 diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 026c276..47e923b 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -2056,4 +2056,9 @@ if { [istarget mips*-*-vxworks*] } { run_list_test_arches "r6-branch-constraints" "-32" \ [mips_arch_list_matching mips32r6] + + run_dump_test_arches "crc" [mips_arch_list_matching mips32r6] + run_dump_test_arches "crc-err" [mips_arch_list_matching mips32r6] + run_dump_test_arches "crc64" [mips_arch_list_matching mips64r6] + run_dump_test_arches "crc64-err" [mips_arch_list_matching mips64r6] } |