This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][simplify-rtx][2/2] Use constants from pool when simplifying binops
- From: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- To: Bernd Schmidt <bschmidt at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, Segher Boessenkool <segher at kernel dot crashing dot org>
- Date: Mon, 19 Oct 2015 15:37:40 +0100
- Subject: Re: [PATCH][simplify-rtx][2/2] Use constants from pool when simplifying binops
- Authentication-results: sourceware.org; auth=none
- References: <5624F6E2 dot 6090501 at arm dot com> <5624FECB dot 5030105 at redhat dot com>
Hi Bernd,
On 19/10/15 15:31, Bernd Schmidt wrote:
On 10/19/2015 03:57 PM, Kyrill Tkachov wrote:
This second patch teaches simplify_binary_operation to return the
dereferenced
constants from the constant pool in the binary expression if other
simplifications failed.
This, combined with the 1/2 patch for aarch64
(https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01744.html) allow for:
int
foo (float a)
{
return a * 32.0f;
}
to generate the code:
foo:
fcvtzs w0, s0, #5
ret
because combine now successfully tries to match:
(set (reg/i:SI 0 x0)
(fix:SI (mult:SF (reg:SF 32 v0 [ a ])
(const_double:SF 3.2e+1 [0x0.8p+6]))))
whereas before it would not try the to use the const_double directly
but rather its constant pool reference.
The only way I could see a problem with that if there are circumstances where the memory variant would simplify further. That doesn't seem highly likely, so...
I that were the case, I'd expect the earlier call to simplify_binary_operation_1 have returned a non-NULL rtx,
and the code in this patch would not come into play.
* simplify-rtx.c (simplify_binary_operation): If either operand was
a constant pool reference use them if all other simplifications
failed.
Ok.
Thanks,
I'll commit it when the first (aarch64-specific) patch is approved.
Kyrill
Bernd