This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][ARM] PR target/67929 Tighten vfp3_const_double_for_bits checks
- From: Yvan Roux <yvan dot roux at linaro dot org>
- To: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- Cc: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Sun, 1 Nov 2015 20:22:18 +0100
- Subject: Re: [PATCH][ARM] PR target/67929 Tighten vfp3_const_double_for_bits checks
- Authentication-results: sourceware.org; auth=none
- References: <561E4941 dot 6030204 at arm dot com> <CAJA7tRb86KziwJrB9tB-=7b5h6kY=AnHJFa3GAR_hA4sCP7dRw at mail dot gmail dot com>
Hi Kyrill,
On 27 October 2015 at 13:08, Ramana Radhakrishnan
<ramana.gcc@googlemail.com> wrote:
> On Wed, Oct 14, 2015 at 1:23 PM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
>> Hi all,
>>
>> This patch fixes the referenced PR by rewriting the
>> vfp3_const_double_for_bits function in arm.c
>> The function is supposed to accept positive CONST_DOUBLE rtxes whose value
>> is an exact power of 2
>> and whose log2 is between 1 and 32. That is values like 2.0, 4.0, 8.9, 16.0
>> etc...
>>
>> The current implementation seems to have been written under the assumption
>> that exact_real_truncate returns
>> false if the input value is not an exact integer, whereas in fact
>> exact_real_truncate returns false if the
>> truncation operation was not exact, which are different things. This would
>> lead the function to accept any
>> CONST_DOUBLE that can truncate to a power of 2, such as 4.9, 16.2 etc.
>>
>> In any case, I've rewritten this function and used the real_isinteger
>> predicate to check if the real value
>> is an exact integer.
>>
>> The testcase demonstrates the kind of wrong code that this patch addresses.
>>
>> This bug appears on GCC 5 and 4.9 as well, but due to the recent
>> introduction of CONST_DOUBLE_REAL_VALUE
>> this patch doesn't apply on those branches. I will soon post the
>> backportable variant.
>>
>> Bootstrapped and tested on arm-none-linux-gnueabihf.
>>
>> Ok for trunk?
>
>
> Thanks, this is OK for trunk and all release branches.
>
> Ramana
>
>>
>> Thanks,
>> Kyrill
>>
>> 2015-10-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>>
>> PR target/67929
>> * config/arm/arm.c (vfp3_const_double_for_bits): Rewrite.
>> * config/arm/constraints.md (Dp): Update callsite.
>> * config/arm/predicates.md (const_double_vcvt_power_of_two): Likewise.
>>
>> 2015-10-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>>
>> PR target/67929
>> * gcc.target/arm/pr67929_1.c: New test.
This test fails when tested on hard-float targets, adding the
following line to avoid testing it in such cases will fix the issue,
but I wonder if there is a better dejaGNU directives sequence to do
that.
/* { dg-skip-if "avoid conflicting multilib options" { *-*-*eabihf } {
"*" } { "" } } */
Cheers,
Yvan