aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-10-22 09:29:47 +0200
committerRichard Biener <rguenther@suse.de>2020-10-22 12:59:33 +0200
commitb960a9c83a93b58a84a7a370002990810675ac5d (patch)
treea1bc199ac4abd02fdc1b27a6556e58529b932bd9 /gcc/expr.c
parente14c2bdce0c058587bff56883cd22603eceeb0b0 (diff)
downloadgcc-b960a9c83a93b58a84a7a370002990810675ac5d.zip
gcc-b960a9c83a93b58a84a7a370002990810675ac5d.tar.gz
gcc-b960a9c83a93b58a84a7a370002990810675ac5d.tar.bz2
middle-end/97521 - fix VECTOR_CST expansion
This fixes expansion of VECTOR_BOOLEAN_TYPE_P VECTOR_CSTs which when using an integer mode are not always "mask-mode" but may be using an integer mode when there's no supported vector mode. The patch makes sure to only go the mask-mode expansion if the elements do not line up to cover the full integer mode (when they do and the mode was an actual mask-mode there's no actual difference in both expansions). 2020-10-22 Richard Biener <rguenther@suse.de> PR middle-end/97521 * expr.c (expand_expr_real_1): Be more careful when expanding a VECTOR_BOOLEAN_TYPE_P VECTOR_CSTs. * gcc.target/i386/pr97521.c: New testcase.
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 9d951e8..d87bda7 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10356,7 +10356,10 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
scalar_int_mode int_mode;
if (is_int_mode (mode, &int_mode))
{
- if (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (exp)))
+ if (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (exp))
+ && maybe_ne (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (exp)))
+ * TYPE_VECTOR_SUBPARTS (TREE_TYPE (exp)),
+ GET_MODE_PRECISION (int_mode)))
return const_scalar_mask_from_tree (int_mode, exp);
else
{