4 ms·
> (Implicit destination followed by mov is free, because of register renaming.) There is no need for an implicit destination register, just do it explicitly an
by avianes 7y ago
> (Implicit destination followed by mov is free, because of register renaming.)
There is no need for an implicit destination register, just do it explicitly and you get the same result but without any magic and with more control.
Register renaming can do the same job with an implicit or explicit register destination, there is no incidence on register dependencies.
> r31 = (rx<=ry)? ~0:0
Reading your first post I know that you want to use 0 and ~0 instead of the traditional 0 and 1 as the result of condition statements.
I don't think that's a particularly great idea because:
- there are so many places where you need 1 instead of ~0;
- translating 1 into ~0 only costs one "SUB" instruction.
If this feature is required for a specific domain, it's sufficient to add an extension with this feature or - more drastically - to add a macro-operation fusion step to detect this pattern.
> Decoding the RISC-V compare-and-branch instruction is a whole project.
RISC-V encoding is made to keep decoding as simple as possible. Have you ever checked the RISC-V encoding?
It looks a bit confusing at the beginning to a human but if you think about the implementation, it immediately becomes clear.
In RISC-V ISA, we can criticize: the absence of a standard SIMD extension (with a big abstract vector extension instead) or the fact that some extensions require 3 read ports on the register bank instead of 2, which can make the implementation more complex.
But it's trade-offs
- ncmncm 7y agoWhere do you ever need 1 instead of -1? If you are using it to increment something, -1 is just as good. Storing a bool value in memory is rarely done, vs. using and discarding it. But in use, having a value to AND with, without need to dink around first, makes a big difference, particularly when cmov instructions are lacking. If the cost of negating before storing got to seem excessive, a single negate-and-store-word instruction could translate, but it would be used a very great deal less than negating the 1 to make a mask. However simple it looks to decode the thicket of compare-and-branch instructions, decoding and executing exactly one conditional branch instruction that just checks for zero will be simpler and faster. You still have the SET family to decode, but you need them anyway.