Bug 116816 - SLP loads need VMAT_ELEMENTWISE support
Summary: SLP loads need VMAT_ELEMENTWISE support
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 15.0
: P3 normal
Target Milestone: ---
Assignee: Richard Biener
URL:
Keywords: missed-optimization
Depends on:
Blocks: vectorizer
  Show dependency treegraph
 
Reported: 2024-09-23 09:33 UTC by Richard Biener
Modified: 2025-09-24 11:34 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-09-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2024-09-23 09:33:02 UTC
While VMAT_STRIDED_SLP supports also effective elementwise accesses in the
case of load permutes we still suffer from PR65518.  There should be a way
to improve the situation here, either by element-wise accesses honorig the
permute or by unpermuted loads and permutes of the now sparse vectors.
Comment 1 Richard Biener 2024-09-23 09:33:24 UTC
I will look at this for next stage1.
Comment 2 GCC Commits 2025-09-24 11:34:03 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:1f6b1ed047105103c2fba9696fd0ed17ec5e1405

commit r16-4076-g1f6b1ed047105103c2fba9696fd0ed17ec5e1405
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Sep 24 12:19:17 2025 +0200

    tree-optimization/116816 - improve VMAT_ELEMENTWISE with SLP
    
    The following implements VMAT_ELEMENTWISE for grouped loads, in
    particular for being able to serve as fallback for unhandled
    load permutations since it's trivial to load elements in the
    correct order.
    
            PR tree-optimization/116816
            * tree-vect-stmts.cc (get_load_store_type): Allow multi-lane
            single-element interleaving to fall back to VMAT_ELEMENTWISE.
            Fall back to VMAT_ELEMENTWISE when we cannot handle a load
            permutation.
            (vectorizable_load): Do not check a load permutation
            for VMAT_ELEMENTWISE.  Handle grouped loads with
            VMAT_ELEMENTWISE and directly apply a load permutation.
Comment 3 Richard Biener 2025-09-24 11:34:53 UTC
This is now implemented.  VMAT_ELEMENTWISE loads can handle all permutations and any number of SLP lanes.