From dad60f8e13c64b699e34d437c1c02b87ae158380 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Tue, 12 Mar 2013 02:41:26 +0000 Subject: [PATCH] 2013-03-11 Sebastian Huber include/ * opcode/nios2.h (OPX_WRPRS): New define. (OP_MATCH_WRPRS): Likewise. opcodes/ * nios2-opc.c (nios2_builtin_opcodes): Add entry for wrprs. gas/ * config/tc-nios2.c (nios2_assemble_args_ds): New function. (nios2_arg_info_structs): Add "d,s" and "d,s,E" entries. gas/testsuite/ * gas/nios2/nios2.exp: Run wrprs. * gas/nios2/wrprs.d: New file. * gas/nios2/wrprs.s: Likewise. --- gas/ChangeLog | 5 +++++ gas/config/tc-nios2.c | 24 ++++++++++++++++++++++++ gas/testsuite/ChangeLog | 6 ++++++ gas/testsuite/gas/nios2/nios2.exp | 1 + gas/testsuite/gas/nios2/wrprs.d | 19 +++++++++++++++++++ gas/testsuite/gas/nios2/wrprs.s | 16 ++++++++++++++++ include/ChangeLog | 5 +++++ include/opcode/nios2.h | 2 ++ opcodes/ChangeLog | 4 ++++ opcodes/nios2-opc.c | 2 ++ 10 files changed, 84 insertions(+) create mode 100644 gas/testsuite/gas/nios2/wrprs.d create mode 100644 gas/testsuite/gas/nios2/wrprs.s diff --git a/gas/ChangeLog b/gas/ChangeLog index de1a91e..92ad5df 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2013-03-11 Sebastian Huber + + * config/tc-nios2.c (nios2_assemble_args_ds): New function. + (nios2_arg_info_structs): Add "d,s" and "d,s,E" entries. + 2013-03-11 Kyrylo Tkachov * config/tc-arm.c (crc_ext_armv8): New feature set. diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c index 841c454..d669c60 100644 --- a/gas/config/tc-nios2.c +++ b/gas/config/tc-nios2.c @@ -1694,6 +1694,28 @@ nios2_assemble_args_cs (nios2_insn_infoS *insn_info) } static void +nios2_assemble_args_ds (nios2_insn_infoS * insn_info) +{ + if (insn_info->insn_tokens[1] != NULL && insn_info->insn_tokens[2] != NULL) + { + struct nios2_reg *dst = nios2_reg_lookup (insn_info->insn_tokens[1]); + struct nios2_reg *src = nios2_reg_lookup (insn_info->insn_tokens[2]); + + if (dst == NULL) + as_bad (_("unknown register %s"), insn_info->insn_tokens[1]); + else + SET_INSN_FIELD (RRD, insn_info->insn_code, dst->index); + + if (src == NULL) + as_bad (_("unknown register %s"), insn_info->insn_tokens[2]); + else + SET_INSN_FIELD (RRS, insn_info->insn_code, src->index); + + nios2_check_assembly (insn_info->insn_code, insn_info->insn_tokens[3]); + } +} + +static void nios2_assemble_args_ldst (nios2_insn_infoS *insn_info) { if (insn_info->insn_tokens[1] != NULL @@ -1850,6 +1872,8 @@ const nios2_arg_infoS nios2_arg_info_structs[] = { {"d,c,E", nios2_assemble_args_dc}, {"c,s", nios2_assemble_args_cs}, {"c,s,E", nios2_assemble_args_cs}, + {"d,s", nios2_assemble_args_ds}, + {"d,s,E", nios2_assemble_args_ds}, {"l,d,s,t", nios2_assemble_args_ldst}, {"l,d,s,t,E", nios2_assemble_args_ldst}, {"d,s,j", nios2_assemble_args_dsj}, diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index ad321f7..a672651 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2013-03-11 Sebastian Huber + * gas/nios2/nios2.exp: Run wrprs. + * gas/nios2/wrprs.d: New file. + * gas/nios2/wrprs.s: Likewise. + +2013-03-11 Sebastian Huber + * gas/nios2/nios2.exp: Run rdprs. * gas/nios2/rdprs.d: New file. * gas/nios2/rdprs.s: Likewise. diff --git a/gas/testsuite/gas/nios2/nios2.exp b/gas/testsuite/gas/nios2/nios2.exp index 173db00..af22bf8 100644 --- a/gas/testsuite/gas/nios2/nios2.exp +++ b/gas/testsuite/gas/nios2/nios2.exp @@ -54,6 +54,7 @@ if { [istarget nios2-*-*] } then { run_dump_test "rotate" run_dump_test "registers" run_dump_test "rdprs" + run_dump_test "wrprs" run_dump_test "stw" run_dump_test "sth" diff --git a/gas/testsuite/gas/nios2/wrprs.d b/gas/testsuite/gas/nios2/wrprs.d new file mode 100644 index 0000000..2e6de57 --- /dev/null +++ b/gas/testsuite/gas/nios2/wrprs.d @@ -0,0 +1,19 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: NIOS2 wrprs + +# Test the wrprs instruction + +.*: +file format elf32-littlenios2 + +Disassembly of section .text: +0+0000 <[^>]*> 0000a03a wrprs zero,zero +0+0004 <[^>]*> 0002a03a wrprs at,zero +0+0008 <[^>]*> 0004a03a wrprs r2,zero +0+000c <[^>]*> 0008a03a wrprs r4,zero +0+0010 <[^>]*> 0010a03a wrprs r8,zero +0+0014 <[^>]*> 0020a03a wrprs r16,zero +0+0018 <[^>]*> 0800a03a wrprs zero,at +0+001c <[^>]*> 1000a03a wrprs zero,r2 +0+0020 <[^>]*> 2000a03a wrprs zero,r4 +0+0024 <[^>]*> 4000a03a wrprs zero,r8 +0+0028 <[^>]*> 8000a03a wrprs zero,r16 diff --git a/gas/testsuite/gas/nios2/wrprs.s b/gas/testsuite/gas/nios2/wrprs.s new file mode 100644 index 0000000..c722ce5 --- /dev/null +++ b/gas/testsuite/gas/nios2/wrprs.s @@ -0,0 +1,16 @@ +# Source file used to test the wrprs instruction + +.set noat + +foo: + wrprs zero, zero + wrprs at, zero + wrprs r2, zero + wrprs r4, zero + wrprs r8, zero + wrprs r16, zero + wrprs zero, at + wrprs zero, r2 + wrprs zero, r4 + wrprs zero, r8 + wrprs zero, r16 diff --git a/include/ChangeLog b/include/ChangeLog index f186941..a6722b6 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,5 +1,10 @@ 2013-03-11 Sebastian Huber + * opcode/nios2.h (OPX_WRPRS): New define. + (OP_MATCH_WRPRS): Likewise. + +2013-03-11 Sebastian Huber + * opcode/nios2.h (OP_RDPRS): New define. (OP_MATCH_RDPRS): Likewise. diff --git a/include/opcode/nios2.h b/include/opcode/nios2.h index 83773d5..3405f55 100644 --- a/include/opcode/nios2.h +++ b/include/opcode/nios2.h @@ -344,6 +344,7 @@ struct nios2_reg #define OPX_SYNC 54 #define OPX_TRAP 45 #define OPX_WRCTL 46 +#define OPX_WRPRS 20 #define OPX_XOR 30 /* The following macros define the opcode matches for each @@ -440,6 +441,7 @@ struct nios2_reg #define OP_MATCH_TRAP ((0x1d << 17) | OPX_MATCH (OPX_TRAP)) #define OP_MATCH_ERET (0xe8000000 | OPX_MATCH (OPX_ERET)) #define OP_MATCH_WRCTL OPX_MATCH (OPX_WRCTL) +#define OP_MATCH_WRPRS OPX_MATCH (OPX_WRPRS) #define OP_MATCH_XOR OPX_MATCH (OPX_XOR) #define OP_MATCH_FLUSHI OPX_MATCH (OPX_FLUSHI) #define OP_MATCH_FLUSHP OPX_MATCH (OPX_FLUSHP) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 846bc94..554d8a0 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,9 @@ 2013-03-11 Sebastian Huber + * nios2-opc.c (nios2_builtin_opcodes): Add entry for wrprs. + +2013-03-11 Sebastian Huber + * nios2-opc.c (nios2_builtin_opcodes): Add entry for rdprs. 2013-03-11 Sebastian Huber diff --git a/opcodes/nios2-opc.c b/opcodes/nios2-opc.c index 9617d47..41903d0 100644 --- a/opcodes/nios2-opc.c +++ b/opcodes/nios2-opc.c @@ -393,6 +393,8 @@ const struct nios2_opcode nios2_builtin_opcodes[] = OP_MATCH_CUSTOM, OP_MASK_ROP, 0, custom_opcode_overflow}, {"wrctl", "c,s", "c,s,E", 2, OP_MATCH_WRCTL, OP_MASK_WRCTL, 0, no_overflow}, + {"wrprs", "d,s", "d,s,E", 2, + OP_MATCH_WRPRS, OP_MASK_RRT|OP_MASK_ROPX|OP_MASK_ROP, 0, no_overflow}, {"xor", "d,s,t", "d,s,t,E", 3, OP_MATCH_XOR, OP_MASK_ROPX | OP_MASK_ROP, 0, no_overflow}, {"xorhi", "t,s,u", "t,s,u,E", 3, -- 2.7.4