diff options
author | Sander de Smalen <sander.desmalen@arm.com> | 2018-04-10 07:01:53 +0000 |
---|---|---|
committer | Sander de Smalen <sander.desmalen@arm.com> | 2018-04-10 07:01:53 +0000 |
commit | 30fda45c18c0424b28f1b901a15c12a148aadc46 (patch) | |
tree | e1b3b2bd588ddadbb30994adfbf44d4f466244e0 /llvm/lib | |
parent | 0ca3bd07296cd19d49b52e0b47232786ee4196dd (diff) | |
download | bcm5719-llvm-30fda45c18c0424b28f1b901a15c12a148aadc46.tar.gz bcm5719-llvm-30fda45c18c0424b28f1b901a15c12a148aadc46.zip |
[AArch64][SVE] Asm: Add support for SVE INDEX instructions.
Reviewers: rengolin, fhahn, javed.absar, SjoerdMeijer, huntergr, t.p.northover, echristo, evandro
Reviewed By: rengolin, fhahn
Subscribers: tschuett, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D45370
llvm-svn: 329674
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64InstrFormats.td | 11 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td | 5 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/SVEInstrFormats.td | 101 |
4 files changed, 120 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td index e1dcd1b7465..a1b34379b5b 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td +++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td @@ -247,6 +247,17 @@ def simm6_32b : Operand<i32>, ImmLeaf<i32, [{ return Imm >= -32 && Imm < 32; }]> let DecoderMethod = "DecodeSImm<6>"; } +def SImm5Operand : SImmOperand<5>; +def simm5_64b : Operand<i64>, ImmLeaf<i64, [{ return Imm >= -16 && Imm < 16; }]> { + let ParserMatchClass = SImm5Operand; + let DecoderMethod = "DecodeSImm<5>"; +} + +def simm5_32b : Operand<i32>, ImmLeaf<i32, [{ return Imm >= -16 && Imm < 16; }]> { + let ParserMatchClass = SImm5Operand; + let DecoderMethod = "DecodeSImm<5>"; +} + // simm7sN predicate - True if the immediate is a multiple of N in the range // [-64 * N, 63 * N]. class SImm7Scaled<int Scale> : AsmOperandClass { diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td index 07cd15485a4..cf42a409c97 100644 --- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -31,4 +31,9 @@ let Predicates = [HasSVE] in { def RDVLI_XI : sve_int_read_vl_a<0b0, 0b11111, "rdvl">; def ADDVL_XXI : sve_int_arith_vl<0b0, "addvl">; def ADDPL_XXI : sve_int_arith_vl<0b1, "addpl">; + + defm INDEX_RR : sve_int_index_rr<"index">; + defm INDEX_IR : sve_int_index_ir<"index">; + defm INDEX_RI : sve_int_index_ri<"index">; + defm INDEX_II : sve_int_index_ii<"index">; } diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index 69b465478c9..f2e4d79daba 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -3537,6 +3537,8 @@ bool AArch64AsmParser::showMatchError(SMLoc Loc, unsigned ErrCode, "expected compatible register or floating-point constant"); case Match_InvalidMemoryIndexedSImm6: return Error(Loc, "index must be an integer in range [-32, 31]."); + case Match_InvalidMemoryIndexedSImm5: + return Error(Loc, "index must be an integer in range [-16, 15]."); case Match_InvalidMemoryIndexedSImm9: return Error(Loc, "index must be an integer in range [-256, 255]."); case Match_InvalidMemoryIndexedSImm10: @@ -4055,6 +4057,7 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, case Match_InvalidMemoryIndexed4SImm7: case Match_InvalidMemoryIndexed8SImm7: case Match_InvalidMemoryIndexed16SImm7: + case Match_InvalidMemoryIndexedSImm5: case Match_InvalidMemoryIndexedSImm9: case Match_InvalidMemoryIndexedSImm10: case Match_InvalidImm0_1: diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td index c7d6628de44..9e47a29bb8e 100644 --- a/llvm/lib/Target/AArch64/SVEInstrFormats.td +++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td @@ -338,6 +338,107 @@ multiclass sve_int_bin_pred_arit_0<bits<3> opc, string asm> { def _D : sve_int_bin_pred_arit_log<0b11, 0b00, opc, asm, ZPR64>; } + +//===----------------------------------------------------------------------===// +//SVE Index Generation Group +//===----------------------------------------------------------------------===// + +class sve_int_index_ii<bits<2> sz8_64, string asm, ZPRRegOp zprty, + Operand imm_ty> +: I<(outs zprty:$Zd), (ins imm_ty:$imm5, imm_ty:$imm5b), + asm, "\t$Zd, $imm5, $imm5b", + "", []>, Sched<[]> { + bits<5> Zd; + bits<5> imm5; + bits<5> imm5b; + let Inst{31-24} = 0b00000100; + let Inst{23-22} = sz8_64; + let Inst{21} = 0b1; + let Inst{20-16} = imm5b; + let Inst{15-10} = 0b010000; + let Inst{9-5} = imm5; + let Inst{4-0} = Zd; +} + +multiclass sve_int_index_ii<string asm> { + def _B : sve_int_index_ii<0b00, asm, ZPR8, simm5_32b>; + def _H : sve_int_index_ii<0b01, asm, ZPR16, simm5_32b>; + def _S : sve_int_index_ii<0b10, asm, ZPR32, simm5_32b>; + def _D : sve_int_index_ii<0b11, asm, ZPR64, simm5_64b>; +} + +class sve_int_index_ir<bits<2> sz8_64, string asm, ZPRRegOp zprty, + RegisterClass srcRegType, Operand imm_ty> +: I<(outs zprty:$Zd), (ins imm_ty:$imm5, srcRegType:$Rm), + asm, "\t$Zd, $imm5, $Rm", + "", []>, Sched<[]> { + bits<5> Rm; + bits<5> Zd; + bits<5> imm5; + let Inst{31-24} = 0b00000100; + let Inst{23-22} = sz8_64; + let Inst{21} = 0b1; + let Inst{20-16} = Rm; + let Inst{15-10} = 0b010010; + let Inst{9-5} = imm5; + let Inst{4-0} = Zd; +} + +multiclass sve_int_index_ir<string asm> { + def _B : sve_int_index_ir<0b00, asm, ZPR8, GPR32, simm5_32b>; + def _H : sve_int_index_ir<0b01, asm, ZPR16, GPR32, simm5_32b>; + def _S : sve_int_index_ir<0b10, asm, ZPR32, GPR32, simm5_32b>; + def _D : sve_int_index_ir<0b11, asm, ZPR64, GPR64, simm5_64b>; +} + +class sve_int_index_ri<bits<2> sz8_64, string asm, ZPRRegOp zprty, + RegisterClass srcRegType, Operand imm_ty> +: I<(outs zprty:$Zd), (ins srcRegType:$Rn, imm_ty:$imm5), + asm, "\t$Zd, $Rn, $imm5", + "", []>, Sched<[]> { + bits<5> Rn; + bits<5> Zd; + bits<5> imm5; + let Inst{31-24} = 0b00000100; + let Inst{23-22} = sz8_64; + let Inst{21} = 0b1; + let Inst{20-16} = imm5; + let Inst{15-10} = 0b010001; + let Inst{9-5} = Rn; + let Inst{4-0} = Zd; +} + +multiclass sve_int_index_ri<string asm> { + def _B : sve_int_index_ri<0b00, asm, ZPR8, GPR32, simm5_32b>; + def _H : sve_int_index_ri<0b01, asm, ZPR16, GPR32, simm5_32b>; + def _S : sve_int_index_ri<0b10, asm, ZPR32, GPR32, simm5_32b>; + def _D : sve_int_index_ri<0b11, asm, ZPR64, GPR64, simm5_64b>; +} + +class sve_int_index_rr<bits<2> sz8_64, string asm, ZPRRegOp zprty, + RegisterClass srcRegType> +: I<(outs zprty:$Zd), (ins srcRegType:$Rn, srcRegType:$Rm), + asm, "\t$Zd, $Rn, $Rm", + "", []>, Sched<[]> { + bits<5> Zd; + bits<5> Rm; + bits<5> Rn; + let Inst{31-24} = 0b00000100; + let Inst{23-22} = sz8_64; + let Inst{21} = 0b1; + let Inst{20-16} = Rm; + let Inst{15-10} = 0b010011; + let Inst{9-5} = Rn; + let Inst{4-0} = Zd; +} + +multiclass sve_int_index_rr<string asm> { + def _B : sve_int_index_rr<0b00, asm, ZPR8, GPR32>; + def _H : sve_int_index_rr<0b01, asm, ZPR16, GPR32>; + def _S : sve_int_index_rr<0b10, asm, ZPR32, GPR32>; + def _D : sve_int_index_rr<0b11, asm, ZPR64, GPR64>; +} + //===----------------------------------------------------------------------===// // SVE Permute - Predicates Group //===----------------------------------------------------------------------===// |