diff options
author | Richard Biener <rguenther@suse.de> | 2020-09-23 14:20:44 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-09-23 15:11:03 +0200 |
commit | bc909324bda71543add2229adfa59d8daff5f0db (patch) | |
tree | 3d7b7ac497f1b5f0a4a77c5f863f969f4164914b /gcc | |
parent | 4452a7660b224ff310d246bc7f8c612669c8cd98 (diff) | |
download | gcc-bc909324bda71543add2229adfa59d8daff5f0db.zip gcc-bc909324bda71543add2229adfa59d8daff5f0db.tar.gz gcc-bc909324bda71543add2229adfa59d8daff5f0db.tar.bz2 |
middle-end/96466 - fix VEC_COND isel/expansion issue
We need to avoid forcing BLKmode for truth vectors, instead do as
other code and use VOIDmode so layout_type can pick a suitable and
consistent mode. RTL expansion of vect_cond_mask also needs to deal
with CONST_INT operands which means passing the mode explicitely.
2020-09-23 Richard Biener <rguenther@suse.de>
PR middle-end/96466
* internal-fn.c (expand_vect_cond_mask_optab_fn): Use
appropriate mode for force_reg.
* tree.c (build_truth_vector_type_for): Pass VOIDmode to
make_vector_type.
* gcc.dg/pr96466.c: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/internal-fn.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr96466.c | 19 | ||||
-rw-r--r-- | gcc/tree.c | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c index 8efc77d..6cf2687 100644 --- a/gcc/internal-fn.c +++ b/gcc/internal-fn.c @@ -2644,7 +2644,7 @@ expand_vect_cond_mask_optab_fn (internal_fn, gcall *stmt, convert_optab optab) rtx_op2 = expand_normal (op2); mask = force_reg (mask_mode, mask); - rtx_op1 = force_reg (GET_MODE (rtx_op1), rtx_op1); + rtx_op1 = force_reg (mode, rtx_op1); rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); create_output_operand (&ops[0], target, mode); diff --git a/gcc/testsuite/gcc.dg/pr96466.c b/gcc/testsuite/gcc.dg/pr96466.c new file mode 100644 index 0000000..a8840f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr96466.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/96466 */ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-Og -finline-functions-called-once -fno-tree-ccp" } */ + +typedef unsigned long __attribute__ ((__vector_size__ (8))) V; + +V +bar (unsigned long x, V v) +{ + v &= x >= v; + return (V) v; +} + +V +foo (void) +{ + return bar (5, (V) 4441221375); +} @@ -10952,7 +10952,7 @@ build_truth_vector_type_for (tree vectype) unsigned HOST_WIDE_INT esize = vector_element_size (vsize, nunits); tree bool_type = build_nonstandard_boolean_type (esize); - return make_vector_type (bool_type, nunits, BLKmode); + return make_vector_type (bool_type, nunits, VOIDmode); } /* Like build_vector_type, but builds a variant type with TYPE_VECTOR_OPAQUE |