[PATCH] RISC-V : Support bitmanip-0.93 ZBA/ZBB/ZBC instructions

Jim Wilson jimw@sifive.com
Wed Feb 24 20:18:32 GMT 2021


On Wed, Feb 24, 2021 at 1:19 AM Jan Beulich <jbeulich@suse.com> wrote:

> I notice the xor vs xnor testsuite aspect pointed out in my
> post from Jan 18th was addressed, but the other questions
> remain:
>

We had to rewrite the patch from scratch due to a copyright assignment
problem.  So there could be no progress until we had the new patch.  The
new patch doesn't repeat the xor mistake in the original patch.

>
> For consistency with other insns taking immediate operands,
> shouldn't slli.uw one have a sll.uw alias?
>

Yes, that makes sense.  We can add that in a follow on patch.

>
> Also two perhaps more spec related questions: Why does slli.uw
> allow for 7-bit wide shamt? Any shift count 32 and up is not
> in need of this new insn, as slli will yield the same result.
> (I could see the need in RV128, where counts up to 95 would be
> needed, but right now talk is - I take it - mainly of RV32 and
> RV64.)
>

RV128 needs 7 bits for shift counts.  So we have to reserve 7 bits in the
encoding for future expansion.  slli.uw only uses 5 bits of that field.
slli.uw uses the same instruction format as other instructions that can use
the entire 7 bits of the shift count, which is why the field needs to be 7
bits.  This is done to reduce the number of instruction formats that need
to be decoded.  But a slli.uw with either of the upper 2 bits set should
probably be a reserved encoding.  Or maybe use a different encoding.  This
should be raised with the bitmanip committee.

>
> The current draft also doesn't say anything about hints; one
> could assume destination being x0 may get treated the same as
> in the base spec, but in the absence of this being said
> explicitly one could as well imply these are all simply
> sort-of-nop-s, or even illegal.
>

They are all nops.  And all hints use nop encodings.  A hint is supposed to
be executed as a nop, except when it is a hint.  This makes it safe to use
a hint anywhere.  Since it will be executed as a nop if the hardware
doesn't support the hint.  But this is another issue for the bitmanip
committee, whether the new nop encodings should be allowed to be used for
hints.

Jim


More information about the Binutils mailing list