https://gcc.gnu.org/g:ef0b30212f7756db15d7507bfd871bf377d7d648

commit r15-1705-gef0b30212f7756db15d7507bfd871bf377d7d648
Author: Andrew Stubbs <a...@baylibre.com>
Date:   Fri Jun 28 10:47:50 2024 +0000

    amdgcn: Fix RDNA V32 permutations [PR115640]
    
    There was an off-by-one error in the RDNA validation check, plus I forgot to
    allow for two-to-one permute-and-merge operations.
    
            PR target/115640
    
    gcc/ChangeLog:
    
            * config/gcn/gcn.cc (gcn_vectorize_vec_perm_const): Modify RDNA 
checks.

Diff:
---
 gcc/config/gcn/gcn.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index d6531f55190..aab9b59c519 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -5134,7 +5134,7 @@ gcn_vectorize_vec_perm_const (machine_mode vmode, 
machine_mode op_mode,
      Reject permutations that cross the boundary.  */
   if (TARGET_RDNA2_PLUS)
     for (unsigned int i = 0; i < nelt; i++)
-      if (i < 31 ? perm[i] > 31 : perm[i] < 32)
+      if (i < 32 ? (perm[i] % nelt) > 31 : (perm[i] % nelt) < 32)
        return false;
 
   /* All vector permutations are possible on other architectures,

Reply via email to