summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64
diff options
context:
space:
mode:
authorSander de Smalen <sander.desmalen@arm.com>2018-07-18 08:10:03 +0000
committerSander de Smalen <sander.desmalen@arm.com>2018-07-18 08:10:03 +0000
commitac0cb5bf759232be291c0c110d143efd9678a16e (patch)
treef78a8bece07aaa3affcaf7b2a9a26c5087242c86 /llvm/lib/Target/AArch64
parent92ea7a7b4877f931770a2bf2c997db0d4bf8bf86 (diff)
downloadbcm5719-llvm-ac0cb5bf759232be291c0c110d143efd9678a16e.tar.gz
bcm5719-llvm-ac0cb5bf759232be291c0c110d143efd9678a16e.zip
[AArch64][SVE] Asm: Support for integer MUL instructions.
This patch adds the following instructions: MUL - multiply vectors, e.g. mul z0.h, p0/m, z0.h, z1.h - multiply with immediate, e.g. mul z0.h, z0.h, #127 SMULH - signed multiply returning high half, e.g. smulh z0.h, p0/m, z0.h, z1.h UMULH - unsigned multiply returning high half, e.g. umulh z0.h, p0/m, z0.h, z1.h llvm-svn: 337358
Diffstat (limited to 'llvm/lib/Target/AArch64')
-rw-r--r--llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td5
-rw-r--r--llvm/lib/Target/AArch64/SVEInstrFormats.td29
2 files changed, 26 insertions, 8 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index 42c3df3b9f3..52b19dd133a 100644
--- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -62,6 +62,11 @@ let Predicates = [HasSVE] in {
defm UMAX_ZI : sve_int_arith_imm1<0b01, "umax", imm0_255>;
defm UMIN_ZI : sve_int_arith_imm1<0b11, "umin", imm0_255>;
+ defm MUL_ZI : sve_int_arith_imm2<"mul">;
+ defm MUL_ZPmZ : sve_int_bin_pred_arit_2<0b000, "mul">;
+ defm SMULH_ZPmZ : sve_int_bin_pred_arit_2<0b010, "smulh">;
+ defm UMULH_ZPmZ : sve_int_bin_pred_arit_2<0b011, "umulh">;
+
defm SXTB_ZPmZ : sve_int_un_pred_arit_0_h<0b000, "sxtb">;
defm UXTB_ZPmZ : sve_int_un_pred_arit_0_h<0b001, "uxtb">;
defm SXTH_ZPmZ : sve_int_un_pred_arit_0_w<0b010, "sxth">;
diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td
index fced9d0d830..783d85c7c1a 100644
--- a/llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -1380,6 +1380,13 @@ multiclass sve_int_bin_pred_arit_1<bits<3> opc, string asm> {
def _D : sve_int_bin_pred_arit_log<0b11, 0b01, opc, asm, ZPR64>;
}
+multiclass sve_int_bin_pred_arit_2<bits<3> opc, string asm> {
+ def _B : sve_int_bin_pred_arit_log<0b00, 0b10, opc, asm, ZPR8>;
+ def _H : sve_int_bin_pred_arit_log<0b01, 0b10, opc, asm, ZPR16>;
+ def _S : sve_int_bin_pred_arit_log<0b10, 0b10, opc, asm, ZPR32>;
+ def _D : sve_int_bin_pred_arit_log<0b11, 0b10, opc, asm, ZPR64>;
+}
+
//===----------------------------------------------------------------------===//
// SVE Integer Multiply-Add Group
//===----------------------------------------------------------------------===//
@@ -1607,8 +1614,8 @@ multiclass sve_int_arith_imm0<bits<3> opc, string asm> {
def _D : sve_int_arith_imm0<0b11, opc, asm, ZPR64, addsub_imm8_opt_lsl_i64>;
}
-class sve_int_arith_imm1<bits<2> sz8_64, bits<2> opc, string asm,
- ZPRRegOp zprty, Operand immtype>
+class sve_int_arith_imm<bits<2> sz8_64, bits<6> opc, string asm,
+ ZPRRegOp zprty, Operand immtype>
: I<(outs zprty:$Zdn), (ins zprty:$_Zdn, immtype:$imm),
asm, "\t$Zdn, $_Zdn, $imm",
"",
@@ -1617,8 +1624,7 @@ class sve_int_arith_imm1<bits<2> sz8_64, bits<2> opc, string asm,
bits<8> imm;
let Inst{31-24} = 0b00100101;
let Inst{23-22} = sz8_64;
- let Inst{21-18} = 0b1010;
- let Inst{17-16} = opc;
+ let Inst{21-16} = opc;
let Inst{15-13} = 0b110;
let Inst{12-5} = imm;
let Inst{4-0} = Zdn;
@@ -1627,10 +1633,17 @@ class sve_int_arith_imm1<bits<2> sz8_64, bits<2> opc, string asm,
}
multiclass sve_int_arith_imm1<bits<2> opc, string asm, Operand immtype> {
- def _B : sve_int_arith_imm1<0b00, opc, asm, ZPR8, immtype>;
- def _H : sve_int_arith_imm1<0b01, opc, asm, ZPR16, immtype>;
- def _S : sve_int_arith_imm1<0b10, opc, asm, ZPR32, immtype>;
- def _D : sve_int_arith_imm1<0b11, opc, asm, ZPR64, immtype>;
+ def _B : sve_int_arith_imm<0b00, { 0b1010, opc }, asm, ZPR8, immtype>;
+ def _H : sve_int_arith_imm<0b01, { 0b1010, opc }, asm, ZPR16, immtype>;
+ def _S : sve_int_arith_imm<0b10, { 0b1010, opc }, asm, ZPR32, immtype>;
+ def _D : sve_int_arith_imm<0b11, { 0b1010, opc }, asm, ZPR64, immtype>;
+}
+
+multiclass sve_int_arith_imm2<string asm> {
+ def _B : sve_int_arith_imm<0b00, 0b110000, asm, ZPR8, simm8>;
+ def _H : sve_int_arith_imm<0b01, 0b110000, asm, ZPR16, simm8>;
+ def _S : sve_int_arith_imm<0b10, 0b110000, asm, ZPR32, simm8>;
+ def _D : sve_int_arith_imm<0b11, 0b110000, asm, ZPR64, simm8>;
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud