Commit-ID: c47ef9490bb9855b1d04931b696510a1cb042cad
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c47ef9490bb9855b1d04931b696510a1cb042cad
Author: Jin Kyu Song <jin...@in...>
AuthorDate: Fri, 30 Aug 2013 18:10:35 -0700
Committer: Cyrill Gorcunov <gor...@gm...>
CommitDate: Sat, 7 Sep 2013 11:50:11 +0400
AVX-512: Fix rounding mode value in EVEX prefix with SAE
If SAE is set, VL(vector length) is implied to be 512.
EVEX.L'L (=EVEX.RC) is set to 00b by default.
Signed-off-by: Jin Kyu Song <jin...@in...>
Signed-off-by: Cyrill Gorcunov <gor...@gm...>
---
assemble.c | 15 +++++++++------
nasm.h | 3 ++-
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/assemble.c b/assemble.c
index 6ea8be6..ad34523 100644
--- a/assemble.c
+++ b/assemble.c
@@ -1167,15 +1167,18 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
op_er_sae = (ins->evex_brerop >= 0 ?
&ins->oprs[ins->evex_brerop] : NULL);
- if (op_er_sae && (op_er_sae->decoflags & ER)) {
- /* set EVEX.RC (rounding control) and b */
- ins->evex_p[2] |= (((ins->evex_rm - BRC_RN) << 5) & EVEX_P2LL) |
- EVEX_P2B;
+ if (op_er_sae && (op_er_sae->decoflags & (ER | SAE))) {
+ /* set EVEX.b */
+ ins->evex_p[2] |= EVEX_P2B;
+ if (op_er_sae->decoflags & ER) {
+ /* set EVEX.RC (rounding control) */
+ ins->evex_p[2] |= ((ins->evex_rm - BRC_RN) << 5)
+ & EVEX_P2RC;
+ }
} else {
/* set EVEX.L'L (vector length) */
ins->evex_p[2] |= ((ins->vex_wlp << (5 - 2)) & EVEX_P2LL);
- if ((op_er_sae && (op_er_sae->decoflags & SAE)) ||
- (opy->decoflags & BRDCAST_MASK)) {
+ if (opy->decoflags & BRDCAST_MASK) {
/* set EVEX.b */
ins->evex_p[2] |= EVEX_P2B;
}
diff --git a/nasm.h b/nasm.h
index e9ef585..50e4b63 100644
--- a/nasm.h
+++ b/nasm.h
@@ -514,7 +514,8 @@ static inline uint8_t get_cond_opcode(enum ccode c)
#define EVEX_P2AAA 0x07 /* EVEX P[18:16] : Embedded opmask */
#define EVEX_P2VP 0x08 /* EVEX P[19] : High-16 NDS reg */
#define EVEX_P2B 0x10 /* EVEX P[20] : Broadcast / RC / SAE */
-#define EVEX_P2LL 0x60 /* EVEX P[22:21] : Vector length / RC */
+#define EVEX_P2LL 0x60 /* EVEX P[22:21] : Vector length */
+#define EVEX_P2RC EVEX_P2LL /* EVEX P[22:21] : Rounding control */
#define EVEX_P2Z 0x80 /* EVEX P[23] : Zeroing/Merging */
/*
|