From patchwork Sat Oct 30 14:22:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 69656 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 8E746B7043 for ; Sun, 31 Oct 2010 01:23:08 +1100 (EST) Received: (qmail 31919 invoked by alias); 30 Oct 2010 14:23:02 -0000 Received: (qmail 31900 invoked by uid 22791); 30 Oct 2010 14:23:00 -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_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-px0-f175.google.com (HELO mail-px0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 30 Oct 2010 14:22:54 +0000 Received: by pxi2 with SMTP id 2so270179pxi.20 for ; Sat, 30 Oct 2010 07:22:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.155.2 with SMTP id c2mr964298wfe.428.1288448573165; Sat, 30 Oct 2010 07:22:53 -0700 (PDT) Received: by 10.143.167.14 with HTTP; Sat, 30 Oct 2010 07:22:53 -0700 (PDT) Date: Sat, 30 Oct 2010 16:22:53 +0200 Message-ID: Subject: [PATCH, middle-end]: Fix PR 44569 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! For the testcase in PR [1] (and gcc.dg/torture/vector-shift2.c in a duplicate [2]), gcc generates following debug statement: (debug_insn 7 4 8 2 (var_location:V16QI vuchar (concatn:V16QI [ (const_int 1 [0x1]) (const_int 2 [0x2]) (const_int 3 [0x3]) (const_int 4 [0x4]) (const_int 1 [0x1]) (const_int 2 [0x2]) (const_int 3 [0x3]) (const_int 4 [0x4]) (const_int 1 [0x1]) (const_int 2 [0x2]) (const_int 3 [0x3]) (const_int 4 [0x4]) (const_int 1 [0x1]) (const_int 2 [0x2]) (const_int 3 [0x3]) (const_int 4 [0x4]) ])) vector-shift2.c:14 -1 (nil)) This RTX is processed in simplify_subreg_concatn, that breaks the RTX into VOIDmode const_int elements and passes them to simplify_gen_subreg. The later function can not handle VOIDmode inner_mode argument. So, in case of VOIDmode, just determine the mode of the elements by using GET_MODE_INNER of vector mode of concatn RTX. 2010-10-30 Uros Bizjak PR middle-end/44569 * lower-suberg.c (simplify_subreg_concatn): For VOIDmode elements, determine the mode of a subreg by GET_MODE_INNER of CONCATN RTX. Patch was tested on x86_64-pc-linux-gnu {,-m32}, where it fixes testcase from [1] and also gcc.dg/torture/vector-shift2.c failure from [2]. OK for mainline, 4.4 and 4.5 ? [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44569 [2] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46227 Uros. Index: lower-subreg.c =================================================================== --- lower-subreg.c (revision 166086) +++ lower-subreg.c (working copy) @@ -396,7 +396,7 @@ simplify_subreg_concatn (enum machine_mo unsigned int byte) { unsigned int inner_size; - enum machine_mode innermode; + enum machine_mode innermode, partmode; rtx part; unsigned int final_offset; @@ -409,11 +409,19 @@ simplify_subreg_concatn (enum machine_mo inner_size = GET_MODE_SIZE (innermode) / XVECLEN (op, 0); part = XVECEXP (op, 0, byte / inner_size); + partmode = GET_MODE (part); + + if (partmode == VOIDmode) + { + gcc_assert (VECTOR_MODE_P (innermode)); + partmode = GET_MODE_INNER (innermode); + } + final_offset = byte % inner_size; if (final_offset + GET_MODE_SIZE (outermode) > inner_size) return NULL_RTX; - return simplify_gen_subreg (outermode, part, GET_MODE (part), final_offset); + return simplify_gen_subreg (outermode, part, partmode, final_offset); } /* Wrapper around simplify_gen_subreg which handles CONCATN. */