From patchwork Thu Jan 5 17:46:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 134522 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 4C4D1B6FAF for ; Fri, 6 Jan 2012 04:47:06 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1326390426; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=zEZpCYt okUp+d6O2kak9Xs+Ysew=; b=tn0ZWhYdjXesqaIBYxLwrqYJXtq38Ymj+kz/iVn Uq9Yn+V1gLn+GZLKjzME2i0V2tnBHY9i8xJ+lvjw02sys4/czvZsPLPlKhleKan5 9oSwcuhnq8fiDtk9vSfrmqLwHF3jyi+Mi/kZ0f2wcch0iEiUclPcDs6t+4649md0 Xce8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=pGSCU1wE82hvo9bStw9lhbEp2tdPvScoVJlHTFuLEQTRhyd4sbuaz8+H2WGN7G mZwPDOpbyrvn0oWbIe9uxqTIZf7ik+EZ2MH5UE0okUbDO7h+S5vSMv0HTqDsAWcu r0bTDtH2OPtnLQAR7poaqsGxhOHIbPUzTq2TXyTyq/nPs=; Received: (qmail 12637 invoked by alias); 5 Jan 2012 17:46:59 -0000 Received: (qmail 12621 invoked by uid 22791); 5 Jan 2012 17:46:57 -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_ZJ X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Jan 2012 17:46:32 +0000 Received: by yenm12 with SMTP id m12so277737yen.20 for ; Thu, 05 Jan 2012 09:46:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.93.4 with SMTP id k4mr2959210yhf.114.1325785591460; Thu, 05 Jan 2012 09:46:31 -0800 (PST) Received: by 10.146.236.18 with HTTP; Thu, 5 Jan 2012 09:46:31 -0800 (PST) Date: Thu, 5 Jan 2012 18:46:31 +0100 Message-ID: Subject: [PATCH v2, ia64]: Fix PR 51681, ICE in gcc.dg/torture/vshuf-v2si.c From: Uros Bizjak To: Richard Henderson Cc: 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 On Tue, Jan 3, 2012 at 9:36 PM, Richard Henderson wrote: > On 01/03/2012 09:50 PM, Uros Bizjak wrote: >> I tried to investigate -mbig-endian a bit, but unfortunately almost >> all gcc.dg/torture/vshuf-*.c tests FAIL with -O2 on unpatched gcc. >> Tests pass with -O0, though. > > Tests without -O don't actually test this code. > > And -mbig-endian doesn't get big-endian execution on linux, so it's > only useful for manually examining assembly and checking for ICEs. Attached patch adds early exit for BYTES_BIG_ENDIAN, as suggested by rth. 2012-01-05 Uros Bizjak PR target/51681 * config/ia64/ia64.c (expand_vec_perm_shrp): Use correct operands for shrp pattern. Correctly handle and fixup shift variable. Return false when shift > nelt for BYTES_BIG_ENDIAN target. Patch was bootstrapped and regression tested on ia64-unknown-linux-gnu. Additionally, the patch was tested on gcc.dg/torture/vshuf*.c with -mbig-endian, where it didn't caused any ICEs. OK for mainline? Uros. Index: config/ia64/ia64.c =================================================================== --- config/ia64/ia64.c (revision 182917) +++ config/ia64/ia64.c (working copy) @@ -11085,7 +11085,7 @@ static bool expand_vec_perm_shrp (struct expand_vec_perm_d *d) { unsigned i, nelt = d->nelt, shift, mask; - rtx tmp, op0, op1;; + rtx tmp, hi, lo; /* ??? Don't force V2SFmode into the integer registers. */ if (d->vmode == V2SFmode) @@ -11094,6 +11094,9 @@ expand_vec_perm_shrp (struct expand_vec_perm_d *d) mask = (d->one_operand_p ? nelt - 1 : 2 * nelt - 1); shift = d->perm[0]; + if (BYTES_BIG_ENDIAN && shift > nelt) + return false; + for (i = 1; i < nelt; ++i) if (d->perm[i] != ((shift + i) & mask)) return false; @@ -11101,6 +11104,11 @@ expand_vec_perm_shrp (struct expand_vec_perm_d *d) if (d->testing_p) return true; + hi = shift < nelt ? d->op1 : d->op0; + lo = shift < nelt ? d->op0 : d->op1; + + shift %= nelt; + shift *= GET_MODE_UNIT_SIZE (d->vmode) * BITS_PER_UNIT; /* We've eliminated the shift 0 case via expand_vec_perm_identity. */ @@ -11113,11 +11121,9 @@ expand_vec_perm_shrp (struct expand_vec_perm_d *d) shift = 64 - shift; tmp = gen_reg_rtx (DImode); - op0 = (shift < nelt ? d->op0 : d->op1); - op1 = (shift < nelt ? d->op1 : d->op0); - op0 = gen_lowpart (DImode, op0); - op1 = gen_lowpart (DImode, op1); - emit_insn (gen_shrp (tmp, op0, op1, GEN_INT (shift))); + hi = gen_lowpart (DImode, hi); + lo = gen_lowpart (DImode, lo); + emit_insn (gen_shrp (tmp, hi, lo, GEN_INT (shift))); emit_move_insn (d->target, gen_lowpart (d->vmode, tmp)); return true;