From patchwork Sun Nov 20 22:24:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 126667 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 E99F8B720C for ; Mon, 21 Nov 2011 09:24:36 +1100 (EST) Received: (qmail 5664 invoked by alias); 20 Nov 2011 22:24:33 -0000 Received: (qmail 5656 invoked by uid 22791); 20 Nov 2011 22:24:32 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_MX, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 20 Nov 2011 22:24:18 +0000 Received: by ggnh4 with SMTP id h4so4524056ggn.20 for ; Sun, 20 Nov 2011 14:24:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.181.225 with SMTP id l61mr15833419yhm.131.1321827858056; Sun, 20 Nov 2011 14:24:18 -0800 (PST) Received: by 10.146.137.4 with HTTP; Sun, 20 Nov 2011 14:24:17 -0800 (PST) Date: Sun, 20 Nov 2011 23:24:17 +0100 Message-ID: Subject: [PATCH, i386]: PR51235, PR51236: A couple of bugfixes From: Uros Bizjak To: gcc-patches@gcc.gnu.org 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 Hello! 2011-11-20 Uros Bizjak PR target/51235 * config/i386/i386.c (ix86_expand_vcond): Generate TARGET_XOP patterns for supported mode only. PR target/51236 * config/i386/i386.c (ix86_expand_builtin) : Use CODE_FOR_avx2_gathersiv4di. testsuite/ChangeLog: 2011-11-20 Uros Bizjak PR target/51235 * gcc.target/i386/pr51235.c: New test. PR target/51236 * gcc.target/i386/pr51236.c: New test. Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN. Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 181534) +++ config/i386/i386.c (working copy) @@ -19619,8 +19619,12 @@ cop0 = operands[4]; cop1 = operands[5]; - /* XOP supports all of the comparisons on all vector int types. */ - if (!TARGET_XOP) + /* XOP supports all of the comparisons on all 128-bit vector int types. */ + if (TARGET_XOP + && (mode == V16QImode || mode == V8HImode + || mode == V4SImode || mode == V2DImode)) + ; + else { /* Canonicalize the comparison to EQ, GT, GTU. */ switch (code) @@ -30013,7 +30017,7 @@ icode = CODE_FOR_avx2_gatherdiv8sf; goto gather_gen; case IX86_BUILTIN_GATHERALTSIV4DI: - icode = CODE_FOR_avx2_gathersiv4df; + icode = CODE_FOR_avx2_gathersiv4di; goto gather_gen; case IX86_BUILTIN_GATHERALTDIV8SI: icode = CODE_FOR_avx2_gatherdiv8si; Index: testsuite/gcc.target/i386/pr51236.c =================================================================== --- testsuite/gcc.target/i386/pr51236.c (revision 0) +++ testsuite/gcc.target/i386/pr51236.c (revision 0) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-vectorize -mavx2" } */ + +long foo (long *p, int i) +{ + long x = 0; + + while (--i) + x ^= p[i]; + + return x; +} Index: testsuite/gcc.target/i386/pr51235.c =================================================================== --- testsuite/gcc.target/i386/pr51235.c (revision 0) +++ testsuite/gcc.target/i386/pr51235.c (revision 0) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-vectorize -mxop -mavx2" } */ + +void *foo (int count, void **list) +{ + void *minaddr = list[0]; + int i; + + for (i = 1; i < count; i++) + { + void *addr = list[i]; + if (addr < minaddr) + minaddr = addr; + } + + return minaddr; +}