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  <vmaka...@redhat.com>

        * gcc.target/powerpc/pr70669.c: Use unary minus instead of
        addition.

Reply via email to