From b1983bab68a9b1acdd3a4e49ab07d1b6a3b74ce2 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Thu, 19 Mar 2026 14:49:39 -0700 Subject: [PATCH] [x64] Add `GFNI` optimization for single-byte vector splats Use the `vgf2p8affineqb` instruction to splat byte-values across a whole register without having to touch memory. --- src/xenia/cpu/backend/x64/x64_emitter.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xenia/cpu/backend/x64/x64_emitter.cc b/src/xenia/cpu/backend/x64/x64_emitter.cc index c7fd92e98..5da8f6adc 100644 --- a/src/xenia/cpu/backend/x64/x64_emitter.cc +++ b/src/xenia/cpu/backend/x64/x64_emitter.cc @@ -1313,6 +1313,12 @@ void X64Emitter::LoadConstantXmm(Xbyak::Xmm dest, const vec128_t& v) { } if (all_equal_bytes) { + if (IsFeatureEnabled(kX64EmitGFNI)) { + vpxor(dest, dest); + vgf2p8affineqb(dest, dest, dest, firstbyte); + return; + } + void* bval = FindByteConstantOffset(firstbyte); if (bval) {