aboutsummaryrefslogtreecommitdiff
path: root/src/lj_emit_x86.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_emit_x86.h')
-rw-r--r--src/lj_emit_x86.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lj_emit_x86.h b/src/lj_emit_x86.h
index caf30859..cbaf4e85 100644
--- a/src/lj_emit_x86.h
+++ b/src/lj_emit_x86.h
@@ -13,10 +13,12 @@
13 if (rex != 0x40) *--(p) = rex; } 13 if (rex != 0x40) *--(p) = rex; }
14#define FORCE_REX 0x200 14#define FORCE_REX 0x200
15#define REX_64 (FORCE_REX|0x080000) 15#define REX_64 (FORCE_REX|0x080000)
16#define VEX_64 0x800000
16#else 17#else
17#define REXRB(p, rr, rb) ((void)0) 18#define REXRB(p, rr, rb) ((void)0)
18#define FORCE_REX 0 19#define FORCE_REX 0
19#define REX_64 0 20#define REX_64 0
21#define VEX_64 0
20#endif 22#endif
21 23
22#define emit_i8(as, i) (*--as->mcp = (MCode)(i)) 24#define emit_i8(as, i) (*--as->mcp = (MCode)(i))
@@ -31,6 +33,13 @@ static LJ_AINLINE MCode *emit_op(x86Op xo, Reg rr, Reg rb, Reg rx,
31 MCode *p, int delta) 33 MCode *p, int delta)
32{ 34{
33 int n = (int8_t)xo; 35 int n = (int8_t)xo;
36 if (n == -60) { /* VEX-encoded instruction */
37#if LJ_64
38 xo ^= (((rr>>1)&4)+((rx>>2)&2)+((rb>>3)&1))<<13;
39#endif
40 *(uint32_t *)(p+delta-5) = (uint32_t)xo;
41 return p+delta-5;
42 }
34#if defined(__GNUC__) 43#if defined(__GNUC__)
35 if (__builtin_constant_p(xo) && n == -2) 44 if (__builtin_constant_p(xo) && n == -2)
36 p[delta-2] = (MCode)(xo >> 24); 45 p[delta-2] = (MCode)(xo >> 24);
@@ -412,8 +421,10 @@ static void emit_call_(ASMState *as, MCode *target)
412/* Use 64 bit operations to handle 64 bit IR types. */ 421/* Use 64 bit operations to handle 64 bit IR types. */
413#if LJ_64 422#if LJ_64
414#define REX_64IR(ir, r) ((r) + (irt_is64((ir)->t) ? REX_64 : 0)) 423#define REX_64IR(ir, r) ((r) + (irt_is64((ir)->t) ? REX_64 : 0))
424#define VEX_64IR(ir, r) ((r) + (irt_is64((ir)->t) ? VEX_64 : 0))
415#else 425#else
416#define REX_64IR(ir, r) (r) 426#define REX_64IR(ir, r) (r)
427#define VEX_64IR(ir, r) (r)
417#endif 428#endif
418 429
419/* Generic move between two regs. */ 430/* Generic move between two regs. */