public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000_adjust_cost old thinko
@ 2015-11-29 18:52 David Edelsohn
  2015-11-30 10:16 ` Eric Botcazou
  0 siblings, 1 reply; 4+ messages in thread
From: David Edelsohn @ 2015-11-29 18:52 UTC (permalink / raw)
  To: GCC Patches

When rs6000_adjust_cost originally was written, the return value from
recog_memoized() was handled incorrectly.

Note this also is wrong on PA and one of the SPARC adjust_cost macros.

Bootstrapped on powrepc-ibm-aix7.1.0.0.

PR target/28115
* config/rs6000/rs6000.c (rs6000_adjust_cost): Correct recog_memoized
test for insn and check recog_memoized for dep_insn.

Index: rs6000.c
===================================================================
--- rs6000.c    (revision 231044)
+++ rs6000.c    (working copy)
@@ -28544,8 +28544,8 @@ rs6000_adjust_cost (rtx_insn *insn, rtx link, rtx_
 {
   enum attr_type attr_type;

-  if (! recog_memoized (insn))
-    return 0;
+  if (recog_memoized (insn) < 0 || recog_memoized (dep_insn) < 0)
+    return cost;

   switch (REG_NOTE_KIND (link))
     {

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

* Re: [PATCH] rs6000_adjust_cost old thinko
  2015-11-29 18:52 [PATCH] rs6000_adjust_cost old thinko David Edelsohn
@ 2015-11-30 10:16 ` Eric Botcazou
  2015-11-30 13:46   ` David Edelsohn
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Botcazou @ 2015-11-30 10:16 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc-patches

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

> Note this also is wrong on PA and one of the SPARC adjust_cost macros.

Thanks for the heads up, fixed thusly, applied on the mainline


	PR target/28115
	* config/sparc/sparc.c (supersparc_adjust_cost): Fix thinko.
	(sparc_adjust_cost): Add missing space.

-- 
Eric Botcazou

[-- Attachment #2: pr28115.diff --]
[-- Type: text/x-patch, Size: 667 bytes --]

Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 231010)
+++ config/sparc/sparc.c	(working copy)
@@ -9353,8 +9353,8 @@ supersparc_adjust_cost (rtx_insn *insn,
 {
   enum attr_type insn_type;
 
-  if (! recog_memoized (insn))
-    return 0;
+  if (recog_memoized (insn) < 0)
+    return cost;
 
   insn_type = get_attr_type (insn);
 
@@ -9487,7 +9487,7 @@ hypersparc_adjust_cost (rtx_insn *insn,
 }
 
 static int
-sparc_adjust_cost(rtx_insn *insn, rtx link, rtx_insn *dep, int cost)
+sparc_adjust_cost (rtx_insn *insn, rtx link, rtx_insn *dep, int cost)
 {
   switch (sparc_cpu)
     {

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

* Re: [PATCH] rs6000_adjust_cost old thinko
  2015-11-30 10:16 ` Eric Botcazou
@ 2015-11-30 13:46   ` David Edelsohn
  2015-11-30 16:58     ` Eric Botcazou
  0 siblings, 1 reply; 4+ messages in thread
From: David Edelsohn @ 2015-11-30 13:46 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: GCC Patches

On Mon, Nov 30, 2015 at 4:44 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Note this also is wrong on PA and one of the SPARC adjust_cost macros.
>
> Thanks for the heads up, fixed thusly, applied on the mainline
>
>
>         PR target/28115
>         * config/sparc/sparc.c (supersparc_adjust_cost): Fix thinko.
>         (sparc_adjust_cost): Add missing space.

Eric,

FYI, the function should test recog_memoized (dep_insn) also.

- David

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

* Re: [PATCH] rs6000_adjust_cost old thinko
  2015-11-30 13:46   ` David Edelsohn
@ 2015-11-30 16:58     ` Eric Botcazou
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Botcazou @ 2015-11-30 16:58 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc-patches

> FYI, the function should test recog_memoized (dep_insn) also.

I don't think that's needed as it doesn't call get_attr_type on dep_insn.

-- 
Eric Botcazou

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

end of thread, other threads:[~2015-11-30 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-29 18:52 [PATCH] rs6000_adjust_cost old thinko David Edelsohn
2015-11-30 10:16 ` Eric Botcazou
2015-11-30 13:46   ` David Edelsohn
2015-11-30 16:58     ` Eric Botcazou

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).