From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19546 invoked by alias); 26 Jun 2008 22:10:12 -0000 Received: (qmail 19529 invoked by uid 22791); 26 Jun 2008 22:10:11 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.29.151) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Jun 2008 22:09:49 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.8/8.13.8) with ESMTP id m5QM9WoA289584 for ; Thu, 26 Jun 2008 22:09:32 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m5QM9WO72650158 for ; Fri, 27 Jun 2008 00:09:32 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m5QM9WgX024894 for ; Fri, 27 Jun 2008 00:09:32 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id m5QM9Ww5024891; Fri, 27 Jun 2008 00:09:32 +0200 Message-Id: <200806262209.m5QM9Ww5024891@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 27 Jun 2008 00:09:32 +0200 Subject: [PATCH, v2] Re: [PATCH] Fix ICE in simplify_immed_subreg on SPU To: ebotcazou@adacore.com (Eric Botcazou) Date: Thu, 26 Jun 2008 22:15:00 -0000 From: "Ulrich Weigand" Cc: iant@google.com, gcc-patches@gcc.gnu.org, trevor_smigiel@playstation.sony.com, andrew_pinski@playstation.sony.com In-Reply-To: <200806160027.42235.ebotcazou@adacore.com> from "Eric Botcazou" at Jun 16, 2008 12:27:42 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2008-06/txt/msg01706.txt.bz2 Eric Botcazou wrote: > > I think I'm with Ulrich here. A CONST_VECTOR containing a CONST seems > > reasonable to me. Eric, can you clarify what you see as the problem? > > I don't see the point in changing the semantics of CONST_VECTOR because of > a IMO non-representative testcase. I've looked at this again in more detail, and it seems that there is indeed the pervasive assumption that CONST_VECTOR elements can only be CONST_INT, CONST_DOUBLE, and CONST_FIXED. For example, dwarf2out.c cannot handle anything else when constructing an DW_AT_const_value attribute refering to a CONST_VECTOR. While I still think it would be better to allow any legitimate constant as member of a CONST_VECTOR, this would require non-trivial changes to dwarf2out.c and a couple of other places. Therefore, for now I think it is best to change the SPU back-end to avoid generating CONST_VECTOR expressions that are invalid according to the current middle-end rules. At some later time those middle-end rules could be relaxed ... The following (SPU back-end only) patch implements this. While this might result in somewhat less efficient code being generated for certain case, those cases should be rather rare. Trevor/Andrew, what are your thoughts about this? Would this be OK for mainline and 4.3? Tested on spu-elf with no regressions, fixes the pr34856 FAILs. Bye, Ulrich ChangeLog: PR target/34856 * config/spu/spu.c (spu_builtin_splats): Do not generate invalid CONST_VECTOR expressions. (spu_expand_vector_init): Likewise. Index: gcc/config/spu/spu.c =================================================================== *** gcc/config/spu/spu.c (revision 136912) --- gcc/config/spu/spu.c (working copy) *************** spu_builtin_splats (rtx ops[]) *** 4576,4590 **** constant_to_array (GET_MODE_INNER (mode), ops[1], arr); emit_move_insn (ops[0], array_to_constant (mode, arr)); } - else if (!flag_pic && GET_MODE (ops[0]) == V4SImode && CONSTANT_P (ops[1])) - { - rtvec v = rtvec_alloc (4); - RTVEC_ELT (v, 0) = ops[1]; - RTVEC_ELT (v, 1) = ops[1]; - RTVEC_ELT (v, 2) = ops[1]; - RTVEC_ELT (v, 3) = ops[1]; - emit_move_insn (ops[0], gen_rtx_CONST_VECTOR (mode, v)); - } else { rtx reg = gen_reg_rtx (TImode); --- 4576,4581 ---- *************** spu_expand_vector_init (rtx target, rtx *** 4903,4909 **** for (i = 0; i < n_elts; ++i) { x = XVECEXP (vals, 0, i); ! if (!CONSTANT_P (x)) ++n_var; else { --- 4894,4902 ---- for (i = 0; i < n_elts; ++i) { x = XVECEXP (vals, 0, i); ! if (!(CONST_INT_P (x) ! || GET_CODE (x) == CONST_DOUBLE ! || GET_CODE (x) == CONST_FIXED)) ++n_var; else { *************** spu_expand_vector_init (rtx target, rtx *** 4940,4947 **** /* fill empty slots with the first constant, this increases our chance of using splats in the recursive call below. */ for (i = 0; i < n_elts; ++i) ! if (!CONSTANT_P (XVECEXP (constant_parts_rtx, 0, i))) ! XVECEXP (constant_parts_rtx, 0, i) = first_constant; spu_expand_vector_init (target, constant_parts_rtx); } --- 4933,4945 ---- /* fill empty slots with the first constant, this increases our chance of using splats in the recursive call below. */ for (i = 0; i < n_elts; ++i) ! { ! x = XVECEXP (constant_parts_rtx, 0, i); ! if (!(CONST_INT_P (x) ! || GET_CODE (x) == CONST_DOUBLE ! || GET_CODE (x) == CONST_FIXED)) ! XVECEXP (constant_parts_rtx, 0, i) = first_constant; ! } spu_expand_vector_init (target, constant_parts_rtx); } *************** spu_expand_vector_init (rtx target, rtx *** 4957,4963 **** for (i = 0; i < n_elts; ++i) { x = XVECEXP (vals, 0, i); ! if (!CONSTANT_P (x)) { if (!register_operand (x, GET_MODE (x))) x = force_reg (GET_MODE (x), x); --- 4955,4963 ---- for (i = 0; i < n_elts; ++i) { x = XVECEXP (vals, 0, i); ! if (!(CONST_INT_P (x) ! || GET_CODE (x) == CONST_DOUBLE ! || GET_CODE (x) == CONST_FIXED)) { if (!register_operand (x, GET_MODE (x))) x = force_reg (GET_MODE (x), x); -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com