From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11016 invoked by alias); 18 Apr 2014 10:59:56 -0000 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 Received: (qmail 11006 invoked by uid 89); 18 Apr 2014 10:59:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Apr 2014 10:59:54 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3IAxrNN019608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 18 Apr 2014 06:59:53 -0400 Received: from tucnak.zalov.cz (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3IAxpSY004910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 18 Apr 2014 06:59:53 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.8/8.14.7) with ESMTP id s3IAxnZq019988; Fri, 18 Apr 2014 12:59:50 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.8/8.14.8/Submit) id s3IAxnfJ019987; Fri, 18 Apr 2014 12:59:49 +0200 Date: Fri, 18 Apr 2014 11:21:00 -0000 From: Jakub Jelinek To: DJ Delorie Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix up rotate expansion (take 2) Message-ID: <20140418105948.GA1817@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20130510145355.GR1377@tucnak.redhat.com> <518D804A.9080609@redhat.com> <20130511070552.GS1377@tucnak.redhat.com> <20130511084701.GT1377@tucnak.redhat.com> <201404170222.s3H2MqFA014502@greed.delorie.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201404170222.s3H2MqFA014502@greed.delorie.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg01079.txt.bz2 On Wed, Apr 16, 2014 at 10:22:52PM -0400, DJ Delorie wrote: > > + { > > + other_amount > > + = simplify_gen_unary (NEG, GET_MODE (op1), > > + op1, GET_MODE (op1)); > > + other_amount > > + = simplify_gen_binary (AND, GET_MODE (op1), > > + other_amount, > > + GEN_INT (GET_MODE_PRECISION (mode) > > + - 1)); > > + } > > > > shifted = force_reg (mode, shifted); > > > > causes an ICE in gcc.c-torture/execute/20020226-1.c, which we tried to > avoid by adding an "addneghi" pattern (which itself has a bug, hence me > investigating). I don't see why you would need such an pattern. Here is what happens on x86_64 if I forcefully ignore the rotate patterns to excersize this code: #8 0x0000000000a20bd7 in expand_simple_unop (mode=SImode, code=NEG, op0=0x7ffff19f7600, target=0x7ffff19fc2c0, unsignedp=0) at ../../gcc/optabs.c:2511 #9 0x00000000007f180c in force_operand (value=0x7ffff19fd040, target=0x7ffff19fc2c0) at ../../gcc/expr.c:7212 #10 0x00000000007f1457 in force_operand (value=0x7ffff19ddd68, target=0x0) at ../../gcc/expr.c:7154 #11 0x00000000007c8509 in force_reg (mode=SImode, x=0x7ffff19ddd68) at ../../gcc/explow.c:683 #12 0x00000000007dd502 in convert_move (to=0x7ffff19fc2a0, from=0x7ffff19ddd68, unsignedp=1) at ../../gcc/expr.c:607 #13 0x00000000007ddde0 in convert_modes (mode=QImode, oldmode=SImode, x=0x7ffff19ddd68, unsignedp=1) at ../../gcc/expr.c:798 #14 0x0000000000a1ddba in expand_binop_directly (mode=SImode, binoptab=ashl_optab, op0=0x7ffff19f78c0, op1=0x7ffff19ddd68, target=0x0, unsignedp=1, methods=OPTAB_LIB_WIDEN, last=0x7ffff19f4f78) at ../../gcc/optabs.c:1437 #15 0x0000000000a1e18e in expand_binop (mode=SImode, binoptab=ashl_optab, op0=0x7ffff19f78c0, op1=0x7ffff19ddd68, target=0x0, unsignedp=1, methods=OPTAB_LIB_WIDEN) at ../../gcc/optabs.c:1546 #16 0x00000000007d12c9 in expand_shift_1 (code=LSHIFT_EXPR, mode=SImode, shifted=0x7ffff19f78c0, amount=0x7ffff19ddd68, target=0x0, unsignedp=1) at ../../gcc/expmed.c:2287 #17 0x00000000007d1209 in expand_shift_1 (code=RROTATE_EXPR, mode=SImode, shifted=0x7ffff19f78c0, amount=0x7ffff19f7600, target=0x0, unsignedp=1) at ../../gcc/expmed.c:2275 i.e. the other_amount expression (and (neg ()) (const_int)) is, unless it is a general_operand (shouldn't be usually the case) is first forced to register with whatever mode it has (GET_MODE (op1)), and forcing it into a register forces even the operands of the AND using force_operand, thus separate NEG and separate AND insn, and then finally is mode converted (zero extended or truncated) into whatever mode the shift pattern requires. Jakub