diff options
| author | Sander de Smalen <sander.desmalen@arm.com> | 2018-07-27 13:58:48 +0000 |
|---|---|---|
| committer | Sander de Smalen <sander.desmalen@arm.com> | 2018-07-27 13:58:48 +0000 |
| commit | fcb636d2226747656d206fac5966b4f460883fd2 (patch) | |
| tree | 8713e64d1a8fa5f491ea81954ff51d86b7f833f2 /llvm/lib/Target | |
| parent | cb3eb30636c8d9136c8a01126963eded45617531 (diff) | |
| download | bcm5719-llvm-fcb636d2226747656d206fac5966b4f460883fd2.tar.gz bcm5719-llvm-fcb636d2226747656d206fac5966b4f460883fd2.zip | |
[AArch64][SVE] Asm: Predicated floating point reductions.
This patch adds support for various floating-point
reduction operations:
FADDA strictly-ordered add reduction, accumulating in scalar
FADDV recursive add reduction to scalar
FMAXV recursive max reduction to scalar
FMINV recursive min reduction to scalar
FMAXNMV recursive max number reduction to scalar
FMINNMV recursive min number reduction to scalar
The reduction is predicated, e.g.
fadda d0, p0, d0, z1.d
performs the add-reduction in strict order on active elements
in z1, accumulating into d0.
faddv d0, p0, z1.d
performs the add-reduction (not in strict order)
on active elements in z1, storing the result in d0.
llvm-svn: 338123
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td | 8 | ||||
| -rw-r--r-- | llvm/lib/Target/AArch64/SVEInstrFormats.td | 64 |
2 files changed, 71 insertions, 1 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td index 8ebe0cea234..12a669a0d05 100644 --- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -158,6 +158,14 @@ let Predicates = [HasSVE] in { defm FCMLA_ZZZI : sve_fp_fcmla_by_indexed_elem<"fcmla">; defm FMUL_ZZZI : sve_fp_fmul_by_indexed_elem<"fmul">; + // SVE floating point reductions. + defm FADDA_VPZ : sve_fp_2op_p_vd<0b000, "fadda">; + defm FADDV_VPZ : sve_fp_fast_red<0b000, "faddv">; + defm FMAXNMV_VPZ : sve_fp_fast_red<0b100, "fmaxnmv">; + defm FMINNMV_VPZ : sve_fp_fast_red<0b101, "fminnmv">; + defm FMAXV_VPZ : sve_fp_fast_red<0b110, "fmaxv">; + defm FMINV_VPZ : sve_fp_fast_red<0b111, "fminv">; + // Splat immediate (unpredicated) defm DUP_ZI : sve_int_dup_imm<"dup">; defm FDUP_ZI : sve_int_dup_fpimm<"fdup">; diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td index a82598c320d..92ab1e24d76 100644 --- a/llvm/lib/Target/AArch64/SVEInstrFormats.td +++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td @@ -2083,6 +2083,68 @@ multiclass sve_int_ucmp_vi<bits<2> opc, string asm> { //===----------------------------------------------------------------------===// +// SVE Floating Point Fast Reduction Group +//===----------------------------------------------------------------------===// + +class sve_fp_fast_red<bits<2> sz, bits<3> opc, string asm, + ZPRRegOp zprty, RegisterClass dstRegClass> +: I<(outs dstRegClass:$Vd), (ins PPR3bAny:$Pg, zprty:$Zn), + asm, "\t$Vd, $Pg, $Zn", + "", + []>, Sched<[]> { + bits<5> Zn; + bits<5> Vd; + bits<3> Pg; + let Inst{31-24} = 0b01100101; + let Inst{23-22} = sz; + let Inst{21-19} = 0b000; + let Inst{18-16} = opc; + let Inst{15-13} = 0b001; + let Inst{12-10} = Pg; + let Inst{9-5} = Zn; + let Inst{4-0} = Vd; +} + +multiclass sve_fp_fast_red<bits<3> opc, string asm> { + def _H : sve_fp_fast_red<0b01, opc, asm, ZPR16, FPR16>; + def _S : sve_fp_fast_red<0b10, opc, asm, ZPR32, FPR32>; + def _D : sve_fp_fast_red<0b11, opc, asm, ZPR64, FPR64>; +} + + +//===----------------------------------------------------------------------===// +// SVE Floating Point Accumulating Reduction Group +//===----------------------------------------------------------------------===// + +class sve_fp_2op_p_vd<bits<2> sz, bits<3> opc, string asm, + ZPRRegOp zprty, RegisterClass dstRegClass> +: I<(outs dstRegClass:$Vdn), (ins PPR3bAny:$Pg, dstRegClass:$_Vdn, zprty:$Zm), + asm, "\t$Vdn, $Pg, $_Vdn, $Zm", + "", + []>, + Sched<[]> { + bits<3> Pg; + bits<5> Vdn; + bits<5> Zm; + let Inst{31-24} = 0b01100101; + let Inst{23-22} = sz; + let Inst{21-19} = 0b011; + let Inst{18-16} = opc; + let Inst{15-13} = 0b001; + let Inst{12-10} = Pg; + let Inst{9-5} = Zm; + let Inst{4-0} = Vdn; + + let Constraints = "$Vdn = $_Vdn"; +} + +multiclass sve_fp_2op_p_vd<bits<3> opc, string asm> { + def _H : sve_fp_2op_p_vd<0b01, opc, asm, ZPR16, FPR16>; + def _S : sve_fp_2op_p_vd<0b10, opc, asm, ZPR32, FPR32>; + def _D : sve_fp_2op_p_vd<0b11, opc, asm, ZPR64, FPR64>; +} + +//===----------------------------------------------------------------------===// // SVE Floating Point Compare - Vectors Group //===----------------------------------------------------------------------===// @@ -4003,4 +4065,4 @@ class sve_int_bin_cons_misc_0_c<bits<8> opc, string asm, ZPRRegOp zprty> let Inst{10} = opc{0}; let Inst{9-5} = Zn; let Inst{4-0} = Zd; -}
\ No newline at end of file +} |

