aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-09-03 12:44:40 +0200
committerRichard Biener <rguenther@suse.de>2020-09-03 12:47:59 +0200
commitb246f5272eb7242a9cefe5b4e7220be9d86ea512 (patch)
tree1f7a696836df0185d80f2ec8e97961107f414ea1 /gcc/fold-const.c
parent3cc3a373fe5ceb66839daca6861188d04c98362e (diff)
downloadgcc-b246f5272eb7242a9cefe5b4e7220be9d86ea512.zip
gcc-b246f5272eb7242a9cefe5b4e7220be9d86ea512.tar.gz
gcc-b246f5272eb7242a9cefe5b4e7220be9d86ea512.tar.bz2
Improve constant folding of vector lowering with vector bools
This improves the situation somewhat when vector lowering tries to access vector bools as seen in PR96814. 2020-09-03 Richard Biener <rguenther@suse.de> * tree-vect-generic.c (tree_vec_extract): Remove odd special-casing of boolean vectors. * fold-const.c (fold_ternary_loc): Handle boolean vector type BIT_FIELD_REFs.
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 1f86163..0cc80ad 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -12581,7 +12581,9 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
&& tree_fits_uhwi_p (op2))
{
tree eltype = TREE_TYPE (TREE_TYPE (arg0));
- unsigned HOST_WIDE_INT width = tree_to_uhwi (TYPE_SIZE (eltype));
+ unsigned HOST_WIDE_INT width
+ = (TREE_CODE (eltype) == BOOLEAN_TYPE
+ ? TYPE_PRECISION (eltype) : tree_to_uhwi (TYPE_SIZE (eltype)));
unsigned HOST_WIDE_INT n = tree_to_uhwi (arg1);
unsigned HOST_WIDE_INT idx = tree_to_uhwi (op2);