Richard Biener <richard.guent...@gmail.com> writes: > On Thu, Jul 11, 2019 at 10:03 AM Richard Sandiford > <richard.sandif...@arm.com> wrote: >> >> This patch rewrites the way simplify_subreg handles constants. >> It uses similar native_encode/native_decode routines to the >> tree-level handling of VIEW_CONVERT_EXPR, meaning that we can >> move between rtx constants and the target memory image of them. >> >> The main point of this patch is to support subregs of constant-length >> vectors for VLA vectors, beyond the very simple cases that were already >> handled. Many of the new tests failed before the patch for variable- >> length vectors. >> >> The boolean side is tested more by the upcoming SVE ACLE work. >> >> Tested on aarch64-linux-gnu, aarch64_be-elf and x86_64-linux-gnu. >> OK to install? > > Hmm. So is subreg [offset] defined in terms of memory order or in > terms of register order?
Memory order, except for the special case that paradoxical subregs always have an offset of zero (rather than the natural negative value for big-endian). > I wonder if you need to handle FLOAT_WORDS_BIG_ENDIAN, > REG_WORDS_BIG_ENDIAN and whether BYTES/WORDS_BIG_ENDIAN have any > meaning here at all? > > I'm always struggling with this when working on BIT_FIELD_REFs > on GIMPLE [registers]... Yeah. Yhe subreg_size_lsb stuff copes with BYTES/WORDS_BIG_ENDIAN. I used that in the patch exactly because I didn't want to have to redo the logic here :-) Because the offset is (mostly) the memory offset, REG_WORDS_BIG_ENDIAN doesn't affect this code. It instead affects how we divide up a multi-register hard register. (See subreg_get_info.) FLOAT_WORDS_BIG_ENDIAN is explicitly documented as not affecting subregs: @cindex @code{FLOAT_WORDS_BIG_ENDIAN}, (lack of) effect on @code{subreg} On a few targets, @code{FLOAT_WORDS_BIG_ENDIAN} disagrees with @code{WORDS_BIG_ENDIAN}. However, most parts of the compiler treat floating point values as if they had the same endianness as integer values. This works because they handle them solely as a collection of integer values, with no particular numerical value. Only real.c and the runtime libraries care about @code{FLOAT_WORDS_BIG_ENDIAN}. Thanks, Richard