diff options
author | Richard Biener <rguenther@suse.de> | 2020-10-23 08:40:15 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-10-26 12:28:30 +0100 |
commit | 605c2a393d3a2db86454a70fd7c9467db434060c (patch) | |
tree | 0e268ceb12720c4f1395e88440321b79dab85230 /gcc/expr.c | |
parent | 4052c05e5b30fee0fb95a51e74e12a56dce29491 (diff) | |
download | gcc-605c2a393d3a2db86454a70fd7c9467db434060c.zip gcc-605c2a393d3a2db86454a70fd7c9467db434060c.tar.gz gcc-605c2a393d3a2db86454a70fd7c9467db434060c.tar.bz2 |
middle-end/97521 - always use single-bit bools in mask vector types
This makes us always use a single-bit boolean type component type
for integer mode mask VECTOR_BOOLEAN_TYPE_P to match the RTL and target
representation. This aovids the need for magic translation and
the inconsistencies from the translation requirement now that
we expose temporaries of those types on the GIMPLE level.
2020-10-23 Richard Biener <rguenther@suse.de>
PR middle-end/97521
* expr.c (const_scalar_mask_from_tree): Remove.
(expand_expr_real_1): Always VIEW_CONVERT integer mode
vector constants to an integer type.
* tree.c (build_truth_vector_type_for_mode): Use a single-bit
boolean component type for non-vector-mode mask_mode.
* gcc.target/i386/pr97521.c: New testcase.
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 39 |
1 files changed, 4 insertions, 35 deletions
@@ -96,7 +96,6 @@ static void emit_single_push_insn (machine_mode, rtx, tree); static void do_tablejump (rtx, machine_mode, rtx, rtx, rtx, profile_probability); static rtx const_vector_from_tree (tree); -static rtx const_scalar_mask_from_tree (scalar_int_mode, tree); static tree tree_expr_size (const_tree); static HOST_WIDE_INT int_expr_size (tree); static void convert_mode_scalar (rtx, rtx, int); @@ -10356,16 +10355,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))) - return const_scalar_mask_from_tree (int_mode, exp); - else - { - tree type_for_mode - = lang_hooks.types.type_for_mode (int_mode, 1); - if (type_for_mode) - tmp = fold_unary_loc (loc, VIEW_CONVERT_EXPR, - type_for_mode, exp); - } + tree type_for_mode = lang_hooks.types.type_for_mode (int_mode, 1); + if (type_for_mode) + tmp = fold_unary_loc (loc, VIEW_CONVERT_EXPR, + type_for_mode, exp); } if (!tmp) { @@ -12739,30 +12732,6 @@ const_vector_mask_from_tree (tree exp) return builder.build (); } -/* EXP is a VECTOR_CST in which each element is either all-zeros or all-ones. - Return a constant scalar rtx of mode MODE in which bit X is set if element - X of EXP is nonzero. */ -static rtx -const_scalar_mask_from_tree (scalar_int_mode mode, tree exp) -{ - wide_int res = wi::zero (GET_MODE_PRECISION (mode)); - tree elt; - - /* The result has a fixed number of bits so the input must too. */ - unsigned int nunits = VECTOR_CST_NELTS (exp).to_constant (); - for (unsigned int i = 0; i < nunits; ++i) - { - elt = VECTOR_CST_ELT (exp, i); - gcc_assert (TREE_CODE (elt) == INTEGER_CST); - if (integer_all_onesp (elt)) - res = wi::set_bit (res, i); - else - gcc_assert (integer_zerop (elt)); - } - - return immed_wide_int_const (res, mode); -} - /* Return a CONST_VECTOR rtx for a VECTOR_CST tree. */ static rtx const_vector_from_tree (tree exp) |