diff options
| author | Sander de Smalen <sander.desmalen@arm.com> | 2018-07-11 10:08:00 +0000 |
|---|---|---|
| committer | Sander de Smalen <sander.desmalen@arm.com> | 2018-07-11 10:08:00 +0000 |
| commit | a90530f7c108afc61af9b1d4c57d8fe62cf25908 (patch) | |
| tree | 36423d87f07deadc58f165c50bdee71ca58fcb0a /llvm/lib/Target | |
| parent | b98f504850123e345d0470cb0bfec67eb6e7a679 (diff) | |
| download | bcm5719-llvm-a90530f7c108afc61af9b1d4c57d8fe62cf25908.tar.gz bcm5719-llvm-a90530f7c108afc61af9b1d4c57d8fe62cf25908.zip | |
[AArch64][SVE] Asm: Support for LAST(A|B) and CLAST(A|B) instructions.
The LASTB and LASTA instructions extract the last active element,
or element after the last active, from the source vector.
The added variants are:
Scalar:
last(a|b) w0, p0, z0.b
last(a|b) w0, p0, z0.h
last(a|b) w0, p0, z0.s
last(a|b) x0, p0, z0.d
SIMD & FP Scalar:
last(a|b) b0, p0, z0.b
last(a|b) h0, p0, z0.h
last(a|b) s0, p0, z0.s
last(a|b) d0, p0, z0.d
The CLASTB and CLASTA conditionally extract the last or element after
the last active element from the source vector.
The added variants are:
Scalar:
clast(a|b) w0, p0, w0, z0.b
clast(a|b) w0, p0, w0, z0.h
clast(a|b) w0, p0, w0, z0.s
clast(a|b) x0, p0, x0, z0.d
SIMD & FP Scalar:
clast(a|b) b0, p0, b0, z0.b
clast(a|b) h0, p0, h0, z0.h
clast(a|b) s0, p0, s0, z0.s
clast(a|b) d0, p0, d0, z0.d
Vector:
clast(a|b) z0.b, p0, z0.b, z1.b
clast(a|b) z0.h, p0, z0.h, z1.h
clast(a|b) z0.s, p0, z0.s, z1.s
clast(a|b) z0.d, p0, z0.d, z1.d
Please refer to the architecture specification for more details on
the semantics of the added instructions.
llvm-svn: 336783
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td | 12 | ||||
| -rw-r--r-- | llvm/lib/Target/AArch64/SVEInstrFormats.td | 136 |
2 files changed, 148 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td index 6ae55aa51bb..d747d76fab5 100644 --- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -128,6 +128,18 @@ let Predicates = [HasSVE] in { def NORS_PPzPP : sve_int_pred_log<0b1110, "nors">; def NANDS_PPzPP : sve_int_pred_log<0b1111, "nands">; + defm CLASTA_RPZ : sve_int_perm_clast_rz<0, "clasta">; + defm CLASTB_RPZ : sve_int_perm_clast_rz<1, "clastb">; + defm CLASTA_VPZ : sve_int_perm_clast_vz<0, "clasta">; + defm CLASTB_VPZ : sve_int_perm_clast_vz<1, "clastb">; + defm CLASTA_ZPZ : sve_int_perm_clast_zz<0, "clasta">; + defm CLASTB_ZPZ : sve_int_perm_clast_zz<1, "clastb">; + + defm LASTA_RPZ : sve_int_perm_last_r<0, "lasta">; + defm LASTB_RPZ : sve_int_perm_last_r<1, "lastb">; + defm LASTA_VPZ : sve_int_perm_last_v<0, "lasta">; + defm LASTB_VPZ : sve_int_perm_last_v<1, "lastb">; + // continuous load with reg+immediate defm LD1B_IMM : sve_mem_cld_si<0b0000, "ld1b", Z_b, ZPR8>; defm LD1B_H_IMM : sve_mem_cld_si<0b0001, "ld1b", Z_h, ZPR16>; diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td index b3f71376421..b8e67f6ab04 100644 --- a/llvm/lib/Target/AArch64/SVEInstrFormats.td +++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td @@ -2368,6 +2368,142 @@ class sve_int_setffr<string asm> // SVE Permute Vector - Predicated Group //===----------------------------------------------------------------------===// +class sve_int_perm_clast_rz<bits<2> sz8_64, bit ab, string asm, + ZPRRegOp zprty, RegisterClass rt> +: I<(outs rt:$Rdn), (ins PPR3bAny:$Pg, rt:$_Rdn, zprty:$Zm), + asm, "\t$Rdn, $Pg, $_Rdn, $Zm", + "", + []>, Sched<[]> { + bits<3> Pg; + bits<5> Rdn; + bits<5> Zm; + let Inst{31-24} = 0b00000101; + let Inst{23-22} = sz8_64; + let Inst{21-17} = 0b11000; + let Inst{16} = ab; + let Inst{15-13} = 0b101; + let Inst{12-10} = Pg; + let Inst{9-5} = Zm; + let Inst{4-0} = Rdn; + + let Constraints = "$Rdn = $_Rdn"; +} + +multiclass sve_int_perm_clast_rz<bit ab, string asm> { + def _B : sve_int_perm_clast_rz<0b00, ab, asm, ZPR8, GPR32>; + def _H : sve_int_perm_clast_rz<0b01, ab, asm, ZPR16, GPR32>; + def _S : sve_int_perm_clast_rz<0b10, ab, asm, ZPR32, GPR32>; + def _D : sve_int_perm_clast_rz<0b11, ab, asm, ZPR64, GPR64>; +} + +class sve_int_perm_clast_vz<bits<2> sz8_64, bit ab, string asm, + ZPRRegOp zprty, RegisterClass rt> +: I<(outs rt:$Vdn), (ins PPR3bAny:$Pg, rt:$_Vdn, zprty:$Zm), + asm, "\t$Vdn, $Pg, $_Vdn, $Zm", + "", + []>, Sched<[]> { + bits<3> Pg; + bits<5> Vdn; + bits<5> Zm; + let Inst{31-24} = 0b00000101; + let Inst{23-22} = sz8_64; + let Inst{21-17} = 0b10101; + let Inst{16} = ab; + let Inst{15-13} = 0b100; + let Inst{12-10} = Pg; + let Inst{9-5} = Zm; + let Inst{4-0} = Vdn; + + let Constraints = "$Vdn = $_Vdn"; +} + +multiclass sve_int_perm_clast_vz<bit ab, string asm> { + def _B : sve_int_perm_clast_vz<0b00, ab, asm, ZPR8, FPR8>; + def _H : sve_int_perm_clast_vz<0b01, ab, asm, ZPR16, FPR16>; + def _S : sve_int_perm_clast_vz<0b10, ab, asm, ZPR32, FPR32>; + def _D : sve_int_perm_clast_vz<0b11, ab, asm, ZPR64, FPR64>; +} + +class sve_int_perm_clast_zz<bits<2> sz8_64, bit ab, string asm, + ZPRRegOp zprty> +: I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm), + asm, "\t$Zdn, $Pg, $_Zdn, $Zm", + "", + []>, Sched<[]> { + bits<3> Pg; + bits<5> Zdn; + bits<5> Zm; + let Inst{31-24} = 0b00000101; + let Inst{23-22} = sz8_64; + let Inst{21-17} = 0b10100; + let Inst{16} = ab; + let Inst{15-13} = 0b100; + let Inst{12-10} = Pg; + let Inst{9-5} = Zm; + let Inst{4-0} = Zdn; + + let Constraints = "$Zdn = $_Zdn"; +} + +multiclass sve_int_perm_clast_zz<bit ab, string asm> { + def _B : sve_int_perm_clast_zz<0b00, ab, asm, ZPR8>; + def _H : sve_int_perm_clast_zz<0b01, ab, asm, ZPR16>; + def _S : sve_int_perm_clast_zz<0b10, ab, asm, ZPR32>; + def _D : sve_int_perm_clast_zz<0b11, ab, asm, ZPR64>; +} + +class sve_int_perm_last_r<bits<2> sz8_64, bit ab, string asm, + ZPRRegOp zprty, RegisterClass resultRegType> +: I<(outs resultRegType:$Rd), (ins PPR3bAny:$Pg, zprty:$Zn), + asm, "\t$Rd, $Pg, $Zn", + "", + []>, Sched<[]> { + bits<3> Pg; + bits<5> Rd; + bits<5> Zn; + let Inst{31-24} = 0b00000101; + let Inst{23-22} = sz8_64; + let Inst{21-17} = 0b10000; + let Inst{16} = ab; + let Inst{15-13} = 0b101; + let Inst{12-10} = Pg; + let Inst{9-5} = Zn; + let Inst{4-0} = Rd; +} + +multiclass sve_int_perm_last_r<bit ab, string asm> { + def _B : sve_int_perm_last_r<0b00, ab, asm, ZPR8, GPR32>; + def _H : sve_int_perm_last_r<0b01, ab, asm, ZPR16, GPR32>; + def _S : sve_int_perm_last_r<0b10, ab, asm, ZPR32, GPR32>; + def _D : sve_int_perm_last_r<0b11, ab, asm, ZPR64, GPR64>; +} + +class sve_int_perm_last_v<bits<2> sz8_64, bit ab, string asm, + ZPRRegOp zprty, RegisterClass dstRegtype> +: I<(outs dstRegtype:$Vd), (ins PPR3bAny:$Pg, zprty:$Zn), + asm, "\t$Vd, $Pg, $Zn", + "", + []>, Sched<[]> { + bits<3> Pg; + bits<5> Vd; + bits<5> Zn; + let Inst{31-24} = 0b00000101; + let Inst{23-22} = sz8_64; + let Inst{21-17} = 0b10001; + let Inst{16} = ab; + let Inst{15-13} = 0b100; + let Inst{12-10} = Pg; + let Inst{9-5} = Zn; + let Inst{4-0} = Vd; +} + +multiclass sve_int_perm_last_v<bit ab, string asm> { + def _B : sve_int_perm_last_v<0b00, ab, asm, ZPR8, FPR8>; + def _H : sve_int_perm_last_v<0b01, ab, asm, ZPR16, FPR16>; + def _S : sve_int_perm_last_v<0b10, ab, asm, ZPR32, FPR32>; + def _D : sve_int_perm_last_v<0b11, ab, asm, ZPR64, FPR64>; +} + class sve_int_perm_cpy_r<bits<2> sz8_64, string asm, ZPRRegOp zprty, RegisterClass srcRegType> : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, srcRegType:$Rn), |

