diff mbox

[AArch64] Fix SIMD predicate

Message ID 56FBFC53.10709@samsung.com
State New
Headers show

Commit Message

Evandro Menezes March 30, 2016, 4:18 p.m. UTC
Add scalar 0.0 to the aarch64_simd_reg_or_zero predicate.

    2016-03-30  Evandro Menezes  <e.menezes@samsung.com>

         * gcc/config/aarch64/predicates.md
         (aarch64_simd_reg_or_zero predicate): Add the "const_double"
    constraint.


It seems to me that the aarch64_simd_reg_or_zero should also handle the 
scalar constant 0.0 as well.

OK to commit?

Thank you,

Comments

James Greenhalgh March 31, 2016, 9:52 a.m. UTC | #1
On Wed, Mar 30, 2016 at 11:18:27AM -0500, Evandro Menezes wrote:
>    Add scalar 0.0 to the aarch64_simd_reg_or_zero predicate.
> 
>    2016-03-30  Evandro Menezes  <e.menezes@samsung.com>
> 
>         * gcc/config/aarch64/predicates.md
>         (aarch64_simd_reg_or_zero predicate): Add the "const_double"
>    constraint.
> 
> 
> It seems to me that the aarch64_simd_reg_or_zero should also handle
> the scalar constant 0.0 as well.

It took me an extra few minutes to figure out why this patch was correct - a
more detailed description of what the code-gen issue this was intended to
fix would have helped. The only pattern I can see for which this matters
is aarch64_cm<optab><mode> for the SF and DF modes. Clearly the predicate
is too tight here, and the relaxation you propose is correct.

> OK to commit?

OK, and low-risk enough to take now.

Thanks,
James
Evandro Menezes April 1, 2016, 7:56 p.m. UTC | #2
On 03/31/16 04:52, James Greenhalgh wrote:
> On Wed, Mar 30, 2016 at 11:18:27AM -0500, Evandro Menezes wrote:
>>     Add scalar 0.0 to the aarch64_simd_reg_or_zero predicate.
>>
>>     2016-03-30  Evandro Menezes  <e.menezes@samsung.com>
>>
>>          * gcc/config/aarch64/predicates.md
>>          (aarch64_simd_reg_or_zero predicate): Add the "const_double"
>>     constraint.
>>
>>
>> It seems to me that the aarch64_simd_reg_or_zero should also handle
>> the scalar constant 0.0 as well.
> It took me an extra few minutes to figure out why this patch was correct - a
> more detailed description of what the code-gen issue this was intended to
> fix would have helped. The only pattern I can see for which this matters
> is aarch64_cm<optab><mode> for the SF and DF modes. Clearly the predicate
> is too tight here, and the relaxation you propose is correct.

I'm sorry.  Indeed, I meant this change for that very pattern for the 
scalar FP version, since it's the only instance when this predicate is 
used along with the constraint Y.  Without this patch, this constraint 
never matches.

>> OK to commit?
> OK, and low-risk enough to take now.

Bootstrapped and checked on aarch64-unknown-linux-gnu.  Committed as 
r234685.

Thank you,
diff mbox

Patch

diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md
index 1186827..8f2726d 100644
--- a/gcc/config/aarch64/predicates.md
+++ b/gcc/config/aarch64/predicates.md
@@ -302,7 +302,7 @@ 
 })
 
 (define_predicate "aarch64_simd_reg_or_zero"
-  (and (match_code "reg,subreg,const_int,const_vector")
+  (and (match_code "reg,subreg,const_int,const_double,const_vector")
        (ior (match_operand 0 "register_operand")
            (ior (match_test "op == const0_rtx")
                 (match_test "aarch64_simd_imm_zero_p (op, mode)")))))