From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31826 invoked by alias); 1 Jul 2009 19:27:04 -0000 Received: (qmail 31817 invoked by uid 22791); 1 Jul 2009 19:27:03 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Jul 2009 19:26:57 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n61JQtUr010243; Wed, 1 Jul 2009 15:26:55 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n61JQtK2003926; Wed, 1 Jul 2009 15:26:55 -0400 Received: from stone.twiddle.home (vpn-11-50.rdu.redhat.com [10.11.11.50]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n61JQrxn030543; Wed, 1 Jul 2009 15:26:54 -0400 Message-ID: <4A4BB87D.8090608@redhat.com> Date: Wed, 01 Jul 2009 19:27:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: Jean Christophe Beyler CC: gcc@gcc.gnu.org Subject: Re: Immediates propagated wrongly in stores References: <4A4B8D6A.5060404@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg00028.txt.bz2 On 07/01/2009 11:28 AM, Jean Christophe Beyler wrote: > Ok, I think I understand, I've been therefore playing with this. I > initially had: > > (define_insn "movdi_internal1" > [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,R,T,r,R,o") > (match_operand:DI 1 "general_operand" "r,iF,R,J,J,o,r,r"))] > > > For my movdi. I therefore first wanted to handle the fact that I won't > allow stores to use immediates so I thought of changing the above > into: > > (define_insn "movdi_internal1" > [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,R,T,r,R,o") > (match_operand:DI 1 "move_operand" "r,iF,R,J,J,o,r,r"))] > > And then defining a simple predicate: > > (define_predicate "move_operand" > (if_then_else (match_operand 0 "register_operand") > (match_operand 1 "general_operand") > (match_operand 1 "register_operand"))) Predicates can only examine one operand, not two. However, you can write (define_expand "movdi" [(set (match_operand:DI "nonimmediate_operand" "") (match_operand:DI "general_operand" ""))] "" "my_expand_move (operands[0], operands[1]); DONE;") (define_insn "*movdi_internal" [(set (match_operand:DI 0 "nonimmediate_operand" "...") (match_operand:DI 1 "general_operand" "..."))] "my_move_ok (operands[0], operands[1])" ...) void my_expand_move (rtx op0, rtx op1) { // Handle TLS, PIC and other special cases... if (MEM_P (op0)) op1 = force_reg (mode, op1); emit_insn (gen_rtx_SET (VOIDmode, op0, op1)); } bool my_move_ok(rtx op0, rtx op1) { if (MEM_P (op0)) return register_operand (op1, VOIDmode); return true; } Compare this with similar code in other ports. r~