jlb6740 opened PR #15211 from jlb6740:apx-patch-unary-and-32bit to bytecodealliance:main:
Second of a series splitting https://github.com/bytecodealliance/wasmtime/pull/14696
into one PR per instruction class, following https://github.com/bytecodealliance/wasmtime/pull/14930.
Adds the APX NDD (new data destination) forms of the unary ops neg and not, which
use a VM encoding where the written operand takes the vvvv slot and ModRM.reg still
holds the opcode extension, plus the 32-bit RVM forms of add, sub, and, or and xor.
i8 and i16 lower through the 32-bit form, since they are already widened. has_apx is off by default, so nothing changes unless it's
enabled. More NDD patches to follow.
jlb6740 requested alexcrichton for a review on PR #15211.
jlb6740 removed the review request for wasmtime-compiler-reviewers from PR #15211.
jlb6740 requested wasmtime-compiler-reviewers for a review on PR #15211.
github-actions[bot] added the label cranelift on PR #15211.
github-actions[bot] added the label cranelift:area:x64 on PR #15211.
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
I might have missed this from earlier discussion, but why do these rules explicitly use
put_in_gprfor all operands? Do APX instructions not support 8/16-bit memory load operands?
:speech_balloon: alexcrichton created PR review comment:
Personally I'd say it's probably fine to drop all of these tests. They're pretty verbose and I don't think it's worth adding individual tests for all instructions. The "oracles" here are opaque hex strings which can't really be reviewed or verified, so I think we'll be best to lean on other testing methods like differential fuzzing (should we enable that for a disassembler that supports apx) or CI-based runtest execution (e.g. QEMU with apx emulation or intel's emulator).
Actually, along those lines, we already have some tests executed through the Intel SDE, for example this job. Does the SDE support APX? If so can you add directives in CLIF
runtests withtest x86_64 has_apxto get full execution testing for the new instructions? That's probably the best possible testing we can hope for since our disasemblers don't support APX (or it's at least not wired up)
:speech_balloon: alexcrichton created PR review comment:
Would it make sense to put these rules within the
x64_nothelper perhaps where applicable? That way other usages ofx64_notwould also benefit from these new lowering rules as well. This'd also apply to most of the other rules changed in this PR too.
Last updated: Nov 19 2026 at 20:05 UTC