diff mbox

Fix aarch64 bootstrap (pr69416)

Message ID 56A261E3.5020901@redhat.com
State New
Headers show

Commit Message

Richard Henderson Jan. 22, 2016, 5:07 p.m. UTC
The bare CONST_INT inside the CCmode IF_THEN_ELSE is causing combine to make 
incorrect simplifications.  At this stage it feels safer to wrap the CONST_INT 
inside of an UNSPEC than make more generic changes to combine.

But we should definitely investigate combine's CCmode issues for gcc7.


Ok?


r~
* config/aarch64/aarch64.md (UNSPEC_NZCV): New.
	(ccmp<mode>, fccmp<mode>, fccmpe<mode>): Use it.

Comments

Richard Earnshaw (lists) Jan. 22, 2016, 5:11 p.m. UTC | #1
On 22/01/16 17:07, Richard Henderson wrote:
> The bare CONST_INT inside the CCmode IF_THEN_ELSE is causing combine to
> make incorrect simplifications.  At this stage it feels safer to wrap
> the CONST_INT inside of an UNSPEC than make more generic changes to
> combine.
> 
> But we should definitely investigate combine's CCmode issues for gcc7.
> 

Agreed.

> 
> Ok?
> 
OK.

R.

> 
> r~
> 
> d-69416
> 
> 
> 	* config/aarch64/aarch64.md (UNSPEC_NZCV): New.
> 	(ccmp<mode>, fccmp<mode>, fccmpe<mode>): Use it.
> 	
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index 2f543aa..71fc514 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> @@ -129,6 +129,7 @@
>      UNSPEC_RSQRT
>      UNSPEC_RSQRTE
>      UNSPEC_RSQRTS
> +    UNSPEC_NZCV
>  ])
>  
>  (define_c_enum "unspecv" [
> @@ -280,7 +281,7 @@
>  	  (compare:CC
>  	    (match_operand:GPI 2 "register_operand" "r,r,r")
>  	    (match_operand:GPI 3 "aarch64_ccmp_operand" "r,Uss,Usn"))
> -	  (match_operand 5 "immediate_operand")))]
> +	  (unspec:CC [(match_operand 5 "immediate_operand")] UNSPEC_NZCV)))]
>    ""
>    "@
>     ccmp\\t%<w>2, %<w>3, %k5, %m4
> @@ -298,7 +299,7 @@
>  	  (compare:CCFP
>  	    (match_operand:GPF 2 "register_operand" "w")
>  	    (match_operand:GPF 3 "register_operand" "w"))
> -	  (match_operand 5 "immediate_operand")))]
> +	  (unspec:CCFP [(match_operand 5 "immediate_operand")] UNSPEC_NZCV)))]
>    "TARGET_FLOAT"
>    "fccmp\\t%<s>2, %<s>3, %k5, %m4"
>    [(set_attr "type" "fcmp<s>")]
> @@ -313,7 +314,7 @@
>  	   (compare:CCFPE
>  	    (match_operand:GPF 2 "register_operand" "w")
>  	    (match_operand:GPF 3 "register_operand" "w"))
> -	  (match_operand 5 "immediate_operand")))]
> +	  (unspec:CCFPE [(match_operand 5 "immediate_operand")] UNSPEC_NZCV)))]
>    "TARGET_FLOAT"
>    "fccmpe\\t%<s>2, %<s>3, %k5, %m4"
>    [(set_attr "type" "fcmp<s>")]
>
Christophe Lyon Jan. 25, 2016, 1:28 p.m. UTC | #2
On 22 January 2016 at 18:07, Richard Henderson <rth@redhat.com> wrote:
> The bare CONST_INT inside the CCmode IF_THEN_ELSE is causing combine to make
> incorrect simplifications.  At this stage it feels safer to wrap the
> CONST_INT inside of an UNSPEC than make more generic changes to combine.
>
> But we should definitely investigate combine's CCmode issues for gcc7.
>
>
> Ok?
>
Hi,

After this, I'm seeing this test now FAILs:
gcc.target/aarch64/ccmp_1.c scan-assembler adds\t

Christophe


>
> r~
Richard Henderson Jan. 25, 2016, 4:26 p.m. UTC | #3
On 01/25/2016 05:28 AM, Christophe Lyon wrote:
> After this, I'm seeing this test now FAILs:
> gcc.target/aarch64/ccmp_1.c scan-assembler adds\t

That test case is badly written.  In addition to that one, several of the other
failures that I see within that file are simply equally optimal alternative
choices for the compiler.  The file needs to be split up and simpler more
directed tests written.


r~
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 2f543aa..71fc514 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -129,6 +129,7 @@ 
     UNSPEC_RSQRT
     UNSPEC_RSQRTE
     UNSPEC_RSQRTS
+    UNSPEC_NZCV
 ])
 
 (define_c_enum "unspecv" [
@@ -280,7 +281,7 @@ 
 	  (compare:CC
 	    (match_operand:GPI 2 "register_operand" "r,r,r")
 	    (match_operand:GPI 3 "aarch64_ccmp_operand" "r,Uss,Usn"))
-	  (match_operand 5 "immediate_operand")))]
+	  (unspec:CC [(match_operand 5 "immediate_operand")] UNSPEC_NZCV)))]
   ""
   "@
    ccmp\\t%<w>2, %<w>3, %k5, %m4
@@ -298,7 +299,7 @@ 
 	  (compare:CCFP
 	    (match_operand:GPF 2 "register_operand" "w")
 	    (match_operand:GPF 3 "register_operand" "w"))
-	  (match_operand 5 "immediate_operand")))]
+	  (unspec:CCFP [(match_operand 5 "immediate_operand")] UNSPEC_NZCV)))]
   "TARGET_FLOAT"
   "fccmp\\t%<s>2, %<s>3, %k5, %m4"
   [(set_attr "type" "fcmp<s>")]
@@ -313,7 +314,7 @@ 
 	   (compare:CCFPE
 	    (match_operand:GPF 2 "register_operand" "w")
 	    (match_operand:GPF 3 "register_operand" "w"))
-	  (match_operand 5 "immediate_operand")))]
+	  (unspec:CCFPE [(match_operand 5 "immediate_operand")] UNSPEC_NZCV)))]
   "TARGET_FLOAT"
   "fccmpe\\t%<s>2, %<s>3, %k5, %m4"
   [(set_attr "type" "fcmp<s>")]