RISC-V: Compress 3-operand beq/bne against x0.
authorJim Wilson <jimw@sifive.com>
Fri, 8 Feb 2019 20:57:12 +0000 (12:57 -0800)
committerJim Wilson <jimw@sifive.com>
Fri, 8 Feb 2019 21:16:50 +0000 (13:16 -0800)
commitca0bc1509849a3871e99fdf48705b93f18d5fa7b
tree843a43250dfbfecb21abe4c3ba215e37544a9983
parent46cbf38dc3a7c6d0e339f95d56590711b06427a1
RISC-V: Compress 3-operand beq/bne against x0.

This lets us accept an instruction like
beq a2,x0,.Label
and generate a compressed beqz.  This will allow some future simplications
to the gcc support, e.g. eliminating some duplicate patterns, and avoiding
adding new duplicate patterns, since currently we have to handle signed
and equality compares against zero specially.

Tested with rv{32,64}-{elf,linux} cross builds and make checks for binutils
and gcc.  There were no regressions.

gas/
* config/tc-riscv.c (validate_riscv_insn) <'C'>: Add 'z' support.
(riscv_ip) <'C'>: Add 'z' support.
opcodes/
* riscv-opc.c (riscv_opcodes) <beq>: Use Cz to compress 3 operand form.
<bne>: Likewise.
gas/config/tc-riscv.c
opcodes/riscv-opc.c