summaryrefslogtreecommitdiff
path: root/assemble.c
diff options
context:
space:
mode:
authorJin Kyu Song <jin.kyu.song@intel.com>2013-08-30 18:10:35 -0700
committerCyrill Gorcunov <gorcunov@gmail.com>2013-09-07 11:50:11 +0400
commitc47ef9490bb9855b1d04931b696510a1cb042cad (patch)
tree483c99706c345d006ec5161e73dab62766121507 /assemble.c
parent088827bc6c8590108e5d752fd1f968d128b5586e (diff)
downloadnasm-c47ef9490bb9855b1d04931b696510a1cb042cad.tar.gz
nasm-c47ef9490bb9855b1d04931b696510a1cb042cad.tar.bz2
nasm-c47ef9490bb9855b1d04931b696510a1cb042cad.zip
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.kyu.song@intel.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'assemble.c')
-rw-r--r--assemble.c15
1 files changed, 9 insertions, 6 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;
}