From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23835 invoked by alias); 28 Jan 2002 19:36:00 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 23790 invoked from network); 28 Jan 2002 19:35:57 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 28 Jan 2002 19:35:57 -0000 Received: from porcupine.cygnus.com (cse.sfbay.redhat.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id LAA12982 for ; Mon, 28 Jan 2002 11:35:44 -0800 (PST) Received: from porcupine.cygnus.com (law@localhost) by porcupine.cygnus.com (8.11.6/8.11.6) with ESMTP id g0SJXAu16735; Mon, 28 Jan 2002 12:33:10 -0700 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 To: kenner@vlsi1.ultra.nyu.edu (Richard Kenner) cc: gcc@gcc.gnu.org Subject: Re: paradoxical subreg problem Reply-To: law@redhat.com From: law@redhat.com In-reply-to: Your message of Mon, 28 Jan 2002 14:02:14 EST. <10201281902.AA25419@vlsi1.ultra.nyu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 28 Jan 2002 12:15:00 -0000 Message-ID: <16734.1012246390@porcupine.cygnus.com> X-SW-Source: 2002-01/txt/msg01818.txt.bz2 In message <10201281902.AA25419@vlsi1.ultra.nyu.edu>, Richard Kenner writes: > I'll start simple. On a big endian machine, can this expression be > optimized into true/false at compile time, or must it be run-time > computed? > > (eq (subreg:SI (mem/s:QI (plus:SI (reg:SI 3 %r3) > (const_int 15 [0xf])) 1) 0) > (mem/s:SI (plus:SI (reg:SI 3 %r3) > (const_int 12 [0xc])) 1)) > > This is equivalent to: > > (set (reg:QI xx) (mem/s:QI (plus:SI (reg:SI 3 %r3) > (const_int 15 [0xf])) 0)) > (eq (subreg:SI (reg:QI xx) 0) > (mem/s:SI (plus:SI (reg:SI 3 %r3) > (const_int 12 [0xc])) 1)) > > > on all machines. Don't assume you can break it into two expressions. Consider the expression as it stands (and as combine creates it). > According to my reading, the compiler is allowed to optimize the > expression into (true) because the bits outside of QImode on the > subreg are "don't care bits" -- meaning they can have any value that > is convenient to us. > > Agree/Disagree? > > I agree. OK. > > Now consider if byte loads zero extend. Does your answer change? In > the subreg arm, those "don't care" bits, have a well defined meaning -- > ie, we can't pretend they have whatever value is convenient for us. > So, unless we have some more specific knowledge about the other arm, > then this expression must be evaluated at runtime. > > I disagree. We "know" what they will be, but the undefined semantics still > holds. So this can also be true. OK. So with your assertions in mind are these two expresions equivalent? (and:SI (subreg:SI (mem:QI) 0) (const_int 255)) (subreg:SI (mem:QI X) 0) jeff