[llvm] 7ce2b93 - [VE] Add vector iterative operation instructions
Kazushi Marukawa via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 28 03:06:55 PDT 2020
Author: Kazushi (Jam) Marukawa
Date: 2020-10-28T19:06:46+09:00
New Revision: 7ce2b93cbe152b3047de963b7c32277e1a567d03
URL: https://github.com/llvm/llvm-project/commit/7ce2b93cbe152b3047de963b7c32277e1a567d03
DIFF: https://github.com/llvm/llvm-project/commit/7ce2b93cbe152b3047de963b7c32277e1a567d03.diff
LOG: [VE] Add vector iterative operation instructions
Add VFIA/VFIS/VFIM/VFIAM/VFISM/VFIMA/VFIMS isntructions.
Add regression tests too.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D90252
Added:
llvm/test/MC/VE/VFIA.s
llvm/test/MC/VE/VFIAM.s
llvm/test/MC/VE/VFIM.s
llvm/test/MC/VE/VFIMA.s
llvm/test/MC/VE/VFIMS.s
llvm/test/MC/VE/VFIS.s
llvm/test/MC/VE/VFISM.s
Modified:
llvm/lib/Target/VE/VEInstrVec.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/VE/VEInstrVec.td b/llvm/lib/Target/VE/VEInstrVec.td
index e715a50ae274..d5ca34c6ce1a 100644
--- a/llvm/lib/Target/VE/VEInstrVec.td
+++ b/llvm/lib/Target/VE/VEInstrVec.td
@@ -601,6 +601,49 @@ multiclass RVFIXm<string opcStr, bits<8> opc, RegisterClass RC,
let cy = 0, sy = 0, vy = ?, vz = ? in
defm v : RVmm<opcStr#"$vz", ", $vy", opc, RC, RCM, (ins RDOp:$vz, RC:$vy)>;
}
+// Multiclass for generic iterative vector calculation
+let vx = ?, hasSideEffects = 0, Uses = [VL] in
+multiclass RVIbm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
+ dag dag_in, string disEnc = ""> {
+ let DisableEncoding = disEnc in
+ def "" : RV<opc, (outs RC:$vx), dag_in,
+ !strconcat(opcStr, " $vx", argStr)>;
+ let isCodeGenOnly = 1, Constraints = "$vx = $base", DisableEncoding = disEnc#"$base" in
+ def _v : RV<opc, (outs RC:$vx), !con(dag_in, (ins RC:$base)),
+ !strconcat(opcStr, " $vx", argStr)>;
+}
+multiclass RVIlm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
+ dag dag_in> {
+ defm "" : RVIbm<opcStr, argStr, opc, RC, dag_in>;
+ let isCodeGenOnly = 1, VE_VLInUse = 1 in {
+ defm l : RVIbm<opcStr, argStr, opc, RC, !con(dag_in, (ins I32:$vl)),
+ "$vl,">;
+ defm L : RVIbm<opcStr, argStr, opc, RC, !con(dag_in, (ins VLS:$vl)),
+ "$vl,">;
+ }
+}
+// Generic RV multiclass for iterative operation with 2 argument.
+// e.g. VFIA, VFIS, and VFIM
+let VE_VLIndex = 3 in
+multiclass RVI2m<string opcStr, bits<8>opc, RegisterClass VRC,
+ RegisterClass RC> {
+ let vy = ? in
+ defm vr : RVIlm<opcStr, ", $vy, $sy", opc, VRC, (ins VRC:$vy, RC:$sy)>;
+ let cy = 0, vy = ? in
+ defm vi : RVIlm<opcStr, ", $vy, $sy", opc, VRC, (ins VRC:$vy, simm7fp:$sy)>;
+}
+// Generic RV multiclass for iterative operation with 3 argument.
+// e.g. VFIAM, VFISM, VFIMA, and etc.
+let VE_VLIndex = 4 in
+multiclass RVI3m<string opcStr, bits<8>opc, RegisterClass VRC,
+ RegisterClass RC> {
+ let vy = ?, vz = ? in
+ defm vvr : RVIlm<opcStr, ", $vy, $vz, $sy", opc, VRC,
+ (ins VRC:$vy, VRC:$vz, RC:$sy)>;
+ let cy = 0, vy = ?, vz = ? in
+ defm vvi : RVIlm<opcStr, ", $vy, $vz, $sy", opc, VRC,
+ (ins VRC:$vy, VRC:$vz, simm7fp:$sy)>;
+}
// Section 8.10.1 - VADD (Vector Add)
let cx = 0, cx2 = 0 in
@@ -1186,3 +1229,35 @@ defm VROR : RVF1m<"vror", 0x98, V64, VM>;
// Section 8.14.9 - VRXOR (Vector Reduction Exclusive Or)
defm VRXOR : RVF1m<"vrxor", 0x89, V64, VM>;
+
+//-----------------------------------------------------------------------------
+// Section 8.15 - Vector Iterative Operation Instructions
+//-----------------------------------------------------------------------------
+
+// Section 8.15.1 - VFIA (Vector Floating Iteration Add)
+let cx = 0 in defm VFIAD : RVI2m<"vfia.d", 0xce, V64, I64>;
+let cx = 1 in defm VFIAS : RVI2m<"vfia.s", 0xce, V64, F32>;
+
+// Section 8.15.2 - VFIS (Vector Floating Iteration Subtract)
+let cx = 0 in defm VFISD : RVI2m<"vfis.d", 0xde, V64, I64>;
+let cx = 1 in defm VFISS : RVI2m<"vfis.s", 0xde, V64, F32>;
+
+// Section 8.15.3 - VFIM (Vector Floating Iteration Multiply)
+let cx = 0 in defm VFIMD : RVI2m<"vfim.d", 0xcf, V64, I64>;
+let cx = 1 in defm VFIMS : RVI2m<"vfim.s", 0xcf, V64, F32>;
+
+// Section 8.15.4 - VFIAM (Vector Floating Iteration Add and Multiply)
+let cx = 0 in defm VFIAMD : RVI3m<"vfiam.d", 0xee, V64, I64>;
+let cx = 1 in defm VFIAMS : RVI3m<"vfiam.s", 0xee, V64, F32>;
+
+// Section 8.15.5 - VFISM (Vector Floating Iteration Subtract and Multiply)
+let cx = 0 in defm VFISMD : RVI3m<"vfism.d", 0xfe, V64, I64>;
+let cx = 1 in defm VFISMS : RVI3m<"vfism.s", 0xfe, V64, F32>;
+
+// Section 8.15.6 - VFIMA (Vector Floating Iteration Multiply and Add)
+let cx = 0 in defm VFIMAD : RVI3m<"vfima.d", 0xef, V64, I64>;
+let cx = 1 in defm VFIMAS : RVI3m<"vfima.s", 0xef, V64, F32>;
+
+// Section 8.15.7 - VFIMS (Vector Floating Iteration Multiply and Subtract)
+let cx = 0 in defm VFIMSD : RVI3m<"vfims.d", 0xff, V64, I64>;
+let cx = 1 in defm VFIMSS : RVI3m<"vfims.s", 0xff, V64, F32>;
diff --git a/llvm/test/MC/VE/VFIA.s b/llvm/test/MC/VE/VFIA.s
new file mode 100644
index 000000000000..ac2b9975755e
--- /dev/null
+++ b/llvm/test/MC/VE/VFIA.s
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN: | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: vfia.d %v11, %v22, 12
+# CHECK-ENCODING: encoding: [0x00,0x00,0x16,0x0b,0x00,0x0c,0x00,0xce]
+vfia.d %v11, %v22, 12
+
+# CHECK-INST: vfia.d %vix, %vix, %s23
+# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0xff,0x00,0x97,0x00,0xce]
+vfia.d %vix, %vix, %s23
+
+# CHECK-INST: vfia.s %v11, %vix, 63
+# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0x0b,0x00,0x3f,0x80,0xce]
+vfia.s %v11, %vix, 63
+
+# CHECK-INST: vfia.s %vix, %v20, -64
+# CHECK-ENCODING: encoding: [0x00,0x00,0x14,0xff,0x00,0x40,0x80,0xce]
+vfia.s %vix, %v20, -64
diff --git a/llvm/test/MC/VE/VFIAM.s b/llvm/test/MC/VE/VFIAM.s
new file mode 100644
index 000000000000..e31256fe7897
--- /dev/null
+++ b/llvm/test/MC/VE/VFIAM.s
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN: | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: vfiam.d %v11, %v22, %v32, 12
+# CHECK-ENCODING: encoding: [0x00,0x20,0x16,0x0b,0x00,0x0c,0x00,0xee]
+vfiam.d %v11, %v22, %v32, 12
+
+# CHECK-INST: vfiam.d %vix, %vix, %vix, %s23
+# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0xff,0x00,0x97,0x00,0xee]
+vfiam.d %vix, %vix, %vix, %s23
+
+# CHECK-INST: vfiam.s %v11, %vix, %vix, 63
+# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0x0b,0x00,0x3f,0x80,0xee]
+vfiam.s %v11, %vix, %vix, 63
+
+# CHECK-INST: vfiam.s %vix, %v20, %v12, -64
+# CHECK-ENCODING: encoding: [0x00,0x0c,0x14,0xff,0x00,0x40,0x80,0xee]
+vfiam.s %vix, %v20, %v12, -64
diff --git a/llvm/test/MC/VE/VFIM.s b/llvm/test/MC/VE/VFIM.s
new file mode 100644
index 000000000000..8d601719d840
--- /dev/null
+++ b/llvm/test/MC/VE/VFIM.s
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN: | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: vfim.d %v11, %v22, 12
+# CHECK-ENCODING: encoding: [0x00,0x00,0x16,0x0b,0x00,0x0c,0x00,0xcf]
+vfim.d %v11, %v22, 12
+
+# CHECK-INST: vfim.d %vix, %vix, %s23
+# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0xff,0x00,0x97,0x00,0xcf]
+vfim.d %vix, %vix, %s23
+
+# CHECK-INST: vfim.s %v11, %vix, 63
+# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0x0b,0x00,0x3f,0x80,0xcf]
+vfim.s %v11, %vix, 63
+
+# CHECK-INST: vfim.s %vix, %v20, -64
+# CHECK-ENCODING: encoding: [0x00,0x00,0x14,0xff,0x00,0x40,0x80,0xcf]
+vfim.s %vix, %v20, -64
diff --git a/llvm/test/MC/VE/VFIMA.s b/llvm/test/MC/VE/VFIMA.s
new file mode 100644
index 000000000000..b3d1740c6960
--- /dev/null
+++ b/llvm/test/MC/VE/VFIMA.s
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN: | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: vfima.d %v11, %v22, %v32, 12
+# CHECK-ENCODING: encoding: [0x00,0x20,0x16,0x0b,0x00,0x0c,0x00,0xef]
+vfima.d %v11, %v22, %v32, 12
+
+# CHECK-INST: vfima.d %vix, %vix, %vix, %s23
+# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0xff,0x00,0x97,0x00,0xef]
+vfima.d %vix, %vix, %vix, %s23
+
+# CHECK-INST: vfima.s %v11, %vix, %vix, 63
+# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0x0b,0x00,0x3f,0x80,0xef]
+vfima.s %v11, %vix, %vix, 63
+
+# CHECK-INST: vfima.s %vix, %v20, %v12, -64
+# CHECK-ENCODING: encoding: [0x00,0x0c,0x14,0xff,0x00,0x40,0x80,0xef]
+vfima.s %vix, %v20, %v12, -64
diff --git a/llvm/test/MC/VE/VFIMS.s b/llvm/test/MC/VE/VFIMS.s
new file mode 100644
index 000000000000..9be97fcbf2e4
--- /dev/null
+++ b/llvm/test/MC/VE/VFIMS.s
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN: | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: vfims.d %v11, %v22, %v32, 12
+# CHECK-ENCODING: encoding: [0x00,0x20,0x16,0x0b,0x00,0x0c,0x00,0xff]
+vfims.d %v11, %v22, %v32, 12
+
+# CHECK-INST: vfims.d %vix, %vix, %vix, %s23
+# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0xff,0x00,0x97,0x00,0xff]
+vfims.d %vix, %vix, %vix, %s23
+
+# CHECK-INST: vfims.s %v11, %vix, %vix, 63
+# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0x0b,0x00,0x3f,0x80,0xff]
+vfims.s %v11, %vix, %vix, 63
+
+# CHECK-INST: vfims.s %vix, %v20, %v12, -64
+# CHECK-ENCODING: encoding: [0x00,0x0c,0x14,0xff,0x00,0x40,0x80,0xff]
+vfims.s %vix, %v20, %v12, -64
diff --git a/llvm/test/MC/VE/VFIS.s b/llvm/test/MC/VE/VFIS.s
new file mode 100644
index 000000000000..2a7725dae200
--- /dev/null
+++ b/llvm/test/MC/VE/VFIS.s
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN: | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: vfis.d %v11, %v22, 12
+# CHECK-ENCODING: encoding: [0x00,0x00,0x16,0x0b,0x00,0x0c,0x00,0xde]
+vfis.d %v11, %v22, 12
+
+# CHECK-INST: vfis.d %vix, %vix, %s23
+# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0xff,0x00,0x97,0x00,0xde]
+vfis.d %vix, %vix, %s23
+
+# CHECK-INST: vfis.s %v11, %vix, 63
+# CHECK-ENCODING: encoding: [0x00,0x00,0xff,0x0b,0x00,0x3f,0x80,0xde]
+vfis.s %v11, %vix, 63
+
+# CHECK-INST: vfis.s %vix, %v20, -64
+# CHECK-ENCODING: encoding: [0x00,0x00,0x14,0xff,0x00,0x40,0x80,0xde]
+vfis.s %vix, %v20, -64
diff --git a/llvm/test/MC/VE/VFISM.s b/llvm/test/MC/VE/VFISM.s
new file mode 100644
index 000000000000..d872ed422610
--- /dev/null
+++ b/llvm/test/MC/VE/VFISM.s
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -triple=ve --show-encoding < %s \
+# RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+# RUN: llvm-mc -triple=ve -filetype=obj < %s | llvm-objdump -d - \
+# RUN: | FileCheck %s --check-prefixes=CHECK-INST
+
+# CHECK-INST: vfism.d %v11, %v22, %v32, 12
+# CHECK-ENCODING: encoding: [0x00,0x20,0x16,0x0b,0x00,0x0c,0x00,0xfe]
+vfism.d %v11, %v22, %v32, 12
+
+# CHECK-INST: vfism.d %vix, %vix, %vix, %s23
+# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0xff,0x00,0x97,0x00,0xfe]
+vfism.d %vix, %vix, %vix, %s23
+
+# CHECK-INST: vfism.s %v11, %vix, %vix, 63
+# CHECK-ENCODING: encoding: [0x00,0xff,0xff,0x0b,0x00,0x3f,0x80,0xfe]
+vfism.s %v11, %vix, %vix, 63
+
+# CHECK-INST: vfism.s %vix, %v20, %v12, -64
+# CHECK-ENCODING: encoding: [0x00,0x0c,0x14,0xff,0x00,0x40,0x80,0xfe]
+vfism.s %vix, %v20, %v12, -64
More information about the llvm-commits
mailing list