diff options
author | Richard Biener <rguenther@suse.de> | 2024-01-11 12:02:43 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2024-01-11 15:08:02 +0100 |
commit | 897b95a12b7fe549ec2cb8ef3a3f0e4fbabf9737 (patch) | |
tree | 34ff55139b9f706253c684745d9d954e4abf0e3c /gcc/match.pd | |
parent | 05e8ef2a05b477589cae25af3311bad0f68a90fe (diff) | |
download | gcc-897b95a12b7fe549ec2cb8ef3a3f0e4fbabf9737.zip gcc-897b95a12b7fe549ec2cb8ef3a3f0e4fbabf9737.tar.gz gcc-897b95a12b7fe549ec2cb8ef3a3f0e4fbabf9737.tar.bz2 |
tree-optimization/113126 - vector extension compare optimization
The following makes sure the resulting boolean type is the same
when eliding a float extension.
PR tree-optimization/113126
* match.pd ((double)float CMP (double)float -> float CMP float):
Make sure the boolean type is the same.
* fold-const.cc (fold_binary_loc): Likewise.
* gcc.dg/torture/pr113126.c: New testcase.
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index 876a9d1..abbd037 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -6792,11 +6792,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && exact_real_truncate (TYPE_MODE (double_type_node), &orig)) type1 = double_type_node; } - tree newtype - = (element_precision (TREE_TYPE (@00)) > element_precision (type1) - ? TREE_TYPE (@00) : type1); + tree newtype + = (element_precision (TREE_TYPE (@00)) > element_precision (type1) + ? TREE_TYPE (@00) : type1); } - (if (element_precision (TREE_TYPE (@0)) > element_precision (newtype)) + (if (element_precision (TREE_TYPE (@0)) > element_precision (newtype) + && is_truth_type_for (newtype, type)) (cmp (convert:newtype @00) (convert:newtype @10)))))))) |