From patchwork Thu Oct 14 02:10:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 67771 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 59800B6EDF for ; Thu, 14 Oct 2010 13:10:38 +1100 (EST) Received: (qmail 24145 invoked by alias); 14 Oct 2010 02:10:35 -0000 Received: (qmail 24107 invoked by uid 22791); 14 Oct 2010 02:10:34 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_AV X-Spam-Check-By: sourceware.org Received: from mail-vw0-f47.google.com (HELO mail-vw0-f47.google.com) (209.85.212.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Oct 2010 02:10:23 +0000 Received: by vws3 with SMTP id 3so2257231vws.20 for ; Wed, 13 Oct 2010 19:10:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.195.198 with SMTP id ed6mr3055222vcb.113.1287022220939; Wed, 13 Oct 2010 19:10:20 -0700 (PDT) Received: by 10.220.181.138 with HTTP; Wed, 13 Oct 2010 19:10:20 -0700 (PDT) In-Reply-To: References: <4CB49385.1010805@redhat.com> <4CB5E1B8.80307@redhat.com> Date: Wed, 13 Oct 2010 19:10:20 -0700 Message-ID: Subject: Re: [PATCH][RFC] 256bit AVX vectorization support From: "H.J. Lu" To: Richard Guenther Cc: Richard Henderson , Uros Bizjak , gcc-patches@gcc.gnu.org X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Wed, Oct 13, 2010 at 1:35 PM, Richard Guenther wrote: > On Wed, 13 Oct 2010, H.J. Lu wrote: > >> Those patterns were added for the old 256bit vectorizer changes. >> I am not sure if they are needed now.  I deleted them. I will >> investigate against the new 256bit vectorizer changes after they >> are checked into trunk. > > They are all in already. > > Richard. > Great. I am checking in this testcase. BTW, vectorizer has been broken for more than a month: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45720 Any plan to fix it? Thanks. --- /dev/null 2010-10-13 10:21:15.312298381 -0700 +++ gcc/gcc/testsuite/gcc.target/i386/pr44180.c 2010-10-13 19:01:10.270027180 -0700 @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-require-effective-target avx } */ +/* { dg-options "-O2 -ftree-vectorize -mavx" } */ + +#include "avx-check.h" + +#define N 16 + +float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; +float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30}; + +static void +__attribute__ ((noinline)) +avx_test () +{ + int i; + float a[N]; + + /* Strided access. Vectorizable on platforms that support load of strided + accesses (extract of even/odd vector elements). */ + for (i = 0; i < N/2; i++) + { + a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i]; + d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i]; + } + + /* Check results. */ + for (i = 0; i < N/2; i++) + { + if (a[i] != b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i] + || d[i] != b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i]) + abort(); + } +}