From patchwork Wed Apr 13 15:59:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 1008 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:48:13 -0000 Delivered-To: patches@linaro.org Received: by 10.68.59.138 with SMTP id z10cs327575pbq; Wed, 13 Apr 2011 09:00:31 -0700 (PDT) Received: by 10.42.135.71 with SMTP id o7mr12940341ict.85.1302710389157; Wed, 13 Apr 2011 08:59:49 -0700 (PDT) Received: from mail.codesourcery.com (mail.codesourcery.com [38.113.113.100]) by mx.google.com with ESMTPS id we8si2058372icb.37.2011.04.13.08.59.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Apr 2011 08:59:49 -0700 (PDT) Received-SPF: pass (google.com: domain of ams@codesourcery.com designates 38.113.113.100 as permitted sender) client-ip=38.113.113.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ams@codesourcery.com designates 38.113.113.100 as permitted sender) smtp.mail=ams@codesourcery.com Received: (qmail 9283 invoked from network); 13 Apr 2011 15:59:47 -0000 Received: from unknown (HELO ?192.168.0.104?) (ams@127.0.0.2) by mail.codesourcery.com with ESMTPA; 13 Apr 2011 15:59:47 -0000 Message-ID: <4DA5C870.7060703@codesourcery.com> Date: Wed, 13 Apr 2011 16:59:44 +0100 From: Andrew Stubbs Organization: CodeSourcery User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: patches@linaro.org, Daniel Jacobowitz Subject: [PATCH][ARM] New testcases for NEON Hi, This old patch has been carried in the CodeSourcery toolchain for some time now. It just adds a few new testcases for vectorization. OK? Andrew 2008-12-03 Daniel Jacobowitz gcc/testsuite/ * gcc.dg/vect/vect-shift-3.c, gcc.dg/vect/vect-shift-4.c: New. * lib/target-supports.exp (check_effective_target_vect_shift_char): New function. --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-shift-3.c @@ -0,0 +1,37 @@ +/* { dg-require-effective-target vect_shift } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +#define N 32 + +unsigned short dst[N] __attribute__((aligned(N))); +unsigned short src[N] __attribute__((aligned(N))); + +__attribute__ ((noinline)) +void array_shift(void) +{ + int i; + for (i = 0; i < N; i++) + dst[i] = src[i] >> 3; +} + +int main() +{ + volatile int i; + check_vect (); + + for (i = 0; i < N; i++) + src[i] = i << 3; + + array_shift (); + + for (i = 0; i < N; i++) + if (dst[i] != i) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-shift-4.c @@ -0,0 +1,37 @@ +/* { dg-require-effective-target vect_shift_char } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +#define N 32 + +unsigned char dst[N] __attribute__((aligned(N))); +unsigned char src[N] __attribute__((aligned(N))); + +__attribute__ ((noinline)) +void array_shift(void) +{ + int i; + for (i = 0; i < N; i++) + dst[i] = src[i] >> 3; +} + +int main() +{ + volatile int i; + check_vect (); + + for (i = 0; i < N; i++) + src[i] = i << 3; + + array_shift (); + + for (i = 0; i < N; i++) + if (dst[i] != i) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2310,6 +2310,26 @@ proc check_effective_target_vect_shift_scalar { } { } +# Return 1 if the target supports hardware vector shift operation for char. + +proc check_effective_target_vect_shift_char { } { + global et_vect_shift_char_saved + + if [info exists et_vect_shift_char_saved] { + verbose "check_effective_target_vect_shift_char: using cached result" 2 + } else { + set et_vect_shift_char_saved 0 + if { ([istarget powerpc*-*-*] + && ![istarget powerpc-*-linux*paired*]) + || [check_effective_target_arm32] } { + set et_vect_shift_char_saved 1 + } + } + + verbose "check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2 + return $et_vect_shift_char_saved +} + # Return 1 if the target supports hardware vectors of long, 0 otherwise. # # This can change for different subtargets so do not cache the result.