From: Jonathan Wright Date: Mon, 11 Oct 2021 22:02:16 +0000 (+0100) Subject: gcc/expmed.c: Ensure vector modes are tieable before extraction X-Git-Tag: upstream/12.2.0~3788 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e5929e4575922015ff4634af4dea59c59a44f10;p=platform%2Fupstream%2Fgcc.git gcc/expmed.c: Ensure vector modes are tieable before extraction Extracting a bitfield from a vector can be achieved by casting the vector to a new type whose elements are the same size as the desired bitfield, before generating a subreg. However, this is only an optimization if the original vector can be accessed in the new machine mode without first being copied - a condition denoted by the TARGET_MODES_TIEABLE_P hook. This patch adds a check to make sure that the vector modes are tieable before attempting to generate a subreg. This is a necessary prerequisite for a subsequent patch that will introduce new machine modes for Arm Neon vector-tuple types. gcc/ChangeLog: 2021-10-11 Jonathan Wright * expmed.c (extract_bit_field_1): Ensure modes are tieable. --- diff --git a/gcc/expmed.c b/gcc/expmed.c index bbdd0e7..4abce11 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -1735,7 +1735,8 @@ extract_bit_field_1 (rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, FOR_EACH_MODE_FROM (new_mode, new_mode) if (known_eq (GET_MODE_SIZE (new_mode), GET_MODE_SIZE (GET_MODE (op0))) && known_eq (GET_MODE_UNIT_SIZE (new_mode), GET_MODE_SIZE (tmode)) - && targetm.vector_mode_supported_p (new_mode)) + && targetm.vector_mode_supported_p (new_mode) + && targetm.modes_tieable_p (GET_MODE (op0), new_mode)) break; if (new_mode != VOIDmode) op0 = gen_lowpart (new_mode, op0);