]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end/113344 - is_truth_type_for vs GENERIC tcc_comparison
authorRichard Biener <rguenther@suse.de>
Fri, 12 Jan 2024 07:33:48 +0000 (08:33 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 12 Jan 2024 08:51:16 +0000 (09:51 +0100)
On GENERIC tcc_comparison can have int type so restrict the PR113126
fix to vector types.

PR middle-end/113344
* match.pd ((double)float CMP (double)float -> float CMP float):
Perform result type check only for vectors.
* fold-const.cc (fold_binary_loc): Likewise.

gcc/fold-const.cc
gcc/match.pd

index 585c5099a37a01220f2fec52d2708db1a55078b9..385e4a69ab38d54e3f4ed8af31835e0cd91fa98a 100644 (file)
@@ -12901,7 +12901,7 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type,
          newtype = TREE_TYPE (targ1);
 
        if (element_precision (newtype) < element_precision (TREE_TYPE (arg0))
-           && is_truth_type_for (newtype, type))
+           && (!VECTOR_TYPE_P (type) || is_truth_type_for (newtype, type)))
          return fold_build2_loc (loc, code, type,
                              fold_convert_loc (loc, newtype, targ0),
                              fold_convert_loc (loc, newtype, targ1));
index 0bcf3153ff2da4038d6921fb131c195f780e7595..e42ecaf9ec789b4f9caedab8c2df3c403bbe6394 100644 (file)
@@ -6799,7 +6799,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
            ? TREE_TYPE (@00) : type1);
      }
      (if (element_precision (TREE_TYPE (@0)) > element_precision (newtype)
-         && is_truth_type_for (newtype, type))
+         && (!VECTOR_TYPE_P (type) || is_truth_type_for (newtype, type)))
       (cmp (convert:newtype @00) (convert:newtype @10))))))))