summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSander de Smalen <sander.desmalen@arm.com>2018-07-02 10:08:36 +0000
committerSander de Smalen <sander.desmalen@arm.com>2018-07-02 10:08:36 +0000
commit8d4c01a7020f77abf78a2a94f4216c09b87b0114 (patch)
tree5adb94aabb8ccd8495b2f82e5612d5acfb6241b1 /llvm/lib
parentc504101781ab2c1e94bec40c97f52834e41b6d3d (diff)
downloadbcm5719-llvm-8d4c01a7020f77abf78a2a94f4216c09b87b0114.tar.gz
bcm5719-llvm-8d4c01a7020f77abf78a2a94f4216c09b87b0114.zip
[AArch64][SVE] Asm: Support for (SQ)INCP/DECP (scalar, vector)
Increments/decrements the result with the number of active bits from the predicate. The inc/dec variants added are: - incp x0, p0.h (scalar) - incp z0.h, p0 (vector) The unsigned saturating inc/dec variants added are: - uqincp x0, p0.h (scalar) - uqincp w0, p0.h (scalar, 32bit) - uqincp z0.h, p0 (vector) The signed saturating inc/dec variants added are: - sqincp x0, p0.h (scalar) - sqincp x0, p0.h, w0 (scalar, 32bit) - sqincp z0.h, p0 (vector) llvm-svn: 336091
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td18
-rw-r--r--llvm/lib/Target/AArch64/SVEInstrFormats.td76
2 files changed, 94 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index 50a84a0e525..a764ac6543e 100644
--- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -593,6 +593,24 @@ let Predicates = [HasSVE] in {
defm INCD_ZPiI : sve_int_countvlv<0b11100, "incd", ZPR64>;
defm DECD_ZPiI : sve_int_countvlv<0b11101, "decd", ZPR64>;
+ defm SQINCP_XPWd : sve_int_count_r_s32<0b00000, "sqincp">;
+ defm SQINCP_XP : sve_int_count_r_x64<0b00010, "sqincp">;
+ defm UQINCP_WP : sve_int_count_r_u32<0b00100, "uqincp">;
+ defm UQINCP_XP : sve_int_count_r_x64<0b00110, "uqincp">;
+ defm SQDECP_XPWd : sve_int_count_r_s32<0b01000, "sqdecp">;
+ defm SQDECP_XP : sve_int_count_r_x64<0b01010, "sqdecp">;
+ defm UQDECP_WP : sve_int_count_r_u32<0b01100, "uqdecp">;
+ defm UQDECP_XP : sve_int_count_r_x64<0b01110, "uqdecp">;
+ defm INCP_XP : sve_int_count_r_x64<0b10000, "incp">;
+ defm DECP_XP : sve_int_count_r_x64<0b10100, "decp">;
+
+ defm SQINCP_ZP : sve_int_count_v<0b00000, "sqincp">;
+ defm UQINCP_ZP : sve_int_count_v<0b00100, "uqincp">;
+ defm SQDECP_ZP : sve_int_count_v<0b01000, "sqdecp">;
+ defm UQDECP_ZP : sve_int_count_v<0b01100, "uqdecp">;
+ defm INCP_ZP : sve_int_count_v<0b10000, "incp">;
+ defm DECP_ZP : sve_int_count_v<0b10100, "decp">;
+
defm INDEX_RR : sve_int_index_rr<"index">;
defm INDEX_IR : sve_int_index_ir<"index">;
defm INDEX_RI : sve_int_index_ri<"index">;
diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td
index 357ac8c8bc1..3700720fc7c 100644
--- a/llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -282,6 +282,82 @@ let Predicates = [HasSVE] in {
//===----------------------------------------------------------------------===//
+// SVE Predicate Count Group
+//===----------------------------------------------------------------------===//
+
+class sve_int_count_r<bits<2> sz8_64, bits<5> opc, string asm,
+ RegisterOperand dty, PPRRegOp pprty, RegisterOperand sty>
+: I<(outs dty:$Rdn), (ins pprty:$Pg, sty:$_Rdn),
+ asm, "\t$Rdn, $Pg",
+ "",
+ []>, Sched<[]> {
+ bits<5> Rdn;
+ bits<4> Pg;
+ let Inst{31-24} = 0b00100101;
+ let Inst{23-22} = sz8_64;
+ let Inst{21-19} = 0b101;
+ let Inst{18-16} = opc{4-2};
+ let Inst{15-11} = 0b10001;
+ let Inst{10-9} = opc{1-0};
+ let Inst{8-5} = Pg;
+ let Inst{4-0} = Rdn;
+
+ // Signed 32bit forms require their GPR operand printed.
+ let AsmString = !if(!eq(opc{4,2-0}, 0b0000),
+ !strconcat(asm, "\t$Rdn, $Pg, $_Rdn"),
+ !strconcat(asm, "\t$Rdn, $Pg"));
+ let Constraints = "$Rdn = $_Rdn";
+}
+
+multiclass sve_int_count_r_s32<bits<5> opc, string asm> {
+ def _B : sve_int_count_r<0b00, opc, asm, GPR64z, PPR8, GPR64as32>;
+ def _H : sve_int_count_r<0b01, opc, asm, GPR64z, PPR16, GPR64as32>;
+ def _S : sve_int_count_r<0b10, opc, asm, GPR64z, PPR32, GPR64as32>;
+ def _D : sve_int_count_r<0b11, opc, asm, GPR64z, PPR64, GPR64as32>;
+}
+
+multiclass sve_int_count_r_u32<bits<5> opc, string asm> {
+ def _B : sve_int_count_r<0b00, opc, asm, GPR32z, PPR8, GPR32z>;
+ def _H : sve_int_count_r<0b01, opc, asm, GPR32z, PPR16, GPR32z>;
+ def _S : sve_int_count_r<0b10, opc, asm, GPR32z, PPR32, GPR32z>;
+ def _D : sve_int_count_r<0b11, opc, asm, GPR32z, PPR64, GPR32z>;
+}
+
+multiclass sve_int_count_r_x64<bits<5> opc, string asm> {
+ def _B : sve_int_count_r<0b00, opc, asm, GPR64z, PPR8, GPR64z>;
+ def _H : sve_int_count_r<0b01, opc, asm, GPR64z, PPR16, GPR64z>;
+ def _S : sve_int_count_r<0b10, opc, asm, GPR64z, PPR32, GPR64z>;
+ def _D : sve_int_count_r<0b11, opc, asm, GPR64z, PPR64, GPR64z>;
+}
+
+class sve_int_count_v<bits<2> sz8_64, bits<5> opc, string asm,
+ ZPRRegOp zprty>
+: I<(outs zprty:$Zdn), (ins zprty:$_Zdn, PPRAny:$Pg),
+ asm, "\t$Zdn, $Pg",
+ "",
+ []>, Sched<[]> {
+ bits<4> Pg;
+ bits<5> Zdn;
+ let Inst{31-24} = 0b00100101;
+ let Inst{23-22} = sz8_64;
+ let Inst{21-19} = 0b101;
+ let Inst{18-16} = opc{4-2};
+ let Inst{15-11} = 0b10000;
+ let Inst{10-9} = opc{1-0};
+ let Inst{8-5} = Pg;
+ let Inst{4-0} = Zdn;
+
+ let Constraints = "$Zdn = $_Zdn";
+}
+
+multiclass sve_int_count_v<bits<5> opc, string asm> {
+ def _H : sve_int_count_v<0b01, opc, asm, ZPR16>;
+ def _S : sve_int_count_v<0b10, opc, asm, ZPR32>;
+ def _D : sve_int_count_v<0b11, opc, asm, ZPR64>;
+}
+
+
+//===----------------------------------------------------------------------===//
// SVE Element Count Group
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud