diff options
author | Stafford Horne <shorne@gmail.com> | 2019-06-13 06:16:19 +0900 |
---|---|---|
committer | Stafford Horne <shorne@gmail.com> | 2019-06-13 06:16:19 +0900 |
commit | e4c4ac46e8e7ef92311181f85b193af369897151 (patch) | |
tree | 9f942d2ed2f996caa17a32cedb033aafaea2bf52 /opcodes/or1k-asm.c | |
parent | a2e4218f237dd1555249555f8be4165aa8e56b6a (diff) | |
download | gdb-e4c4ac46e8e7ef92311181f85b193af369897151.zip gdb-e4c4ac46e8e7ef92311181f85b193af369897151.tar.gz gdb-e4c4ac46e8e7ef92311181f85b193af369897151.tar.bz2 |
opcodes/or1k: Regenerate opcodes
This picks up changes for:
- new orfpx64a32 spec additions
- new unordered instructions
- symbol and documentation updates
opcodes/ChangeLog:
* or1k-asm.c: Regenerated.
* or1k-desc.c: Regenerated.
* or1k-desc.h: Regenerated.
* or1k-dis.c: Regenerated.
* or1k-ibld.c: Regenerated.
* or1k-opc.c: Regenerated.
* or1k-opc.h: Regenerated.
* or1k-opinst.c: Regenerated.
Diffstat (limited to 'opcodes/or1k-asm.c')
-rw-r--r-- | opcodes/or1k-asm.c | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/opcodes/or1k-asm.c b/opcodes/or1k-asm.c index 7d058d0..55668af 100644 --- a/opcodes/or1k-asm.c +++ b/opcodes/or1k-asm.c @@ -419,6 +419,56 @@ parse_uimm16_split (CGEN_CPU_DESC cd, const char **strp, int opindex, return errmsg; } +/* Parse register pairs with syntax rA,rB to a flag + rA value. */ + +static const char * +parse_regpair (CGEN_CPU_DESC cd, const char **strp, + int opindex ATTRIBUTE_UNUSED, unsigned long *valuep) +{ + long reg1_index; + long reg2_index; + const char *errmsg; + + /* The first part should just be a register. */ + errmsg = cgen_parse_keyword (cd, strp, &or1k_cgen_opval_h_gpr, + ®1_index); + + /* If that worked skip the comma separator. */ + if (errmsg == NULL) + { + if (**strp == ',') + ++*strp; + else + errmsg = "Unexpected character, expected ','"; + } + + /* If that worked the next part is just another register. */ + if (errmsg == NULL) + errmsg = cgen_parse_keyword (cd, strp, &or1k_cgen_opval_h_gpr, + ®2_index); + + /* Validate the register pair is valid and create the output value. */ + if (errmsg == NULL) + { + int regoffset = reg2_index - reg1_index; + + if (regoffset == 1 || regoffset == 2) + { + unsigned short offsetmask; + unsigned short value; + + offsetmask = ((regoffset == 2 ? 1 : 0) << 5); + value = offsetmask | reg1_index; + + *valuep = value; + } + else + errmsg = "Invalid register pair, offset not 1 or 2."; + } + + return errmsg; +} + /* -- */ const char * or1k_cgen_parse_operand @@ -466,8 +516,14 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd, case OR1K_OPERAND_RA : errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_gpr, & fields->f_r2); break; + case OR1K_OPERAND_RAD32F : + errmsg = parse_regpair (cd, strp, OR1K_OPERAND_RAD32F, (unsigned long *) (& fields->f_rad32)); + break; case OR1K_OPERAND_RADF : - errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r1); + errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r2); + break; + case OR1K_OPERAND_RADI : + errmsg = parse_regpair (cd, strp, OR1K_OPERAND_RADI, (unsigned long *) (& fields->f_rad32)); break; case OR1K_OPERAND_RASF : errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fsr, & fields->f_r2); @@ -475,8 +531,14 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd, case OR1K_OPERAND_RB : errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_gpr, & fields->f_r3); break; + case OR1K_OPERAND_RBD32F : + errmsg = parse_regpair (cd, strp, OR1K_OPERAND_RBD32F, (unsigned long *) (& fields->f_rbd32)); + break; case OR1K_OPERAND_RBDF : - errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r1); + errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r3); + break; + case OR1K_OPERAND_RBDI : + errmsg = parse_regpair (cd, strp, OR1K_OPERAND_RBDI, (unsigned long *) (& fields->f_rbd32)); break; case OR1K_OPERAND_RBSF : errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fsr, & fields->f_r3); @@ -484,9 +546,15 @@ or1k_cgen_parse_operand (CGEN_CPU_DESC cd, case OR1K_OPERAND_RD : errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_gpr, & fields->f_r1); break; + case OR1K_OPERAND_RDD32F : + errmsg = parse_regpair (cd, strp, OR1K_OPERAND_RDD32F, (unsigned long *) (& fields->f_rdd32)); + break; case OR1K_OPERAND_RDDF : errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fdr, & fields->f_r1); break; + case OR1K_OPERAND_RDDI : + errmsg = parse_regpair (cd, strp, OR1K_OPERAND_RDDI, (unsigned long *) (& fields->f_rdd32)); + break; case OR1K_OPERAND_RDSF : errmsg = cgen_parse_keyword (cd, strp, & or1k_cgen_opval_h_fsr, & fields->f_r1); break; |