Changeset View
Standalone View
llvm/lib/Target/RISCV/RISCVInstrInfo.td
Show First 20 Lines • Show All 1,183 Lines • ▼ Show 20 Lines | class SwapSysReg<SysReg SR, list<Register> Regs> | ||||
: Pseudo<(outs GPR:$rd), (ins GPR:$val), | : Pseudo<(outs GPR:$rd), (ins GPR:$val), | ||||
[(set GPR:$rd, (riscv_swap_csr (XLenVT SR.Encoding), GPR:$val))]>, | [(set GPR:$rd, (riscv_swap_csr (XLenVT SR.Encoding), GPR:$val))]>, | ||||
PseudoInstExpansion<(CSRRW GPR:$rd, SR.Encoding, GPR:$val)> { | PseudoInstExpansion<(CSRRW GPR:$rd, SR.Encoding, GPR:$val)> { | ||||
let hasSideEffects = 0; | let hasSideEffects = 0; | ||||
let Uses = Regs; | let Uses = Regs; | ||||
let Defs = Regs; | let Defs = Regs; | ||||
} | } | ||||
class SwapSysRegImm<SysReg SR, list<Register> Regs> | class SwapSysRegImm<SysReg SR, list<Register> Regs> | ||||
craig.topper: Should we use the names of the mnemonics that are defined for these operations? Though I guess… | |||||
Did you mean frrm and fsrm? Name like Read* are more readable. Besides it seems there are no advantages of having codegen pseudos named identically to corresponding instruction aliases. And you are right, Write* and Swap* correspond to the same mnemonic. sepavloff: Did you mean `frrm` and `fsrm`? Name like `Read*` are more readable. Besides it seems there are… | |||||
: Pseudo<(outs GPR:$rd), (ins uimm5:$val), | : Pseudo<(outs GPR:$rd), (ins uimm5:$val), | ||||
[(set GPR:$rd, (riscv_swap_csr (XLenVT SR.Encoding), uimm5:$val))]>, | [(set GPR:$rd, (riscv_swap_csr (XLenVT SR.Encoding), uimm5:$val))]>, | ||||
PseudoInstExpansion<(CSRRWI GPR:$rd, SR.Encoding, uimm5:$val)> { | PseudoInstExpansion<(CSRRWI GPR:$rd, SR.Encoding, uimm5:$val)> { | ||||
let hasSideEffects = 0; | let hasSideEffects = 0; | ||||
let Uses = Regs; | let Uses = Regs; | ||||
let Defs = Regs; | let Defs = Regs; | ||||
} | } | ||||
def ReadFRM : ReadSysReg<SysRegFRM, [FRM]>; | |||||
Not Done ReplyInline ActionsDo we have use cases for all of these? craig.topper: Do we have use cases for all of these? | |||||
ReadFRM is used in the implementation of FLT_ROUNDS_ (D90854). int old_rm = fegetround(); fesetround(new_rm); ... fesetround(old_rm); which is likely to be used in the implementation of #pragma STDC FENV_ROUND. Operations with FFLAGS are not used now. They would be needed to implement functions like fetestexcept and similar, but now there are no such attempts AFAIK. Operations would be needed for target specific implementation of intrinsics that access FP control modes (D82525) and FP environment (D71742). sepavloff: `ReadFRM` is used in the implementation of FLT_ROUNDS_ (D90854).
`WriteFRM` and `WrireFRMImm`… | |||||
sepavloff: > Operations would be needed for target specific implementation of intrinsics that access FP… | |||||
Not Done ReplyInline ActionsI don't think we want unused pseudos that might be used someday. We should include them when they're needed. craig.topper: I don't think we want unused pseudos that might be used someday. We should include them when… | |||||
def WriteFRM : WriteSysReg<SysRegFRM, [FRM]>; | |||||
def WriteFRMImm : WriteSysRegImm<SysRegFRM, [FRM]>; | |||||
/// Other pseudo-instructions | /// Other pseudo-instructions | ||||
// Pessimistically assume the stack pointer will be clobbered | // Pessimistically assume the stack pointer will be clobbered | ||||
let Defs = [X2], Uses = [X2] in { | let Defs = [X2], Uses = [X2] in { | ||||
def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2), | def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2), | ||||
[(callseq_start timm:$amt1, timm:$amt2)]>; | [(callseq_start timm:$amt1, timm:$amt2)]>; | ||||
def ADJCALLSTACKUP : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2), | def ADJCALLSTACKUP : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2), | ||||
[(callseq_end timm:$amt1, timm:$amt2)]>; | [(callseq_end timm:$amt1, timm:$amt2)]>; | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |
Should we use the names of the mnemonics that are defined for these operations? Though I guess there's no name defined for "write" just for swap and read.