Re: [Qemu-devel] [RFC v1 09/23] riscv: tcg-target: Add the immediate encoders

2018-11-16 Thread Richard Henderson
On 11/15/18 11:35 PM, Alistair Francis wrote: > +static int32_t encode_simm12(uint32_t imm) > +{ > +return ((imm << 20) >> 25) << 25 | ((imm << 27) >> 27) << 7; > +} I'm not fond of triple shifts like this, as it makes me count. I'd be ok with a formulation like return ((imm & 0x1f) << 7)

[Qemu-devel] [RFC v1 09/23] riscv: tcg-target: Add the immediate encoders

2018-11-15 Thread Alistair Francis
Signed-off-by: Alistair Francis Signed-off-by: Michael Clark --- tcg/riscv/tcg-target.inc.c | 81 ++ 1 file changed, 81 insertions(+) diff --git a/tcg/riscv/tcg-target.inc.c b/tcg/riscv/tcg-target.inc.c index e585740870..5319f7ade5 100644 --- a/tcg/riscv/tcg-