Skip to content

simd/archsimd: Load*Part / StorePart require AVX2 even for 128- and 256-bit float vectors #82193

Open

Description

@aclements

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.

/cc @dr2chase @JunyangShao

Activity

  1. added this to the Go1.28 milestone on Oct 13, 2026
  2. added theissue type on Oct 13, 2026
  3. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Oct 16, 2026
  4. ansh0014 commented on Nov 2, 2026

    @ansh0014

    @cagedmantis
    I dug into this across the SIMD package and AMD64 compiler backend to confirm:

    1. loadFloat32x4ArrayMasked and StoreArrayMasked (and the float64 equivalents) in ssagen/simdAMD64intrinsics.go map to OpLoadMasked32 / OpStoreMasked32.
    2. 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.
    3. 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.
    4. 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions