... and introduce some related cleanups.

2016-10-06  Uros Bizjak  <ubiz...@gmail.com>

    * config/i386/sse.md (andnot<mode>3): Add FALLTHRU comments.
    Introduce ssesuffix variable.
    (<mask_codefor><code><mode>3<mask_name>): Ditto.
    (*<code><mode>3): Ditto.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Will commit later today.

Uros.
Index: config/i386/sse.md
===================================================================
--- config/i386/sse.md  (revision 240814)
+++ config/i386/sse.md  (working copy)
@@ -11263,15 +11263,19 @@
   static char buf[64];
   const char *ops;
   const char *tmp;
+  const char *ssesuffix;
 
   switch (get_attr_mode (insn))
     {
     case MODE_XI:
       gcc_assert (TARGET_AVX512F);
+      /* FALLTHRU */
     case MODE_OI:
       gcc_assert (TARGET_AVX2);
+      /* FALLTHRU */
     case MODE_TI:
       gcc_assert (TARGET_SSE2);
+      tmp = "pandn";
       switch (<MODE>mode)
        {
        case V64QImode:
@@ -11278,31 +11282,33 @@
        case V32HImode:
          /* There is no vpandnb or vpandnw instruction, nor vpandn for
             512-bit vectors. Use vpandnq instead.  */
-         tmp = "pandnq";
+         ssesuffix = "q";
          break;
        case V16SImode:
        case V8DImode:
-         tmp = "pandn<ssemodesuffix>";
+         ssesuffix = "<ssemodesuffix>";
          break;
        case V8SImode:
        case V4DImode:
        case V4SImode:
        case V2DImode:
-         tmp = TARGET_AVX512VL ? "pandn<ssemodesuffix>" : "pandn";
+         ssesuffix = TARGET_AVX512VL ? "<ssemodesuffix>" : "";
          break;
        default:
-         tmp = TARGET_AVX512VL ? "pandnq" : "pandn";
-         break;
+         ssesuffix = TARGET_AVX512VL ? "q" : "";
        }
       break;
 
     case MODE_V16SF:
       gcc_assert (TARGET_AVX512F);
+      /* FALLTHRU */
     case MODE_V8SF:
       gcc_assert (TARGET_AVX);
+      /* FALLTHRU */
     case MODE_V4SF:
       gcc_assert (TARGET_SSE);
-      tmp = "andnps";
+      tmp = "andn";
+      ssesuffix = "ps";
       break;
 
     default:
@@ -11312,16 +11318,16 @@
   switch (which_alternative)
     {
     case 0:
-      ops = "%s\t{%%2, %%0|%%0, %%2}";
+      ops = "%s%s\t{%%2, %%0|%%0, %%2}";
       break;
     case 1:
-      ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
+      ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
       break;
     default:
       gcc_unreachable ();
     }
 
-  snprintf (buf, sizeof (buf), ops, tmp);
+  snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
   return buf;
 }
   [(set_attr "isa" "noavx,avx")
@@ -11387,6 +11393,7 @@
   static char buf[64];
   const char *ops;
   const char *tmp;
+  const char *ssesuffix;
 
   switch (get_attr_mode (insn))
     {
@@ -11398,17 +11405,18 @@
       /* FALLTHRU */
     case MODE_TI:
       gcc_assert (TARGET_SSE2);
+      tmp = "p<logic>";
       switch (<MODE>mode)
        {
        case V16SImode:
        case V8DImode:
-         tmp = "p<logic><ssemodesuffix>";
+         ssesuffix = "<ssemodesuffix>";
          break;
        case V8SImode:
        case V4DImode:
        case V4SImode:
        case V2DImode:
-         tmp = TARGET_AVX512VL ? "p<logic><ssemodesuffix>" : "p<logic>";
+         ssesuffix = TARGET_AVX512VL ? "<ssemodesuffix>" : "";
          break;
        default:
          gcc_unreachable ();
@@ -11417,9 +11425,11 @@
 
     case MODE_V8SF:
       gcc_assert (TARGET_AVX);
+      /* FALLTHRU */
     case MODE_V4SF:
       gcc_assert (TARGET_SSE);
-      tmp = "<logic>ps";
+      tmp = "<logic>";
+      ssesuffix = "ps";
       break;
 
     default:
@@ -11430,18 +11440,18 @@
     {
     case 0:
       if (<mask_applied>)
-        ops = "v%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, 
%%2}";
+        ops = "v%s%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, 
%%0, %%2}";
       else
-        ops = "%s\t{%%2, %%0|%%0, %%2}";
+        ops = "%s%s\t{%%2, %%0|%%0, %%2}";
       break;
     case 1:
-      ops = "v%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, 
%%2}";
+      ops = "v%s%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, 
%%2}";
       break;
     default:
       gcc_unreachable ();
     }
 
-  snprintf (buf, sizeof (buf), ops, tmp);
+  snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
   return buf;
 }
   [(set_attr "isa" "noavx,avx")
@@ -11492,11 +11502,11 @@
       /* FALLTHRU */
     case MODE_TI:
       gcc_assert (TARGET_SSE2);
+      tmp = "p<logic>";
       switch (<MODE>mode)
        {
        case V64QImode:
        case V32HImode:
-         tmp = "p<logic>";
          ssesuffix = "q";
          break;
        case V32QImode:
@@ -11503,7 +11513,6 @@
        case V16HImode:
        case V16QImode:
        case V8HImode:
-         tmp = "p<logic>";
          ssesuffix = TARGET_AVX512VL ? "q" : "";
          break;
        default:
@@ -11513,10 +11522,11 @@
 
     case MODE_V8SF:
       gcc_assert (TARGET_AVX);
+      /* FALLTHRU */
     case MODE_V4SF:
       gcc_assert (TARGET_SSE);
-      tmp = "<logic>ps";
-      ssesuffix = "";
+      tmp = "<logic>";
+      ssesuffix = "ps";
       break;
 
     default:
@@ -11526,17 +11536,16 @@
   switch (which_alternative)
     {
     case 0:
-      ops = "%s\t{%%2, %%0|%%0, %%2}";
-      snprintf (buf, sizeof (buf), ops, tmp);
+      ops = "%s%s\t{%%2, %%0|%%0, %%2}";
       break;
     case 1:
       ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
-      snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
       break;
     default:
       gcc_unreachable ();
     }
 
+  snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
   return buf;
 }
   [(set_attr "isa" "noavx,avx")

Reply via email to