diff mbox

[AArch64] Fix gcc.dg/torture/float32-builtin.c with RTL checking

Message ID 582D77CB.9090606@foss.arm.com
State New
Headers show

Commit Message

Kyrill Tkachov Nov. 17, 2016, 9:26 a.m. UTC
Hi all,

Testing with RTL checking enabled showed another failure in gcc.dg/torture/float32-builtin.c.
aarch64_float_const_zero_rtx_p was passed down a complex subreg expression during combine/recog.
The pattern was supposed to reject that expression but it made its way to aarch64_float_const_zero_rtx_p
which is only supposed to handle CONST_DOUBLEs.

The culprit is the aarch64_reg_or_fp_zero predicate that restricts the accepted codes to reg,subreg,const_double but
passes down anything that is not a reg into aarch64_float_const_zero_rtx_p. That includes SUBREGs that do not
match register_operand, which we want to reject.
This patch checks that the argument is a CONST_DOUBLE before passing it to aarch64_float_const_zero_rtx_p


Bootstrapped and tested on aarch64-none-linux-gnu with RTL checking enabled.

Ok for trunk?
Thanks,
Kyrill

P.S. This predicate is only used in the store-pair family of patterns.

2016-11-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/aarch64/predicates.md (aarch64_reg_or_fp_zero): Check for
     const_double code before calling aarch64_float_const_zero_rtx_p.

Comments

James Greenhalgh Nov. 17, 2016, 9:30 a.m. UTC | #1
On Thu, Nov 17, 2016 at 09:26:35AM +0000, Kyrill Tkachov wrote:
> Hi all,

> 

> Testing with RTL checking enabled showed another failure in gcc.dg/torture/float32-builtin.c.

> aarch64_float_const_zero_rtx_p was passed down a complex subreg expression during combine/recog.

> The pattern was supposed to reject that expression but it made its way to aarch64_float_const_zero_rtx_p

> which is only supposed to handle CONST_DOUBLEs.

> 

> The culprit is the aarch64_reg_or_fp_zero predicate that restricts the accepted codes to reg,subreg,const_double but

> passes down anything that is not a reg into aarch64_float_const_zero_rtx_p. That includes SUBREGs that do not

> match register_operand, which we want to reject.

> This patch checks that the argument is a CONST_DOUBLE before passing it to aarch64_float_const_zero_rtx_p

> 

> 

> Bootstrapped and tested on aarch64-none-linux-gnu with RTL checking enabled.

> 

> Ok for trunk?


OK.

Thanks,
James

> Thanks,

> Kyrill

> 

> P.S. This predicate is only used in the store-pair family of patterns.

> 

> 2016-11-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

> 

>     * config/aarch64/predicates.md (aarch64_reg_or_fp_zero): Check for

>     const_double code before calling aarch64_float_const_zero_rtx_p.
diff mbox

Patch

commit 950f8638a894aa699d1743fc3277b0aee3009fb7
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Tue Nov 15 16:04:39 2016 +0000

    [AArch64] Fix gcc.dg/torture/float32-builtin.c with RTL checking

diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md
index ebda6d8..0671cc8 100644
--- a/gcc/config/aarch64/predicates.md
+++ b/gcc/config/aarch64/predicates.md
@@ -54,9 +54,9 @@  (define_predicate "aarch64_reg_or_zero"
 	    (match_test "op == const0_rtx"))))
 
 (define_predicate "aarch64_reg_or_fp_zero"
-  (and (match_code "reg,subreg,const_double")
-       (ior (match_operand 0 "register_operand")
-	    (match_test "aarch64_float_const_zero_rtx_p (op)"))))
+  (ior (match_operand 0 "register_operand")
+	(and (match_code "const_double")
+	     (match_test "aarch64_float_const_zero_rtx_p (op)"))))
 
 (define_predicate "aarch64_reg_zero_or_m1_or_1"
   (and (match_code "reg,subreg,const_int")