This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Use the improved get_attr_length in min_insn_size
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Jun 2009 23:24:19 +0200
- Subject: Re: [PATCH] Use the improved get_attr_length in min_insn_size
- References: <20090610201412.GD4822@tyan-ft48-01.lab.bos.redhat.com> <4A302255.firstname.lastname@example.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Jun 10, 2009 at 11:15:01PM +0200, Uros Bizjak wrote:
> On 06/10/2009 10:14 PM, Jakub Jelinek wrote:
>> After the large ix86 insn length computation bugfixes get_attr_length is
>> something we can almost always trust (and if it very rarely happens to be
>> too large, worst case we end up with 4 jumps in 16 bytes, the world doesn't
>> end). This saves 38KB (resp. 33KB for 32-bit) .text from cc1plus.
>> No regressions in test4jmp.sh report on cc1plus.
>> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>> 2009-06-10 Jakub Jelinek<email@example.com>
>> * config/i386/i386.c (min_insn_size): Use get_attr_length
>> for normal insns other than TYPE_MULTI, TYPE_OTHER and TYPE_FCMP.
>> For __asm return 0.
> Please note, that w.r.t. to __asm statements, we have following in i386.md:
> ;; Describe a user's asm statement.
> [(set_attr "length" "128")
> (set_attr "type" "multi")])
> Although, the length of 128 is IMO a bit high for average asm. I think
> that we should use default value of 16, as it stands for type multi. I
> didn't investigate, if this define is used at all in the compiler source.
get_attr_length is defined as maximum insn length, i.e. upper bound, while
in min_insn_size we want lower bound (it is not fatal if it is not always
lower bound, but at least in most cases it should be). And many __asm's
are zero length. When get_attr_length is not upper bound, but exactly
correct (in most cases it is, the exceptions are multi/other/fcmp insns,
%H using patterns in rare cases, avx vex encoded insns with extended regs
in some cases (but for those ATM get_attr_length returns sometimes one byte
smaller value than it should, i.e. min_insn_size is happy)), min_insn_size
can use it as lower bound as well.