aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorRobin Dapp <rdapp@ventanamicro.com>2024-08-20 14:02:09 +0200
committerRobin Dapp <rdapp@ventanamicro.com>2024-08-23 11:36:05 +0200
commit96fe95bac67c7303dc811c04f5e99cc959a7182a (patch)
treea0548a2bf04a8a44fff7bc53671e895d876db887 /gcc/expr.cc
parentc22d57cdc52d990eb7d353fa82c67882bc824d40 (diff)
downloadgcc-96fe95bac67c7303dc811c04f5e99cc959a7182a.zip
gcc-96fe95bac67c7303dc811c04f5e99cc959a7182a.tar.gz
gcc-96fe95bac67c7303dc811c04f5e99cc959a7182a.tar.bz2
optabs-query: Use opt_machine_mode for smallest_int_mode_for_size [PR115495].
In get_best_extraction_insn we use smallest_int_mode_for_size with struct_bits as size argument. PR115495 has struct_bits = 256 and we don't have a mode for that. This patch makes smallest_mode_for_size and smallest_int_mode_for_size return opt modes so we can just skip over the loop when there is no mode. PR middle-end/115495 gcc/ChangeLog: * cfgexpand.cc (expand_debug_expr): Require mode. * combine.cc (make_extraction): Ditto. * config/aarch64/aarch64.cc (aarch64_expand_cpymem): Ditto. (aarch64_expand_setmem): Ditto. * config/arc/arc.cc (arc_expand_cpymem): Ditto. * config/arm/arm.cc (arm_expand_divmod_libfunc): Ditto. * config/i386/i386.cc (ix86_get_mask_mode): Ditto. * config/rs6000/predicates.md: Ditto. * config/rs6000/rs6000.cc (vspltis_constant): Ditto. * config/s390/s390.cc (s390_expand_insv): Ditto. * config/sparc/sparc.cc (assign_int_registers): Ditto. * coverage.cc (get_gcov_type): Ditto. (get_gcov_unsigned_t): Ditto. * dse.cc (find_shift_sequence): Ditto. * expmed.cc (store_integral_bit_field): Ditto. * expr.cc (convert_mode_scalar): Ditto. (op_by_pieces_d::smallest_fixed_size_mode_for_size): Ditto. (emit_block_move_via_oriented_loop): Ditto. (copy_blkmode_to_reg): Ditto. (store_field): Ditto. * internal-fn.cc (expand_arith_overflow): Ditto. * machmode.h (HAVE_MACHINE_MODES): Ditto. (smallest_mode_for_size): Use opt_machine_mode. (smallest_int_mode_for_size): Use opt_scalar_int_mode. * optabs-query.cc (get_best_extraction_insn): Require mode. * optabs.cc (expand_twoval_binop_libfunc): Ditto. * stor-layout.cc (smallest_mode_for_size): Return opt_machine_mode. (layout_type): Require mode. (initialize_sizetypes): Ditto. * tree-ssa-loop-manip.cc (canonicalize_loop_ivs): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/pr115495.c: New test. gcc/ada/ChangeLog: * gcc-interface/utils2.cc (fast_modulo_reduction): Require mode. (nonbinary_modular_operation): Ditto.
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r--gcc/expr.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 2089c2b..8d17a5a 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -596,7 +596,7 @@ convert_mode_scalar (rtx to, rtx from, int unsignedp)
if (GET_MODE_CLASS (to_mode) == MODE_PARTIAL_INT)
{
scalar_int_mode full_mode
- = smallest_int_mode_for_size (GET_MODE_BITSIZE (to_mode));
+ = smallest_int_mode_for_size (GET_MODE_BITSIZE (to_mode)).require ();
gcc_assert (convert_optab_handler (trunc_optab, to_mode, full_mode)
!= CODE_FOR_nothing);
@@ -611,7 +611,7 @@ convert_mode_scalar (rtx to, rtx from, int unsignedp)
{
rtx new_from;
scalar_int_mode full_mode
- = smallest_int_mode_for_size (GET_MODE_BITSIZE (from_mode));
+ = smallest_int_mode_for_size (GET_MODE_BITSIZE (from_mode)).require ();
convert_optab ctab = unsignedp ? zext_optab : sext_optab;
enum insn_code icode;
@@ -1492,7 +1492,7 @@ op_by_pieces_d::smallest_fixed_size_mode_for_size (unsigned int size)
}
}
- return smallest_int_mode_for_size (size * BITS_PER_UNIT);
+ return smallest_int_mode_for_size (size * BITS_PER_UNIT).require ();
}
/* This function contains the main loop used for expanding a block
@@ -2385,10 +2385,10 @@ emit_block_move_via_oriented_loop (rtx x, rtx y, rtx size,
if (mode != GET_MODE (y_addr))
{
scalar_int_mode xmode
- = smallest_int_mode_for_size (GET_MODE_BITSIZE (mode));
+ = smallest_int_mode_for_size (GET_MODE_BITSIZE (mode)).require ();
scalar_int_mode ymode
= smallest_int_mode_for_size (GET_MODE_BITSIZE
- (GET_MODE (y_addr)));
+ (GET_MODE (y_addr))).require ();
if (GET_MODE_BITSIZE (xmode) < GET_MODE_BITSIZE (ymode))
mode = ymode;
else
@@ -3667,7 +3667,7 @@ copy_blkmode_to_reg (machine_mode mode_in, tree src)
n_regs = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
dst_words = XALLOCAVEC (rtx, n_regs);
bitsize = MIN (TYPE_ALIGN (TREE_TYPE (src)), BITS_PER_WORD);
- min_mode = smallest_int_mode_for_size (bitsize);
+ min_mode = smallest_int_mode_for_size (bitsize).require ();
/* Copy the structure BITSIZE bits at a time. */
for (bitpos = 0, xbitpos = padding_correction;
@@ -8205,7 +8205,8 @@ store_field (rtx target, poly_int64 bitsize, poly_int64 bitpos,
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
machine_mode temp_mode = GET_MODE (temp);
if (temp_mode == BLKmode || temp_mode == VOIDmode)
- temp_mode = smallest_int_mode_for_size (size * BITS_PER_UNIT);
+ temp_mode
+ = smallest_int_mode_for_size (size * BITS_PER_UNIT).require ();
rtx temp_target = gen_reg_rtx (temp_mode);
emit_group_store (temp_target, temp, TREE_TYPE (exp), size);
temp = temp_target;
@@ -8279,7 +8280,7 @@ store_field (rtx target, poly_int64 bitsize, poly_int64 bitpos,
word size, we need to load the value (see again store_bit_field). */
if (GET_MODE (temp) == BLKmode && known_le (bitsize, BITS_PER_WORD))
{
- temp_mode = smallest_int_mode_for_size (bitsize);
+ temp_mode = smallest_int_mode_for_size (bitsize).require ();
temp = extract_bit_field (temp, bitsize, 0, 1, NULL_RTX, temp_mode,
temp_mode, false, NULL);
}