[2116]: Fix absolute path handling.
[2117]: Fix expression leveling bug.
[2118], [2119]: Add support for newly specified AVX/AES instructions.
svn path=/branches/yasm-0.7.x/; revision=2146
#include "arch.h"
+static /*@only@*/ yasm_expr *expr_level_op
+ (/*@returned@*/ /*@only@*/ yasm_expr *e, int fold_const,
+ int simplify_ident, int simplify_reg_mul);
static int expr_traverse_nodes_post(/*@null@*/ yasm_expr *e,
/*@null@*/ void *d,
int (*func) (/*@null@*/ yasm_expr *e,
ptr->line = line;
- return ptr;
+ return expr_level_op(ptr, 1, 1, 0);
}
/*@=compmempass@*/
if (i == first_int_term)
first_int_term = o;
o--;
- }
+ } else
+ o--;
}
/* Simplify identities, make IDENT if possible, and save to e->numterms. */
return buf;
}
-/* FIXME: dumb way for now */
char *
-yasm__abspath_unix(const char *path)
+yasm__abspath(const char *path)
{
char *curdir, *abspath;
- static const char pathsep[2] = "/";
curdir = yasm__getcwd();
-
- abspath = yasm_xmalloc(strlen(curdir) + strlen(path) + 2);
- strcpy(abspath, curdir);
- strcat(abspath, pathsep);
- strcat(abspath, path);
-
+ abspath = yasm__combpath(curdir, path);
yasm_xfree(curdir);
return abspath;
}
-/* FIXME: dumb way for now */
-char *
-yasm__abspath_win(const char *path)
-{
- char *curdir, *abspath, *ch;
- static const char pathsep[2] = "\\";
-
- curdir = yasm__getcwd();
-
- abspath = yasm_xmalloc(strlen(curdir) + strlen(path) + 2);
- strcpy(abspath, curdir);
- strcat(abspath, pathsep);
- strcat(abspath, path);
-
- yasm_xfree(curdir);
-
- /* Replace all / with \ */
- ch = abspath;
- while (*ch) {
- if (*ch == '/')
- *ch = '\\';
- ch++;
- }
-
- return abspath;
-}
-
char *
yasm__combpath_unix(const char *from, const char *to)
{
*/
/*@only@*/ char *yasm__getcwd(void);
-/** Convert a UNIX relative or absolute pathname into an absolute pathname.
- * \internal
- * \param path pathname
- * \return Absolute version of path (newly allocated).
- */
-/*@only@*/ char *yasm__abspath_unix(const char *path);
-
-/** Convert a Windows relative or absolute pathname into an absolute pathname.
- * \internal
- * \param path pathname
- * \return Absolute version of path (newly allocated).
- */
-/*@only@*/ char *yasm__abspath_win(const char *path);
-
/** Convert a relative or absolute pathname into an absolute pathname.
- * Unless otherwise defined, defaults to yasm__abspath_unix().
* \internal
* \param path pathname
* \return Absolute version of path (newly allocated).
*/
-#ifndef yasm__abspath
-# if defined (_WIN32) || defined (WIN32) || defined (__MSDOS__) || \
- defined (__DJGPP__) || defined (__OS2__) || defined (__CYGWIN__) || \
- defined (__CYGWIN32__)
-# define yasm__abspath(path) yasm__abspath_win(path)
-# else
-# define yasm__abspath(path) yasm__abspath_unix(path)
-# endif
-#endif
+/*@only@*/ char *yasm__abspath(const char *path);
/** Build a UNIX pathname that is equivalent to accessing the "to" pathname
* when you're in the directory containing "from". Result is relative if both
opcode=[0x0F, 0x00],
operands=[Operand(type="Mem", size=128, relaxed=True, dest="EA"),
Operand(type="SIMDReg", size=128, dest="Spare")])
+add_group("movnt",
+ cpu=["AVX"],
+ modifiers=["PreAdd", "Op1Add"],
+ vex=256,
+ prefix=0x00,
+ opcode=[0x0F, 0x00],
+ operands=[Operand(type="Mem", size=256, relaxed=True, dest="EA"),
+ Operand(type="SIMDReg", size=256, dest="Spare")])
add_insn("movntps", "movnt", modifiers=[0, 0x2B])
add_insn("vmovntps", "movnt", modifiers=[0, 0x2B, VEXL0], avx=True)
add_group("aes",
cpu=["AES"],
+ modifiers=["Op1Add", "Op2Add", "SetVEX"],
+ prefix=0x66,
+ opcode=[0x0F, 0x00, 0x00],
+ operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"),
+ Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")])
+add_group("aes",
+ cpu=["AES", "AVX"],
modifiers=["Op1Add", "Op2Add"],
+ vex=128,
prefix=0x66,
opcode=[0x0F, 0x00, 0x00],
operands=[Operand(type="SIMDReg", size=128, dest="Spare"),
+ Operand(type="SIMDReg", size=128, dest="VEX"),
Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")])
+
add_insn("aesenc", "aes", modifiers=[0x38, 0xDC])
add_insn("aesenclast", "aes", modifiers=[0x38, 0xDD])
add_insn("aesdec", "aes", modifiers=[0x38, 0xDE])
add_insn("aesdeclast", "aes", modifiers=[0x38, 0xDF])
-add_insn("aesimc", "aes", modifiers=[0x38, 0xDB])
+
+add_insn("vaesenc", "aes", modifiers=[0x38, 0xDC, VEXL0], avx=True)
+add_insn("vaesenclast", "aes", modifiers=[0x38, 0xDD, VEXL0], avx=True)
+add_insn("vaesdec", "aes", modifiers=[0x38, 0xDE, VEXL0], avx=True)
+add_insn("vaesdeclast", "aes", modifiers=[0x38, 0xDF, VEXL0], avx=True)
+
+add_group("aesimc",
+ cpu=["AES"],
+ modifiers=["Op1Add", "Op2Add", "SetVEX"],
+ prefix=0x66,
+ opcode=[0x0F, 0x00, 0x00],
+ operands=[Operand(type="SIMDReg", size=128, dest="SpareVEX"),
+ Operand(type="SIMDRM", size=128, relaxed=True, dest="EA")])
+
+add_insn("aesimc", "aesimc", modifiers=[0x38, 0xDB])
+add_insn("vaesimc", "aesimc", modifiers=[0x38, 0xDB, VEXL0], avx=True)
+
add_group("aes_imm",
cpu=["AES"],
- modifiers=["Op1Add", "Op2Add"],
+ modifiers=["Op1Add", "Op2Add", "SetVEX"],
prefix=0x66,
opcode=[0x0F, 0x00, 0x00],
operands=[Operand(type="SIMDReg", size=128, dest="Spare"),
Operand(type="Imm", size=8, relaxed=True, dest="Imm")])
add_insn("aeskeygenassist", "aes_imm", modifiers=[0x3A, 0xDF])
+add_insn("vaeskeygenassist", "aes_imm", modifiers=[0x3A, 0xDF, VEXL0],
+ avx=True)
#####################################################################
# Intel PCLMULQDQ instruction
aesenc xmm10, xmm12
aesenc xmm10, [rax+r15*4]
aesenc xmm10, [r14+r15*4]
+vaesenc xmm1, xmm2
+vaesenc xmm1, [rax]
+vaesenc xmm1, dqword [rax]
+vaesenc xmm1, xmm2, xmm3
+vaesenc xmm1, xmm2, [rax]
+vaesenc xmm1, xmm2, dqword [rax]
aesenclast xmm1, xmm2
aesenclast xmm1, [rax]
aesenclast xmm1, dqword [rax]
+vaesenclast xmm1, xmm2
+vaesenclast xmm1, [rax]
+vaesenclast xmm1, dqword [rax]
+vaesenclast xmm1, xmm2, xmm3
+vaesenclast xmm1, xmm2, [rax]
+vaesenclast xmm1, xmm2, dqword [rax]
aesdec xmm1, xmm2
aesdec xmm1, [rax]
aesdec xmm1, dqword [rax]
+vaesdec xmm1, xmm2
+vaesdec xmm1, [rax]
+vaesdec xmm1, dqword [rax]
+vaesdec xmm1, xmm2, xmm3
+vaesdec xmm1, xmm2, [rax]
+vaesdec xmm1, xmm2, dqword [rax]
aesdeclast xmm1, xmm2
aesdeclast xmm1, [rax]
aesdeclast xmm1, dqword [rax]
+vaesdeclast xmm1, xmm2
+vaesdeclast xmm1, [rax]
+vaesdeclast xmm1, dqword [rax]
+vaesdeclast xmm1, xmm2, xmm3
+vaesdeclast xmm1, xmm2, [rax]
+vaesdeclast xmm1, xmm2, dqword [rax]
aesimc xmm1, xmm2
aesimc xmm1, [rax]
aesimc xmm1, dqword [rax]
+vaesimc xmm1, xmm2
+vaesimc xmm1, [rax]
+vaesimc xmm1, dqword [rax]
+; no 3-operand form
aeskeygenassist xmm1, xmm2, 5
aeskeygenassist xmm1, [rax], byte 5
aeskeygenassist xmm1, dqword [rax], 5
+vaeskeygenassist xmm1, xmm2, 5
+vaeskeygenassist xmm1, [rax], byte 5
+vaeskeygenassist xmm1, dqword [rax], 5
pclmulqdq xmm1, xmm2, 5
pclmulqdq xmm1, [rax], byte 5
dc
14
be
+c4
+e2
+71
+dc
+ca
+c4
+e2
+71
+dc
+08
+c4
+e2
+71
+dc
+08
+c4
+e2
+69
+dc
+cb
+c4
+e2
+69
+dc
+08
+c4
+e2
+69
+dc
+08
66
0f
38
38
dd
08
+c4
+e2
+71
+dd
+ca
+c4
+e2
+71
+dd
+08
+c4
+e2
+71
+dd
+08
+c4
+e2
+69
+dd
+cb
+c4
+e2
+69
+dd
+08
+c4
+e2
+69
+dd
+08
66
0f
38
38
de
08
+c4
+e2
+71
+de
+ca
+c4
+e2
+71
+de
+08
+c4
+e2
+71
+de
+08
+c4
+e2
+69
+de
+cb
+c4
+e2
+69
+de
+08
+c4
+e2
+69
+de
+08
66
0f
38
38
df
08
+c4
+e2
+71
+df
+ca
+c4
+e2
+71
+df
+08
+c4
+e2
+71
+df
+08
+c4
+e2
+69
+df
+cb
+c4
+e2
+69
+df
+08
+c4
+e2
+69
+df
+08
66
0f
38
38
db
08
+c4
+e2
+71
+db
+ca
+c4
+e2
+71
+db
+08
+c4
+e2
+71
+db
+08
66
0f
3a
df
08
05
+c4
+e3
+79
+df
+ca
+05
+c4
+e3
+79
+df
+08
+05
+c4
+e3
+79
+df
+08
+05
66
0f
3a
movntdq dqword [rax], xmm1
vmovntdq [rax], xmm1
vmovntdq dqword [rax], xmm1
+vmovntdq [rax], ymm1
+vmovntdq yword [rax], ymm1
movntdqa xmm1, [rax]
movntdqa xmm1, dqword [rax]
movntpd dqword [rax], xmm1
vmovntpd [rax], xmm1
vmovntpd dqword [rax], xmm1
+vmovntpd [rax], ymm1
+vmovntpd yword [rax], ymm1
movntps [rax], xmm1
movntps dqword [rax], xmm1
vmovntps [rax], xmm1
vmovntps dqword [rax], xmm1
+vmovntps [rax], ymm1
+vmovntps yword [rax], ymm1
movsd xmm1, xmm2
vmovsd xmm1, xmm2
f9
e7
08
+c5
+fd
+e7
+08
+c5
+fd
+e7
+08
66
0f
38
f9
2b
08
+c5
+fd
+2b
+08
+c5
+fd
+2b
+08
0f
2b
08
f8
2b
08
+c5
+fc
+2b
+08
+c5
+fc
+2b
+08
f2
0f
10
yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
/*@null@*/ const insnprefix_parse_data *pdata;
size_t i;
- static char lcaseid[16];
+ static char lcaseid[17];
*bc = (yasm_bytecode *)NULL;
*prefix = 0;
- if (id_len > 15)
+ if (id_len > 16)
return YASM_ARCH_NOTINSNPREFIX;
for (i=0; i<id_len; i++)
lcaseid[i] = tolower(id[i]);