* RFA: patch for test PR70669 test
@ 2018-11-22 19:47 Vladimir Makarov
2018-11-23 0:30 ` Segher Boessenkool
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Makarov @ 2018-11-22 19:47 UTC (permalink / raw)
To: gcc-patches; +Cc: Michael Meissner
[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]
 Today I committed a patch
https://gcc.gnu.org/ml/gcc-patches/2018-11/msg01945.html
 But it makes gcc.target/powerpc/pr70669.c to fail. Here is the patch
to fix the failure. The expected code assumes that variable r should
get a general reg. I suspect the expectation is wrong. There are three
possible choices for r: a general reg, a vsx reg, and memory.
 The cost of move of vsx to/from mem is 4, the cost of move of general
reg of this mode to/from mem is 8, and the cost of move of general reg
to/from vsx is 12.
 So approximately if r is assigned memory we have cost 8 * 2 (asm) + 4
* 2 (plus) = 24 (when we use memory at *q), if r is assigned to vsx the
cost is 12*2(asm) + 4(r=*q) = 28, and if r is assigned a general reg the
cost is 12 * 2 (plus) + 8 (r = *q) = 32.
 ira-costs should choose mem although it chose a general reg before my
patch (it is a big topic why it chose a general reg. In brief, it is
because some inherent drawbacks of the current cost calculation
algorithm). The patch I recently submitted solves some drawbacks and
memory is chosen for r.
 To generate the expected code with r in a general reg, I just decrease
the number of getting r value into vsx reg by changing r + r onto -r.
Is the following patch ok for trunk?
[-- Attachment #2: z --]
[-- Type: text/plain, Size: 807 bytes --]
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 266318)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2018-11-22 Vladimir Makarov <vmakarov@redhat.com>
+
+ * gcc.target/powerpc/pr70669.c: Use unary minus instead of
+ addition.
+
2018-11-20 Jan Hubicka <hubicka@ucw.cz>
PR ipa/87706
Index: testsuite/gcc.target/powerpc/pr70669.c
===================================================================
--- testsuite/gcc.target/powerpc/pr70669.c (revision 266318)
+++ testsuite/gcc.target/powerpc/pr70669.c (working copy)
@@ -13,7 +13,7 @@ void foo (TYPE *p, TYPE *q)
#ifndef NO_ASM
__asm__ (" # %0" : "+r" (r));
#endif
- *p = r + r;
+ *p = -r;
}
/* { dg-final { scan-assembler "mfvsrd" } } */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: RFA: patch for test PR70669 test
2018-11-22 19:47 RFA: patch for test PR70669 test Vladimir Makarov
@ 2018-11-23 0:30 ` Segher Boessenkool
2018-11-23 21:45 ` Vladimir Makarov
0 siblings, 1 reply; 3+ messages in thread
From: Segher Boessenkool @ 2018-11-23 0:30 UTC (permalink / raw)
To: Vladimir Makarov; +Cc: gcc-patches, Michael Meissner
Hi!
On Thu, Nov 22, 2018 at 02:47:10PM -0500, Vladimir Makarov wrote:
> Â Today I committed a patch
>
> https://gcc.gnu.org/ml/gcc-patches/2018-11/msg01945.html
>
>  But it makes gcc.target/powerpc/pr70669.c to fail. Here is the patch
> to fix the failure. The expected code assumes that variable r should
> get a general reg. I suspect the expectation is wrong. There are three
> possible choices for r: a general reg, a vsx reg, and memory.
>
> Â The cost of move of vsx to/from mem is 4, the cost of move of general
> reg of this mode to/from mem is 8, and the cost of move of general reg
> to/from vsx is 12.
>
> Â So approximately if r is assigned memory we have cost 8 * 2 (asm) + 4
> * 2 (plus) = 24 (when we use memory at *q), if r is assigned to vsx the
> cost is 12*2(asm) + 4(r=*q) = 28, and if r is assigned a general reg the
> cost is 12 * 2 (plus) + 8 (r = *q) = 32.
>
> Â ira-costs should choose mem although it chose a general reg before my
> patch (it is a big topic why it chose a general reg. In brief, it is
> because some inherent drawbacks of the current cost calculation
> algorithm). The patch I recently submitted solves some drawbacks and
> memory is chosen for r.
That sounds all correct. Thanks for fixing this!
> Â To generate the expected code with r in a general reg, I just decrease
> the number of getting r value into vsx reg by changing r + r onto -r.
>
> Is the following patch ok for trunk?
Yes, the test now again tests what it is meant to test (that you get
m[tf]vsrd from reloads). It's fine for trunk, thanks!
Segher
2018-11-22 Vladimir Makarov <vmakarov@redhat.com>
* gcc.target/powerpc/pr70669.c: Use unary minus instead of
addition.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: RFA: patch for test PR70669 test
2018-11-23 0:30 ` Segher Boessenkool
@ 2018-11-23 21:45 ` Vladimir Makarov
0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Makarov @ 2018-11-23 21:45 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: gcc-patches, Michael Meissner
On 11/22/2018 07:30 PM, Segher Boessenkool wrote:
> Hi!
>
> On Thu, Nov 22, 2018 at 02:47:10PM -0500, Vladimir Makarov wrote:
>
>> Â To generate the expected code with r in a general reg, I just decrease
>> the number of getting r value into vsx reg by changing r + r onto -r.
>>
>> Is the following patch ok for trunk?
> Yes, the test now again tests what it is meant to test (that you get
> m[tf]vsrd from reloads). It's fine for trunk, thanks!
>
>
Thank you, Segher. Committed as rev. 266421.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-23 21:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-22 19:47 RFA: patch for test PR70669 test Vladimir Makarov
2018-11-23 0:30 ` Segher Boessenkool
2018-11-23 21:45 ` Vladimir Makarov
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).