You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This patch adds support for getting even-odd general purpose register
pairs into and out of inline assembly using the `Pr` constraint as
proposed in riscv-non-isa/riscv-c-api-doc#92
There are a few different pieces to this patch, each of which need their
own explanation.
Target-Independent Changes:
- This adds two new Machine Value Types (MVTs), which represent pairs for
each xlen. Two are needed because MVTs usually have a fixed length. This
change unfortunately increases the size of SelectionDAG tables indexed
by MVT by a small percentage.
- When an inline assembly block returns multiple values, it returns them
in a struct, rather than as a single value. This fixes TargetLowering
so that `getAsmOperandValueType` is called on the types in that
struct, so that targets have the opportunity to propose their own MVT
for an inline assembly operand where this wouldn't match conventional
arguments/return values. This matches what happens when a single value
is returned.
RISC-V Changes:
- Renames the Register Class used for f64 values on rv32i_zdinx from
`GPRPair*` to `GPRF64Pair*`. These register classes are kept broadly
unmodified, as their primary value type is used for type inference
over selection patterns. This rename affects quite a lot of files. I
reordered the definitions in RISCVRegisterInfo.td and added headings
to make it easier to browse.
- Adds new `GPRPair*` register classes which will be used for `Pr`
constraints and for instructions that need an even-odd GPR pair. This
new type is used for `amocas.d.*`(rv32) and `amocas.q.*`(rv64) in
Zacas, instead of the `GPRF64Pair` class being used before.
- Marks the new `GPRPair` class legal as for holding a
`MVT::riscv_i<xlen>_pair`. Two new RISCVISD node types are added for
creating and destructing a pair - `BuildGPRPair` and `SplitGPRPair`,
and are introduced when bitcasting to/from the pair type and the
`i<2*xlen>` type.
- This adds an override for `getNumRegisters` to ensure that `i<2*xlen>`
values, when going to/from inline assembly, only allocate one (pair)
register (they would otherwise allocate two).
- Ensures that the DAGCombiner doesn't merge the `bitcast` between
`i<2*xlen>` types and the pair type into a load/store, as we want to
legalise these 2*xlen-wide loads/stores as before - by splitting them
into two xlen-wide loads/stores, which will happen with `i<2*xlen>`
types.
- Ensures that Clang understands that `Pr` is a valid inline assembly
constraint.
0 commit comments