From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18760 invoked by alias); 18 Sep 2014 12:25:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 18750 invoked by uid 89); 18 Sep 2014 12:25:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 Sep 2014 12:25:11 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 18 Sep 2014 13:25:08 +0100 Received: from [10.1.209.51] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Sep 2014 13:25:08 +0100 Message-ID: <541ACF23.3050602@arm.com> Date: Thu, 18 Sep 2014 12:25:00 -0000 From: Alan Lawrence User-Agent: Thunderbird 2.0.0.24 (X11/20101213) MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [PATCH 8/14][Testsuite] Add tests of reductions using whole-vector-shifts (ior) References: <541AC4D2.9040901@arm.com> In-Reply-To: <541AC4D2.9040901@arm.com> X-MC-Unique: 114091813250823001 Content-Type: multipart/mixed; boundary="------------030407060805030501040902" X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg01470.txt.bz2 This is a multi-part message in MIME format. --------------030407060805030501040902 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 813 These are like the previous patch, but using | rather than * - I was unable= to=20 get the previous test to pass on PowerPC and MIPS. I note there is no inherent vector operation here - a bitwise OR across a w= ord,=20 and a "reduction via shifts" using scalar (not vector) ops would be all tha= t's=20 necessary. However, GCC doesn't exploit this possibility at present, and I = don't=20 have any plans at present to add such myself. Passing on x86_64-linux-gnu, aarch64-none-elf, aarch64_be-none-elf, arm-non= e-eabi. The 'scan-tree-dump' part passes on mips64 and powerpc (although the latter= is=20 disabled as check_effective_target_whole_vector_shift gives 0, as per previ= ous=20 patch) gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-reduc-or_1.c: New test. * gcc.dg/vect/vect-reduc-or_2.c: Likewise. --------------030407060805030501040902 Content-Type: text/x-patch; name=8_test_shift_reduc_ior.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="8_test_shift_reduc_ior.patch" Content-length: 2066 diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-or_1.c b/gcc/testsuite/gc= c.dg/vect/vect-reduc-or_1.c new file mode 100644 index 0000000000000000000000000000000000000000..4e1a8577ce21aad539fca7cf077= 00b99575dfab0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-or_1.c @@ -0,0 +1,35 @@ +/* { dg-require-effective-target whole_vector_shift } */ + +/* Write a reduction loop to be reduced using vector shifts. */ + +extern void abort(void); + +unsigned char in[16] __attribute__((__aligned__(16))); + +int +main (unsigned char argc, char **argv) +{ + unsigned char i =3D 0; + unsigned char sum =3D 1; + + for (i =3D 0; i < 16; i++) + in[i] =3D (i + i + 1) & 0xfd; + + /* Prevent constant propagation of the entire loop below. */ + asm volatile ("" : : : "memory"); + + for (i =3D 0; i < 16; i++) + sum |=3D in[i]; + + if (sum !=3D 29) + { + __builtin_printf("Failed %d\n", sum); + abort(); + } + + return 0; +} + +/* { dg-final { scan-tree-dump "Reduce using vector shifts" "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-or_2.c b/gcc/testsuite/gc= c.dg/vect/vect-reduc-or_2.c new file mode 100644 index 0000000000000000000000000000000000000000..e25467e59221adc09cbe0bb7548= 842902a4bf6da --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-or_2.c @@ -0,0 +1,31 @@ +/* { dg-require-effective-target whole_vector_shift } */ + +/* Write a reduction loop to be reduced using vector shifts and folded. */ + +extern void abort(void); + +int +main (unsigned char argc, char **argv) +{ + unsigned char in[16] __attribute__((aligned(16))); + unsigned char i =3D 0; + unsigned char sum =3D 1; + + for (i =3D 0; i < 16; i++) + in[i] =3D (i + i + 1) & 0xfd; + + for (i =3D 0; i < 16; i++) + sum |=3D in[i]; + + if (sum !=3D 29) + { + __builtin_printf("Failed %d\n", sum); + abort(); + } + + return 0; +} + +/* { dg-final { scan-tree-dump "Reduce using vector shifts" "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ += --------------030407060805030501040902--