public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix aarch64 bootstrap (pr69416)
@ 2016-01-22 17:07 Richard Henderson
  2016-01-22 17:11 ` Richard Earnshaw (lists)
  2016-01-25 13:28 ` Christophe Lyon
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Henderson @ 2016-01-22 17:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: Marcus Shawcroft, Richard Earnshaw, Segher Boessenkool

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

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~

[-- Attachment #2: d-69416 --]
[-- Type: text/plain, Size: 1418 bytes --]

	* 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>")]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix aarch64 bootstrap (pr69416)
  2016-01-22 17:07 [PATCH] Fix aarch64 bootstrap (pr69416) Richard Henderson
@ 2016-01-22 17:11 ` Richard Earnshaw (lists)
  2016-01-25 13:28 ` Christophe Lyon
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Earnshaw (lists) @ 2016-01-22 17:11 UTC (permalink / raw)
  To: Richard Henderson, gcc-patches; +Cc: Marcus Shawcroft, Segher Boessenkool

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>")]
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix aarch64 bootstrap (pr69416)
  2016-01-22 17:07 [PATCH] Fix aarch64 bootstrap (pr69416) Richard Henderson
  2016-01-22 17:11 ` Richard Earnshaw (lists)
@ 2016-01-25 13:28 ` Christophe Lyon
  2016-01-25 16:27   ` Richard Henderson
  1 sibling, 1 reply; 5+ messages in thread
From: Christophe Lyon @ 2016-01-25 13:28 UTC (permalink / raw)
  To: Richard Henderson
  Cc: gcc-patches, Marcus Shawcroft, Richard Earnshaw, Segher Boessenkool

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~

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix aarch64 bootstrap (pr69416)
  2016-01-25 13:28 ` Christophe Lyon
@ 2016-01-25 16:27   ` Richard Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2016-01-25 16:27 UTC (permalink / raw)
  To: Christophe Lyon
  Cc: gcc-patches, Marcus Shawcroft, Richard Earnshaw, Segher Boessenkool

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~

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix aarch64 bootstrap (pr69416)
@ 2016-01-25 18:32 Wilco Dijkstra
  0 siblings, 0 replies; 5+ messages in thread
From: Wilco Dijkstra @ 2016-01-25 18:32 UTC (permalink / raw)
  To: Richard Henderson, Christophe Lyon; +Cc: gcc-patches, nd

Richard Henderson wrote:
> 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.

The test case was written specifically to emit 'adds' as that is the optimal 
sequence. It is a regression caused by wrapping the immediate in a unspec which
disables costing of all CCMPs... I have a patch for this. 

The zero issue is due to the testcase assuming GCC emits '0' and 'wzr' correctly -
it was based on a very old patch that emits the correct zero for compares that hasn't
been OK'd yet. And the failure to emit an fccmp is due to a recent fix to NaN handling
in compares, so that testcase now needs -ffinite-math-only.

Wilco

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-25 18:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-22 17:07 [PATCH] Fix aarch64 bootstrap (pr69416) Richard Henderson
2016-01-22 17:11 ` Richard Earnshaw (lists)
2016-01-25 13:28 ` Christophe Lyon
2016-01-25 16:27   ` Richard Henderson
2016-01-25 18:32 Wilco Dijkstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).