[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/20] Hexagon HVX (target/hexagon) semantics generator
From: |
Taylor Simpson |
Subject: |
[PATCH 08/20] Hexagon HVX (target/hexagon) semantics generator |
Date: |
Mon, 5 Jul 2021 18:34:22 -0500 |
Add HVX support to the semantics generator
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
---
target/hexagon/gen_semantics.c | 33 +++++++++++++++++++++++++++++++++
target/hexagon/hex_common.py | 9 ++++++++-
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/target/hexagon/gen_semantics.c b/target/hexagon/gen_semantics.c
index c5fccec..4a2bdd7 100644
--- a/target/hexagon/gen_semantics.c
+++ b/target/hexagon/gen_semantics.c
@@ -44,6 +44,11 @@ int main(int argc, char *argv[])
* Q6INSN(A2_add,"Rd32=add(Rs32,Rt32)",ATTRIBS(),
* "Add 32-bit registers",
* { RdV=RsV+RtV;})
+ * HVX instructions have the following form
+ * EXTINSN(V6_vinsertwr, "Vx32.w=vinsert(Rt32)",
+ * ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VX),
+ * "Insert Word Scalar into Vector",
+ * VxV.uw[0] = RtV;)
*/
#define Q6INSN(TAG, BEH, ATTRIBS, DESCR, SEM) \
do { \
@@ -59,8 +64,23 @@ int main(int argc, char *argv[])
")\n", \
#TAG, STRINGIZE(ATTRIBS)); \
} while (0);
+#define EXTINSN(TAG, BEH, ATTRIBS, DESCR, SEM) \
+ do { \
+ fprintf(outfile, "SEMANTICS( \\\n" \
+ " \"%s\", \\\n" \
+ " %s, \\\n" \
+ " \"\"\"%s\"\"\" \\\n" \
+ ")\n", \
+ #TAG, STRINGIZE(BEH), STRINGIZE(SEM)); \
+ fprintf(outfile, "ATTRIBUTES( \\\n" \
+ " \"%s\", \\\n" \
+ " \"%s\" \\\n" \
+ ")\n", \
+ #TAG, STRINGIZE(ATTRIBS)); \
+ } while (0);
#include "imported/allidefs.def"
#undef Q6INSN
+#undef EXTINSN
/*
* Process the macro definitions
@@ -83,6 +103,19 @@ int main(int argc, char *argv[])
#include "imported/macros.def"
#undef DEF_MACRO
+/*
+ * Process the macros for HVX
+ */
+#define DEF_MACRO(MNAME, BEH, ATTRS) \
+ fprintf(outfile, "MACROATTRIB( \\\n" \
+ " \"%s\", \\\n" \
+ " \"\"\"%s\"\"\", \\\n" \
+ " \"%s\" \\\n" \
+ ")\n", \
+ #MNAME, STRINGIZE(BEH), STRINGIZE(ATTRS));
+#include "imported/allext_macros.def"
+#undef DEF_MACRO
+
fclose(outfile);
return 0;
}
diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py
index b3b5340..d07e48b 100755
--- a/target/hexagon/hex_common.py
+++ b/target/hexagon/hex_common.py
@@ -143,6 +143,9 @@ def compute_tag_immediates(tag):
## P predicate register
## R GPR register
## M modifier register
+## Q HVX predicate vector
+## V HVX vector register
+## O HVX new vector register
## regid can be one of the following
## d, e destination register
## dd destination register pair
@@ -178,6 +181,9 @@ def is_readwrite(regid):
def is_scalar_reg(regtype):
return regtype in "RPC"
+def is_hvx_reg(regtype):
+ return regtype in "VQ"
+
def is_old_val(regtype, regid, tag):
return regtype+regid+'V' in semdict[tag]
@@ -187,7 +193,8 @@ def is_new_val(regtype, regid, tag):
def need_slot(tag):
if ('A_CONDEXEC' in attribdict[tag] or
'A_STORE' in attribdict[tag] or
- 'A_LOAD' in attribdict[tag]):
+ 'A_LOAD' in attribdict[tag] or
+ 'A_CVI' in attribdict[tag]):
return 1
else:
return 0
--
2.7.4
- Re: [PATCH 01/20] Hexagon HVX (target/hexagon) README, (continued)
- Re: [PATCH 01/20] Hexagon HVX (target/hexagon) README, Rob Landley, 2021/07/12
- RE: [PATCH 01/20] Hexagon HVX (target/hexagon) README, Brian Cain, 2021/07/12
- Re: [PATCH 01/20] Hexagon HVX (target/hexagon) README, Rob Landley, 2021/07/18
- RE: [PATCH 01/20] Hexagon HVX (target/hexagon) README, Brian Cain, 2021/07/19
- RE: [PATCH 01/20] Hexagon HVX (target/hexagon) README, Sid Manning, 2021/07/19
- Re: [PATCH 01/20] Hexagon HVX (target/hexagon) README, Rob Landley, 2021/07/26
- Re: [PATCH 01/20] Hexagon HVX (target/hexagon) README, Rob Landley, 2021/07/26
- RE: [PATCH 01/20] Hexagon HVX (target/hexagon) README, Taylor Simpson, 2021/07/26
- Re: [PATCH 01/20] Hexagon HVX (target/hexagon) README, Rob Landley, 2021/07/28
[PATCH 07/20] Hexagon HVX (target/hexagon) import macro definitions, Taylor Simpson, 2021/07/05
[PATCH 08/20] Hexagon HVX (target/hexagon) semantics generator,
Taylor Simpson <=
[PATCH 12/20] Hexagon HVX (target/hexagon) helper functions, Taylor Simpson, 2021/07/05
[PATCH 09/20] Hexagon HVX (target/hexagon) semantics generator - part 2, Taylor Simpson, 2021/07/05
[PATCH 04/20] Hexagon HVX (target/hexagon) support in gdbstub, Taylor Simpson, 2021/07/05
[PATCH 06/20] Hexagon HVX (target/hexagon) macros, Taylor Simpson, 2021/07/05
[PATCH 02/20] Hexagon HVX (target/hexagon) add Hexagon Vector eXtensions (HVX) to core, Taylor Simpson, 2021/07/05