From patchwork Mon Jan 14 20:49:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 211895 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 9EF592C00A0 for ; Tue, 15 Jan 2013 07:49:58 +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=1358801398; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=i7vhgJTjjOQKG7IRwWSb rGOUkBw=; b=h3Z2GCgUOwleg5tNZTzd2WphbeAv3bMJ5GOdpuWqlEVLQMBs/EpO ay8Ay6EAGRLDJJCGniSIPTpf2lETaXvOPcD9y5EIquCdXMUctXrEtXax86fnToVk 32B0XqGXf9OGy8xjs/eeiO8NzcSVCbg2lUUk8Wg7ogfqgOC+HIbPknc= 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:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=lGh71QAsCxXSuQWCqZZ6O8yohK03xS2bHdWdOyVa8YJczYz4KGvlTxhH/ceHfv D4ZXDRPcG0vnNnI1fojMV/WQ4zV9X/Q8yJZsY30jxct6pnyT9/jCYalj+eU1UJBD a45Fvk4yO7F1IlZO0hFIq1M7gEQgsz9RfeOwK5b+y0PUE=; Received: (qmail 25094 invoked by alias); 14 Jan 2013 20:49:48 -0000 Received: (qmail 25072 invoked by uid 22791); 14 Jan 2013 20:49:45 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Jan 2013 20:49:37 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0EKna5s016394 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Jan 2013 15:49:36 -0500 Received: from zalov.redhat.com (vpn1-5-87.ams2.redhat.com [10.36.5.87]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0EKnYie007400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 14 Jan 2013 15:49:36 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id r0EKnXLl030906; Mon, 14 Jan 2013 21:49:34 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r0EKnXOU030905; Mon, 14 Jan 2013 21:49:33 +0100 Date: Mon, 14 Jan 2013 21:49:32 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix up ICE with reduction % (PR tree-optimization/55955) Message-ID: <20130114204932.GR7269@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi! For *SHIFT_EXPR/*ROTATE_EXPR with VECTOR_TYPE types, optab_for_tree_code requires us to decide if we want optab_vector or optab_scalar. It is likely not worth it to handle these four, they would fail soon anyway. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2013-01-14 Jakub Jelinek PR tree-optimization/55955 * tree-vect-loop.c (vectorizable_reduction): Give up early on *SHIFT_EXPR and *ROTATE_EXPR codes. * gcc.c-torture/compile/pr55955.c: New test. Jakub --- gcc/tree-vect-loop.c.jj 2013-01-11 09:02:55.000000000 +0100 +++ gcc/tree-vect-loop.c 2013-01-14 12:21:29.359018748 +0100 @@ -4776,6 +4776,17 @@ vectorizable_reduction (gimple stmt, gim { /* 4. Supportable by target? */ + if (code == LSHIFT_EXPR || code == RSHIFT_EXPR + || code == LROTATE_EXPR || code == RROTATE_EXPR) + { + /* Shifts and rotates are only supported by vectorizable_shifts, + not vectorizable_reduction. */ + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "unsupported shift or rotation."); + return false; + } + /* 4.1. check support for the operation in the loop */ optab = optab_for_tree_code (code, vectype_in, optab_default); if (!optab) --- gcc/testsuite/gcc.c-torture/compile/pr55955.c.jj 2013-01-14 12:23:28.273324350 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr55955.c 2013-01-14 12:23:14.000000000 +0100 @@ -0,0 +1,12 @@ +/* PR tree-optimization/55955 */ + +int b; + +void +foo (int x) +{ + int a; + for (a = x; a < 2; a++) + for (b = 0; b < 2; b++) + *(unsigned short *) 0x100000UL %= 46; +}