tree-cfg.c (verify_gimple_assign_binary): Add verification for WIDEN_SUM_EXPR...
authorRichard Biener <rguenth@gcc.gnu.org>
Wed, 13 Sep 2017 08:09:31 +0000 (08:09 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 13 Sep 2017 08:09:31 +0000 (08:09 +0000)
2017-09-13  Richard Biener  <rguenther@suse.de>

* tree-cfg.c (verify_gimple_assign_binary): Add verification
for WIDEN_SUM_EXPR, VEC_WIDEN_MULT_{HI,LO,EVEN,ODD}_EXPR,
VEC_PACK_{TRUNC,SAT,FIX_TRUNC}_EXPR.
(verify_gimple_assign_ternary): Add verification for DOT_PROD_EXPR.

From-SVN: r252061

gcc/ChangeLog
gcc/tree-cfg.c

index 0ac2cf14c3fda5cef150d487458041e74220715a..26a7b75a45e337610dcd3abbdaf41639357cca64 100644 (file)
@@ -1,8 +1,15 @@
+2017-09-13  Richard Biener  <rguenther@suse.de>
+
+       * tree-cfg.c (verify_gimple_assign_binary): Add verification
+       for WIDEN_SUM_EXPR, VEC_WIDEN_MULT_{HI,LO,EVEN,ODD}_EXPR,
+       VEC_PACK_{TRUNC,SAT,FIX_TRUNC}_EXPR.
+       (verify_gimple_assign_ternary): Add verification for DOT_PROD_EXPR.
+
 2017-09-13  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        * config/aarch64/aarch64.c (aarch64_override_options_after_change_1):
-       Disable pc relative literal load irrespective of TARGET_FIX_ERR_A53_84341
-       for default.
+       Disable pc relative literal load irrespective of
+       TARGET_FIX_ERR_A53_84341 for default.
 
 2017-09-12  Eric Botcazou  <ebotcazou@adacore.com>
 
index b601012cfeddb546ee7a3d1ac02e2eb19b755f56..99d1f1e1af82ebf0b8cfe9a08956da841ac63458 100644 (file)
@@ -4013,15 +4013,80 @@ verify_gimple_assign_binary (gassign *stmt)
              || (TYPE_PRECISION (rhs1_type) != TYPE_PRECISION (rhs2_type)));
 
     case WIDEN_SUM_EXPR:
+      {
+        if (((TREE_CODE (rhs1_type) != VECTOR_TYPE
+             || TREE_CODE (lhs_type) != VECTOR_TYPE)
+            && ((!INTEGRAL_TYPE_P (rhs1_type)
+                 && !SCALAR_FLOAT_TYPE_P (rhs1_type))
+                || (!INTEGRAL_TYPE_P (lhs_type)
+                    && !SCALAR_FLOAT_TYPE_P (lhs_type))))
+           || !useless_type_conversion_p (lhs_type, rhs2_type)
+           || (GET_MODE_SIZE (element_mode (rhs2_type))
+               < 2 * GET_MODE_SIZE (element_mode (rhs1_type))))
+          {
+            error ("type mismatch in widening sum reduction");
+            debug_generic_expr (lhs_type);
+            debug_generic_expr (rhs1_type);
+            debug_generic_expr (rhs2_type);
+            return true;
+          }
+        return false;
+      }
+
     case VEC_WIDEN_MULT_HI_EXPR:
     case VEC_WIDEN_MULT_LO_EXPR:
     case VEC_WIDEN_MULT_EVEN_EXPR:
     case VEC_WIDEN_MULT_ODD_EXPR:
+      {
+        if (TREE_CODE (rhs1_type) != VECTOR_TYPE
+            || TREE_CODE (lhs_type) != VECTOR_TYPE
+           || !types_compatible_p (rhs1_type, rhs2_type)
+            || (GET_MODE_SIZE (element_mode (lhs_type))
+               != 2 * GET_MODE_SIZE (element_mode (rhs1_type))))
+          {
+            error ("type mismatch in vector widening multiplication");
+            debug_generic_expr (lhs_type);
+            debug_generic_expr (rhs1_type);
+            debug_generic_expr (rhs2_type);
+            return true;
+          }
+        return false;
+      }
+
     case VEC_PACK_TRUNC_EXPR:
+      /* ???  We currently use VEC_PACK_TRUNC_EXPR to simply concat
+        vector boolean types.  */
+      if (VECTOR_BOOLEAN_TYPE_P (lhs_type)
+         && VECTOR_BOOLEAN_TYPE_P (rhs1_type)
+         && types_compatible_p (rhs1_type, rhs2_type)
+         && (TYPE_VECTOR_SUBPARTS (lhs_type)
+             == 2 * TYPE_VECTOR_SUBPARTS (rhs1_type)))
+       return false;
+
+      /* Fallthru.  */
     case VEC_PACK_SAT_EXPR:
     case VEC_PACK_FIX_TRUNC_EXPR:
-      /* FIXME.  */
-      return false;
+      {
+        if (TREE_CODE (rhs1_type) != VECTOR_TYPE
+            || TREE_CODE (lhs_type) != VECTOR_TYPE
+            || !((rhs_code == VEC_PACK_FIX_TRUNC_EXPR
+                 && SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type))
+                 && INTEGRAL_TYPE_P (TREE_TYPE (lhs_type)))
+                || (INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))
+                    == INTEGRAL_TYPE_P (TREE_TYPE (lhs_type))))
+           || !types_compatible_p (rhs1_type, rhs2_type)
+            || (GET_MODE_SIZE (element_mode (rhs1_type))
+               != 2 * GET_MODE_SIZE (element_mode (lhs_type))))
+          {
+            error ("type mismatch in vector pack expression");
+            debug_generic_expr (lhs_type);
+            debug_generic_expr (rhs1_type);
+            debug_generic_expr (rhs2_type);
+            return true;
+          }
+
+        return false;
+      }
 
     case MULT_EXPR:
     case MULT_HIGHPART_EXPR:
@@ -4281,6 +4346,27 @@ verify_gimple_assign_ternary (gassign *stmt)
       return false;
 
     case DOT_PROD_EXPR:
+      {
+        if (((TREE_CODE (rhs1_type) != VECTOR_TYPE
+             || TREE_CODE (lhs_type) != VECTOR_TYPE)
+            && ((!INTEGRAL_TYPE_P (rhs1_type)
+                 && !SCALAR_FLOAT_TYPE_P (rhs1_type))
+                || (!INTEGRAL_TYPE_P (lhs_type)
+                    && !SCALAR_FLOAT_TYPE_P (lhs_type))))
+           || !types_compatible_p (rhs1_type, rhs2_type)
+           || !useless_type_conversion_p (lhs_type, rhs3_type)
+           || (GET_MODE_SIZE (element_mode (rhs3_type))
+               < 2 * GET_MODE_SIZE (element_mode (rhs1_type))))
+          {
+            error ("type mismatch in dot product reduction");
+            debug_generic_expr (lhs_type);
+            debug_generic_expr (rhs1_type);
+            debug_generic_expr (rhs2_type);
+            return true;
+          }
+        return false;
+      }
+
     case REALIGN_LOAD_EXPR:
       /* FIXME.  */
       return false;