On Fri, Jan 3, 2014 at 9:48 AM, Jakub Jelinek <ja...@redhat.com> wrote:
> I've noticed that especially with the AVX512F introduction we use > GET_MODE_SIZE (<MODE>mode) quite heavily in the i386 *.md files, and > the problem with that is GET_MODE_SIZE isn't a compile time constant, > needs to read mode_size array (non-const) at runtime. > > This patch attempts to decrease the enormous .text/.rodata growth from AVX512F > introduction a little bit and improve generated code, by making > GET_MODE_SIZE (<MODE>mode) compile time constants, thus all the > GET_MODE_SIZE (<MODE>mode) == 64 and similar tests can fold into > false/true. The patch saves ~ 110KB of .text (both x86_64 and i686) > and ~ 50KB of .rodata (x86_64) or ~ 27KB of .rodata (i686). > > The disadvantage is that the mode attribute duplicates insn-modes.c, > but I guess the listed modes aren't going to change their sizes ever > on this target, and if some mode isn't listed and used in some mode > iterator, one would get syntax errors from insn-*.[ch] and so it wouldn't be > hard to add it. This should be tolerable, at least for gains, shown above. OTOH, we already have some attributes (e.g. ssescalarnum, ssescalarsize) that use the same approach and the sky didn't fall down. > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2014-01-03 Jakub Jelinek <ja...@redhat.com> > > * config/i386/i386.md (MODE_SIZE): New mode attribute. > (push splitter): Use <P:MODE_SIZE> instead of > GET_MODE_SIZE (<P:MODE>mode). > (lea splitter): Use <MODE_SIZE> instead of GET_MODE_SIZE (<MODE>mode). > (mov -1, reg peephole2): Likewise. > * config/i386/sse.md (*mov<mode>_internal, > <sse>_storeu<ssemodesuffix><avxsizesuffix>, > <sse2_avx_avx512f>_storedqu<mode>, <sse>_andnot<mode>3, > *<code><mode>3, *andnot<mode>3<mask_name>, > <mask_codefor><code><mode>3<mask_name>): Likewise. > * config/i386/subst.md (mask_mode512bit_condition, > sd_mask_mode512bit_condition): Likewise. OK for mainline. Thanks, Uros.