summaryrefslogtreecommitdiff
path: root/nasm.h
diff options
context:
space:
mode:
authorJin Kyu Song <jin.kyu.song@intel.com>2013-10-30 03:12:45 -0700
committerJin Kyu Song <jin.kyu.song@intel.com>2013-11-20 11:29:42 -0800
commit25c221258641aec4198e9e46127536676878a4bd (patch)
tree3b3435793bd08c7bcbde3dba5b8a6d581ad05863 /nasm.h
parent7903c07b7753fb02fc3b5ba6211dc566bc25aa7c (diff)
downloadnasm-25c221258641aec4198e9e46127536676878a4bd.tar.gz
nasm-25c221258641aec4198e9e46127536676878a4bd.tar.bz2
nasm-25c221258641aec4198e9e46127536676878a4bd.zip
match: Check the number of elements in broadcasting operands
The broadcasting decorator {1to##} must describe exactly how many times the memory element is repeated in order to clearly match the correct instruction format. For example, vaddpd zmm30,zmm29,QWORD [rdx+0x3f8]{1to8} ; good vaddpd zmm30,zmm29,QWORD [rdx+0x3f8]{1to16} ; fail qword * 16 = 1024b vaddps zmm30,zmm29,DWORD [rcx]{1to16} ; good vaddps zmm30,zmm29,DWORD [rcx]{1to8} ; fail dword * 8 = 256b Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Diffstat (limited to 'nasm.h')
-rw-r--r--nasm.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/nasm.h b/nasm.h
index 34adc69..b68a8ba 100644
--- a/nasm.h
+++ b/nasm.h
@@ -1048,6 +1048,7 @@ enum decorator_tokens {
* .........................1...... static rounding
* ........................1....... SAE
* ......................11........ broadcast element size
+ * ....................11.......... number of broadcast elements
*/
#define OP_GENVAL(val, bits, shift) (((val) & ((UINT64_C(1) << (bits)) - 1)) << (shift))
@@ -1119,6 +1120,19 @@ enum decorator_tokens {
#define BR_BITS32 GEN_BRSIZE(0)
#define BR_BITS64 GEN_BRSIZE(1)
+/*
+ * Number of broadcasting elements
+ *
+ * Bits: 10 - 11
+ */
+#define BRNUM_SHIFT (10)
+#define BRNUM_BITS (2)
+#define BRNUM_MASK OP_GENMASK(BRNUM_BITS, BRNUM_SHIFT)
+#define VAL_BRNUM(val) OP_GENVAL(val, BRNUM_BITS, BRNUM_SHIFT)
+
+#define BR_1TO8 VAL_BRNUM(0)
+#define BR_1TO16 VAL_BRNUM(1)
+
#define MASK OPMASK_MASK /* Opmask (k1 ~ 7) can be used */
#define Z Z_MASK
#define B32 (BRDCAST_MASK|BR_BITS32) /* {1to16} : broadcast 32b * 16 to zmm(512b) */