]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Improve variable permutation insn avoidance [PR101021]
authorUros Bizjak <ubizjak@gmail.com>
Sun, 13 Jun 2021 19:50:51 +0000 (21:50 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Sun, 13 Jun 2021 19:51:33 +0000 (21:51 +0200)
Emit constant permutation insn directly from expand_vec_perm_shufb.

2021-06-13  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
PR target/101021
* config/i386/i386-expand.c (expand_vec_perm_pshufb):
Emit constant permutation insn directly from here.

gcc/config/i386/i386-expand.c

index 2fa3a18dc6af27c1757697c75ee9fac19b493bb7..6e33f6f81962af015bc537ba7e165d1c08509328 100644 (file)
@@ -17593,13 +17593,16 @@ expand_vec_perm_pshufb (struct expand_vec_perm_d *d)
        return false;
     }
 
-  /* Try to avoid variable permutation instruction.  */
-  if (canonicalize_vector_int_perm (d, &nd) && expand_vec_perm_1 (&nd))
-    return false;
-
   if (d->testing_p)
     return true;
 
+  /* Try to avoid variable permutation instruction.  */
+  if (canonicalize_vector_int_perm (d, &nd) && expand_vec_perm_1 (&nd))
+    {
+      emit_move_insn (d->target, gen_lowpart (d->vmode, nd.target));
+      return true;
+    }
+
   if (vmode == V8SImode)
     for (i = 0; i < 8; ++i)
       rperm[i] = GEN_INT ((d->perm[i * nelt / 8] * 8 / nelt) & 7);