You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
simd/archsimd: Load*Part / StorePart require AVX2 even for 128- and 256-bit float vectors #82193
Load*Part and StorePart on AMD64 handle partial slices by calling load*ArrayMasked and StoreArrayMasked. Even if the vector type is a 128-bit or 256-bit float vector (which generally only require AVX), these lowered to VMASKMOV[DQ], which requires AVX2.
Two parts to the solution:
Load*Part and StorePart aren't currently marked as requiring any CPU features, but they should be.
AVX already provides VMASKMOVP[SD] for 128-bit and 256-bit 32/64-bit masked loads and stores. Lowering load*ArrayMasked and StoreArrayMasked to VMASKMOVP[SD] would make them work on AVX.
@cagedmantis
I dug into this across the SIMD package and AMD64 compiler backend to confirm:
loadFloat32x4ArrayMasked and StoreArrayMasked (and the float64 equivalents) in ssagen/simdAMD64intrinsics.go map to OpLoadMasked32 / OpStoreMasked32.
In ssa/_gen/AMD64.rules, these lower directly to VPMASK32load* / VPMASK32store*, which emit VPMASKMOVD / VPMASKMOVQ. Since those are integer instructions, they require AVX2 and fault on AVX-only machines.
As noted, AVX already has VMASKMOVPS and VMASKMOVPD. Adding dedicated SSA ops for these and updating AMD64.rules to check for float types will let float loads/stores run on plain AVX.
Also confirmed that Load*Part and StorePart in slice_gen_amd64.go are currently missing // CPU Feature: doc tags.
Happy to put together a CL/PR with tests for this if the approach looks good to you!
Activity
ansh0014 commentedon Nov 2, 2026
@cagedmantis
I dug into this across the SIMD package and AMD64 compiler backend to confirm:
loadFloat32x4ArrayMaskedandStoreArrayMasked(and the float64 equivalents) inssagen/simdAMD64intrinsics.gomap toOpLoadMasked32/OpStoreMasked32.ssa/_gen/AMD64.rules, these lower directly toVPMASK32load*/VPMASK32store*, which emitVPMASKMOVD/VPMASKMOVQ. Since those are integer instructions, they require AVX2 and fault on AVX-only machines.VMASKMOVPSandVMASKMOVPD. Adding dedicated SSA ops for these and updatingAMD64.rulesto check for float types will let float loads/stores run on plain AVX.Load*PartandStorePartinslice_gen_amd64.goare currently missing// CPU Feature:doc tags.Happy to put together a CL/PR with tests for this if the approach looks good to you!