Change intrinsic REX opcode mode X to be silently ignored in 32 builds to allow pointer based intrinsics to work in both 64 bit and 32 bit with the same definion.

This commit is contained in:
fsfod 2017-09-19 18:39:42 +01:00
parent 1e9a1bb8cf
commit 26808edf50
2 changed files with 3 additions and 1 deletions

View File

@ -780,6 +780,8 @@ int lj_intrinsic_fromcdef(lua_State *L, CTypeID fid, GCstr *opstr, uint32_t imm)
/* Use opcode unmodified in its SSE form */
intrins->flags &= ~INTRINSFLAG_VEX;
}
} else if(!LJ_64 && (intrins->flags & INTRINSFLAG_REXW)) {
intrins->flags &= ~INTRINSFLAG_REXW;
}
#endif

View File

@ -429,7 +429,7 @@ context("__mcode", function()
end)
it("output pointers", function()
assert_cdef([[const char* addptr(const char* nptr, int32_t n) __mcode("03rM");]], "addptr")
assert_cdef([[const char* addptr(const char* nptr, int32_t n) __mcode("03rMX");]], "addptr")
local s = "0123456789abcdefghijklmnopqrstvwxyz"
local ptr = ffi.C.addptr(s, 0)