Bug 77613 - Powerpc64le: redundant swaps in autovectorised loop
Summary: Powerpc64le: redundant swaps in autovectorised loop
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: ---
Assignee: Bill Schmidt
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2016-09-16 06:19 UTC by Anton Blanchard
Modified: 2016-09-16 21:30 UTC (History)
4 users (show)

See Also:
Host:
Target: powerpc64le-linux
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-09-16 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Blanchard 2016-09-16 06:19:45 UTC
The following test case:

void testcase(signed short a, signed short *x, signed short *y)
{
        unsigned long i;

        for (i = 0; i < 1024; i++)
                y[i] = a * x[i] + y[i];
}

has redundant swaps on the way in and out:

	lxvd2x 32,8,9
	lxvd2x 33,10,9
	xxpermdi 32,32,32,2
	xxpermdi 33,33,33,2
	vmladduhm 0,13,0,1
	xxpermdi 0,32,32,2
	stxvd2x 0,10,9
Comment 1 Bill Schmidt 2016-09-16 12:45:50 UTC
Mine.
Comment 2 Bill Schmidt 2016-09-16 12:53:12 UTC
And confirmed.
Comment 3 Bill Schmidt 2016-09-16 13:12:33 UTC
This is simple enough.  We have code to allow splats in pure-SIMD ranges, but we are missing a pattern that performs a splat and a truncate in the same operation.  Should have a patch to submit today.
Comment 4 Bill Schmidt 2016-09-16 21:29:24 UTC
Author: wschmidt
Date: Fri Sep 16 21:28:52 2016
New Revision: 240199

URL: https://gcc.gnu.org/viewcvs?rev=240199&root=gcc&view=rev
Log:
[gcc]

2016-09-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/77613
	* config/rs6000/rs6000.c (rtx_is_swappable_p): Add support for
	splat with truncate.

[gcc/testsuite]

2016-09-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/77613
	* gcc.target/powerpc/swaps-p8-25.c: New.


Added:
    trunk/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Bill Schmidt 2016-09-16 21:30:48 UTC
Fixed.