]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
amdgcn: Fix RDNA V32 permutations [PR115640]
authorAndrew Stubbs <ams@baylibre.com>
Fri, 28 Jun 2024 10:47:50 +0000 (10:47 +0000)
committerAndrew Stubbs <ams@baylibre.com>
Fri, 28 Jun 2024 11:08:37 +0000 (11:08 +0000)
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.

gcc/config/gcn/gcn.cc

index d6531f55190c19257a87c9bda4e73771a144fa50..aab9b59c5196c93002a7b23cb117225ca90a1ae4 100644 (file)
@@ -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,