This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RTL alternative selection question
- From: Andrew Stubbs <andrew_stubbs at mentor dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>, Richard Sandiford <richard dot sandiford at arm dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 1 Oct 2019 13:12:06 +0100
- Subject: Re: RTL alternative selection question
- Ironport-sdr: +p9oPWJxwA5aeBWYax4YyaZ9HUkCWVq9+PgaTdRG0NITm/tKhjf7aWzZmRUR8bD5Lkvl3i2TuU Ij6vrmsHYesmCxqghBtkZOglIcunHqHkFuKnqkDfU9MElNOtMJyV+jcOgh/BaQ8i4k1Nx/Hxzk O0rDoD0T5PFtnnpmthWdYisIeA4aVgXriUlpJ2OSWyvno5DUj/vQ9AQ0AMmIo7a3eYrRu3iqhQ bhOJaftacE4zV6NbgrKWGnAGoi8YmUKtbbn/ctrJ03027uNkjPOW07Kabw7mRi2nsTZ6WpdeQJ 15Y=
- Ironport-sdr: c9CtHR+8v+XeWQT2SQngOIxxweEWENwQbIlaxOEL44lMxH8XXYDKGUREbNDv3/7HRNLHLbuela GDxCcM0ixWblTsDhmvrI9tsYQ0fXN9+KeZifxn60DUPQzbxrSq5WTLezTtU6MsKRlA/vijwehd R1bMndYDs88c+sPbVC23nJYeIFcX9+EOBvcMOHvQ6Z1MIul+9BUc2vwvtVIz3ED0Jn3bMphJg9 fdw36utxzuAfg7jb54apvKZRA4Ajv2Vm5yEB0tbOmzVbAc842WfMRI4Wx9EWzZNN1RsVBWbDDQ DEY=
- References: <1a7febb4-197e-eca7-4fcf-99bf5cb8bdf6@mentor.com> <20190923141517.GH9749@gate.crashing.org> <57be9ba9-94b3-3aea-37ce-ca2cd55bd34c@mentor.com>
On 23/09/2019 15:39, Andrew Stubbs wrote:
On 23/09/2019 15:15, Segher Boessenkool wrote:
On Mon, Sep 23, 2019 at 11:56:27AM +0100, Andrew Stubbs wrote:
[(set (match_operand:DI 0 "register_operand" "=Sg,v")
(ashift:DI
(match_operand:DI 1 "gcn_alu_operand" " Sg,v")
(match_operand:SI 2 "gcn_alu_operand" " Sg,v")))
(clobber (match_scratch:BI 3 "=cs,X"))]
Unfortunately, the compiler (almost?) exclusively selects the second
alternative, even when this means moving the values from one register
file to the other, and then back again.
The problem is that the scalar instruction clobbers the CC register,
which results in a "reject++" for that alternative in the LRA dump.
What kind of reject? It prints a reason, too.
0 Non input pseudo reload: reject++
Apparently I was confused by operand "0" versus alternative "0". That
message did occur, but it wasn't the only one. Here's all of it:
0 Non input pseudo reload: reject++
3 Scratch win: reject+=2
alt=0,overall=9,losers=1,rld_nregs=2
alt=1,overall=6,losers=1,rld_nregs=2
I don't understand why the "reject++" occurs, but presumably has to do
with the "Sg" register availability somehow?
The "Scratch win" part comes from this code:
/* We simulate the behavior of old reload here.
Although scratches need hard registers and it
might result in spilling other pseudos, no reload
insns are generated for the scratches. So it
might cost something but probably less than old
reload pass believes. */
if (scratch_p)
{
if (lra_dump_file != NULL)
fprintf (lra_dump_file,
" %d Scratch win: reject+=2\n",
nop);
reject += 2;
}
}
Would it make sense to skip this reject when CLASS_LIKELY_SPILLED_P, as
Jeff suggested?
Unfortunately, removing the "Scratch win" penalty alone is not enough
for LRA to select the first alternative -- at least, no in my testcase
-- so I need to understand the "non input pseudo reload" issue as well.
I can see why it fires for alt0, but not why it does not fire for alt1.
Andrew