diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td index 68e87f491a09..cb63d8726744 100644 --- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td +++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64InstrFormats.td @@ -2368,6 +2368,80 @@ class ClearAuth<bits<1> data, string asm> let Inst{4-0} = Rd; } +// v9.5-A FEAT_PAuth_LR + +class SignAuthFixedRegs<bits<5> opcode2, bits<6> opcode, string asm> + : I<(outs), (ins), asm, "", "", []>, + Sched<[WriteI, ReadI]> { + let Inst{31} = 0b1; // sf + let Inst{30} = 0b1; + let Inst{29} = 0b0; // S + let Inst{28-21} = 0b11010110; + let Inst{20-16} = opcode2; + let Inst{15-10} = opcode; + let Inst{9-5} = 0b11111; // Rn + let Inst{4-0} = 0b11110; // Rd +} + +def PAuthPCRelLabel16Operand : PCRelLabel<16> { + let Name = "PAuthPCRelLabel16"; + let PredicateMethod = "isPAuthPCRelLabel16Operand"; +} +def am_pauth_pcrel : Operand<OtherVT> { + let EncoderMethod = "getPAuthPCRelOpValue"; + let DecoderMethod = "DecodePCRelLabel16"; + let PrintMethod = "printAlignedLabel"; + let ParserMatchClass = PAuthPCRelLabel16Operand; + let OperandType = "OPERAND_PCREL"; +} + +class SignAuthPCRel<bits<2> opc, string asm> + : I<(outs), (ins am_pauth_pcrel:$label), asm, "\t$label", "", []>, + Sched<[]> { + bits<16> label; + let Inst{31} = 0b1; // sf + let Inst{30-23} = 0b11100111; + let Inst{22-21} = opc; + let Inst{20-5} = label; // imm + let Inst{4-0} = 0b11111; // Rd +} + +class SignAuthOneReg<bits<5> opcode2, bits<6> opcode, string asm> + : I<(outs), (ins GPR64:$Rn), asm, "\t$Rn", "", []>, + Sched<[]> { + bits<5> Rn; + let Inst{31} = 0b1; // sf + let Inst{30} = 0b1; + let Inst{29} = 0b0; // S + let Inst{28-21} = 0b11010110; + let Inst{20-16} = opcode2; + let Inst{15-10} = opcode; + let Inst{9-5} = Rn; + let Inst{4-0} = 0b11110; // Rd +} + +class SignAuthReturnPCRel<bits<3> opc, bits<5> op2, string asm> + : I<(outs), (ins am_pauth_pcrel:$label), asm, "\t$label", "", []>, + Sched<[WriteAtomic]> { + bits<16> label; + let Inst{31-24} = 0b01010101; + let Inst{23-21} = opc; + let Inst{20-5} = label; // imm16 + let Inst{4-0} = op2; +} + +class SignAuthReturnReg<bits<6> op3, string asm> + : I<(outs), (ins GPR64common:$Rm), asm, "\t$Rm", "", []>, + Sched<[WriteAtomic]> { + bits<5> Rm; + let Inst{31-25} = 0b1101011; + let Inst{24-21} = 0b0010; // opc + let Inst{20-16} = 0b11111; // op2 + let Inst{15-10} = op3; + let Inst{9-5} = 0b11111; // Rn + let Inst{4-0} = Rm; // op4 (Rm) +} + // Base class for the Armv8.4-A 8 and 16-bit flag manipulation instructions class BaseFlagManipulation<bit sf, bit sz, dag iops, string asm, string ops> : I<(outs), iops, asm, ops, "", []>, @@ -12446,6 +12520,58 @@ class SystemPXtI<bit L, string asm> : BaseSYSPEncoding<L, asm, "\t$op1, $Cn, $Cm, $op2, $Rt", (outs), (ins imm0_7:$op1, sys_cr_op:$Cn, sys_cr_op:$Cm, imm0_7:$op2, XSeqPairClassOperand:$Rt)>; +//---------------------------------------------------------------------------- +// 2023 Armv9.5 Extensions +//---------------------------------------------------------------------------- + +//--- +// Checked Pointer Arithmetic (FEAT_CPA) +//--- + +def LSLImm3ShiftOperand : AsmOperandClass { + let SuperClasses = [ExtendOperandLSL64]; + let Name = "LSLImm3Shift"; + let RenderMethod = "addLSLImm3ShifterOperands"; + let DiagnosticType = "AddSubLSLImm3ShiftLarge"; +} + +def lsl_imm3_shift_operand : Operand<i32> { + let PrintMethod = "printShifter"; + let ParserMatchClass = LSLImm3ShiftOperand; +} + +// Base CPA scalar add/subtract with lsl #imm3 shift +class BaseAddSubCPA<bit isSub, string asm> : I<(outs GPR64sp:$Rd), + (ins GPR64sp:$Rn, GPR64:$Rm, lsl_imm3_shift_operand:$shift_imm), + asm, "\t$Rd, $Rn, $Rm$shift_imm", "", []>, Sched<[]> { + bits<5> Rd; + bits<5> Rn; + bits<5> Rm; + bits<3> shift_imm; + let Inst{31} = 0b1; + let Inst{30} = isSub; + let Inst{29-21} = 0b011010000; + let Inst{20-16} = Rm; + let Inst{15-13} = 0b001; + let Inst{12-10} = shift_imm; + let Inst{9-5} = Rn; + let Inst{4-0} = Rd; +} + +// Alias for CPA scalar add/subtract with no shift +class AddSubCPAAlias<string asm, Instruction inst> + : InstAlias<asm#"\t$Rd, $Rn, $Rm", + (inst GPR64sp:$Rd, GPR64sp:$Rn, GPR64:$Rm, 0)>; + +multiclass AddSubCPA<bit isSub, string asm> { + def _shift : BaseAddSubCPA<isSub, asm>; + def _noshift : AddSubCPAAlias<asm, !cast<Instruction>(NAME#"_shift")>; +} + +class MulAccumCPA<bit isSub, string asm> + : BaseMulAccum<isSub, 0b011, GPR64, GPR64, asm, []>, Sched<[]> { + let Inst{31} = 0b1; +} //---------------------------------------------------------------------------- // Allow the size specifier tokens to be upper case, not just lower. |