RISC-V: PR27436, make operand C> work the same as >.

gas/
    PR 27436
    * config/tc-riscv.c (riscv_ip): make operand C> work the same as >.
    * testsuite/gas/riscv/shamt-32.d: New testcase.
    * testsuite/gas/riscv/shamt-32.l: Likewise.
    * testsuite/gas/riscv/shamt-32.s: Likewise.
    * testsuite/gas/riscv/shamt-64.d: Likewise.
    * testsuite/gas/riscv/shamt-64.l: Likewise.
    * testsuite/gas/riscv/shamt-64.s: Likewise.
This commit is contained in:
Nelson Chu 2021-04-16 14:50:32 +08:00
parent a21b96dd66
commit 768589d180
8 changed files with 116 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2021-04-16 Nelson Chu <nelson.chu@sifive.com>
PR 27436
* config/tc-riscv.c (riscv_ip): make operand C> work the same as >.
* testsuite/gas/riscv/shamt-32.d: New testcase.
* testsuite/gas/riscv/shamt-32.l: Likewise.
* testsuite/gas/riscv/shamt-32.s: Likewise.
* testsuite/gas/riscv/shamt-64.d: Likewise.
* testsuite/gas/riscv/shamt-64.l: Likewise.
* testsuite/gas/riscv/shamt-64.s: Likewise.
2021-04-16 Lifang Xia <lifang_xia@c-sky.com>
* testsuite/gas/riscv/c-zero-imm.d: Compress addi a4,a4,0 to

View File

@ -2088,11 +2088,10 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
|| regno != 0)
break;
continue;
case '>':
case '>': /* Shift amount, 0 - (XLEN-1). */
if (my_getSmallExpression (imm_expr, imm_reloc, s, p)
|| imm_expr->X_op != O_constant
|| imm_expr->X_add_number <= 0
|| imm_expr->X_add_number >= 64)
|| (unsigned long) imm_expr->X_add_number >= xlen)
break;
ip->insn_opcode |= ENCODE_CITYPE_IMM (imm_expr->X_add_number);
rvc_imm_done:

View File

@ -0,0 +1,3 @@
#as: -march=rv32i
#objdump: -dr
#error_output: shamt-32.l

View File

@ -0,0 +1,13 @@
.*Assembler messages:
.*:4: Error: improper shift amount \(32\)
.*:5: Error: improper shift amount \(63\)
.*:9: Error: improper shift amount \(32\)
.*:10: Error: improper shift amount \(63\)
.*:14: Error: improper shift amount \(32\)
.*:15: Error: improper shift amount \(63\)
.*:20: Error: improper shift amount \(32\)
.*:21: Error: improper shift amount \(63\)
.*:25: Error: improper shift amount \(32\)
.*:26: Error: improper shift amount \(63\)
.*:30: Error: improper shift amount \(32\)
.*:31: Error: improper shift amount \(63\)

View File

@ -0,0 +1,31 @@
.option norvc
slli a0, a0, 0
slli a0, a0, 31
slli a0, a0, 32
slli a0, a0, 63
srli a0, a0, 0
srli a0, a0, 31
srli a0, a0, 32
srli a0, a0, 63
srai a0, a0, 0
srai a0, a0, 31
srai a0, a0, 32
srai a0, a0, 63
.option rvc
slli a0, a0, 0
slli a0, a0, 31
slli a0, a0, 32
slli a0, a0, 63
srli a0, a0, 0
srli a0, a0, 31
srli a0, a0, 32
srli a0, a0, 63
srai a0, a0, 0
srai a0, a0, 31
srai a0, a0, 32
srai a0, a0, 63

View File

@ -0,0 +1,3 @@
#as: -march=rv64i
#objdump: -dr
#error_output: shamt-64.l

View File

@ -0,0 +1,7 @@
.*Assembler messages:
.*:19: Error: improper shift amount \(32\)
.*:20: Error: improper shift amount \(63\)
.*:24: Error: improper shift amount \(32\)
.*:25: Error: improper shift amount \(63\)
.*:29: Error: improper shift amount \(32\)
.*:30: Error: improper shift amount \(63\)

View File

@ -0,0 +1,46 @@
.option norvc
slli a0, a0, 0
slli a0, a0, 31
slli a0, a0, 32
slli a0, a0, 63
srli a0, a0, 0
srli a0, a0, 31
srli a0, a0, 32
srli a0, a0, 63
srai a0, a0, 0
srai a0, a0, 31
srai a0, a0, 32
srai a0, a0, 63
slliw a0, a0, 0
slliw a0, a0, 31
slliw a0, a0, 32
slliw a0, a0, 63
srliw a0, a0, 0
srliw a0, a0, 31
srliw a0, a0, 32
srliw a0, a0, 63
sraiw a0, a0, 0
sraiw a0, a0, 31
sraiw a0, a0, 32
sraiw a0, a0, 63
.option rvc
slli a0, a0, 0
slli a0, a0, 31
slli a0, a0, 32
slli a0, a0, 63
srli a0, a0, 0
srli a0, a0, 31
srli a0, a0, 32
srli a0, a0, 63
srai a0, a0, 0
srai a0, a0, 31
srai a0, a0, 32
srai a0, a0, 63