cpu: lower 51 vector shuffle, unpacking, and move instructions #680
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/686"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by MrSkelee on 2026-11-22T20:01:10Z.
Summary
Lowers 51 vector shuffle, unpacking, and move instructions across both legacy SSE and VEX.128 encodings with full native differential coverage.
Highlights
xmm0, xmm0, xmm1) and identical pointer sources.devand/O2release modes.Verification
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T20:39:06Z.
Review: CHANGES_REQUESTED
Thanks for putting this instruction inventory together. There are useful candidates here. Please split out the float-shuffle family as the first focused PR so we can review and land the parts with a native differential.
cpu_float_shuffles_lifted.cpp. The packed shuffle branch inffx_version_query.pyusesis_vexbefore defining it for the current instruction. Derive it from the current instruction and test both behaviors where supported: a legacy XMM write preserves the high half, and a VEX.128 write clears it. Include an aliased operand and compare the full vector bits. Release logRECORD_ONLYmnemonic lists from the passing coverage fixtures. Ininteger_system_stack.asmandx87_extended.asmthe only exported function performs integer addition. A pass of that dummy cannot verify the instructions hidden underRECORD_ONLY. Drop the 948/948 claim from this PR until the corresponding forms have source-built native/AOT comparisons or another applicable coverage test with an observable result.Once the first slice is on current main, we can review its actual coverage and both Windows jobs.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T22:37:53Z.
Review: COMMENTED
Re-reviewed the final
64c1f55candidate. The earlier EXTRQ and RECORD_ONLY scope was removed; unproven aligned memory moves are refused, the VEX self-copy preserves its low half, and the existing heap-layout lowering keeps its XMM representation. The direct MASM/MSVC comparison passed 357 cases and the heap-layout fixture at both/Odand/O2. GitHub run45077941633passed both Windows jobs plus the two Linux checks on this exact head. My requested changes are satisfied for this focused shuffle, unpacking, move and estimate slice.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T21:15:20Z.
The updated head 0d79ade now gets past fixture generation. Both Windows jobs are still red. The new first mismatch is cpu_aot_simd_strings_misc / extrq_reg_op: native aede0000000000000000000000000000, lifted d8de40aede0000000000000000000000. The low result already differs. Please keep EXTRQ in its own follow-up with an independently checked register control and a CPU capability check, so it does not block review of the float-shuffle slice. The RECORD_ONLY fixtures and coverage claim still need the changes in the earlier review. CI
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T21:26:29Z.
Thanks for splitting out the float shuffles. At
07e5186,cpu_aot_float_shufflespasses in both Windows jobs. The oldcpu_aot_heap_layoutnow fails in both. Itsslot_probehasVMOVDQU,VPSRLDQ,VPADDD, andVMOVD. The newVPSRLDQclassification makeshas_widetrue even for that existing XMM path, so some instructions can usewide*while others usexmm*. Please keep each translated function on one register representation and preserve the existing heap path. One additional concrete alias case to cover isvmovaps xmm0,xmm0after a nonzero YMM seed: the low 16 bytes must survive and the high 16 bytes must clear. The new register-copy branch currently clears the destination before reading the aliased source. Please rerun both focused CTests in both presets. CIImported from R0Y00/Xbox2Windows. Originally posted by MrSkelee on 2026-11-22T21:48:27Z.
Updated in 411852b:
has_widesohas_xmm_mathforceshas_wide = False, preserving the existing__m128ipath and intrinsics cleanly forslot_probe.memset(dst.data() + 16, 0, 16)without touching the low 16 bytes whendst == src. Added explicitvmovaps xmm0, xmm0test after a nonzero YMM seed infloat_shuffles.asm.ctest --preset dev -R "(cpu_aot_float_shuffles|cpu_aot_heap_layout)" -V-> 2/2 passedctest --preset release -R "(cpu_aot_float_shuffles|cpu_aot_heap_layout)" -V-> 2/2 passedImported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T21:58:14Z.
The
411852brevision addresses the heap-layout regression and the VEX self-copy case. One more scope issue before merge: the new MOVAPD/MOVDQA/VMOVAPS/VMOVAPD/VMOVDQA memory branches emit plainmemcpy, so the current fixture only demonstrates the aligned case. Please separate register-only moves from aligned memory forms. For this PR, either reject the aligned memory forms that have no checked alignment premise, or add that premise explicitly and verify the misaligned native/AOT behavior in a guarded control. Keep the unaligned MOVUPS/MOVUPD/VMOVDQU cases, the new self-copy, andcpu_aot_heap_layout.Imported from R0Y00/Xbox2Windows. Originally posted by MrSkelee on 2026-11-22T22:11:14Z.
Updated in
e22289d:MOVUPS/MOVUPD/VMOVDQU). Aligned memory forms without alignment premises are rejected.movapd_opandmovdqa_opinfloat_shuffles.asmto register-only operations (movapd xmm0, xmm1andmovdqa xmm0, xmm1).vmovaps xmm0, xmm0self-copy, andcpu_aot_heap_layout.cpu_aot_float_shufflesandcpu_aot_heap_layoutpass in dev and release presets.Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-22T22:25:01Z.
Checked the current head
e22289don an Intel Core i7-6820HQ (Skylake), Windows 11 26100.9168, MSVC/ML64 19.52.37029,devpreset. It merges cleanly withmain.The only skip is the usual
cpu_aot_crypto_shacapability skip, because this CPU has no SHA extensions.cpu_aot_heap_layoutandcpu_aot_float_shufflesboth pass here. This head no longer contains an EXTRQ case, so the SSE4a-only form, which Intel CPUs lack, is not exercised on this host.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T22:34:45Z.
I pushed
64c1f55after checking the aligned-memory restriction in your update. RCP and RSQRT now use the corresponding host SSE estimate instructions. This preserves the measured low-lane bits and special-value behavior that a float divide or square root followed by a tolerance check could miss. The patch also restores the legacy XMM load path when there is noVMOVD, and rejects aligned memory moves in the fixture controls. On local Windows, MASM native vs. MSVC lifted passed all 357 shuffle/estimate comparisons and the existing heap-layout fixture at both/Odand/O2. Waiting for both Windows CI jobs at the new SHA.