From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21539 invoked by alias); 28 Jan 2002 18:33:44 -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 21490 invoked from network); 28 Jan 2002 18:33:40 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 28 Jan 2002 18:33:40 -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 KAA06768 for ; Mon, 28 Jan 2002 10:33:38 -0800 (PST) Received: from porcupine.cygnus.com (law@localhost) by porcupine.cygnus.com (8.11.6/8.11.6) with ESMTP id g0SIVHn16351 for ; Mon, 28 Jan 2002 11:31:17 -0700 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 To: gcc@gcc.gnu.org Reply-to: law@redhat.com From: law@redhat.com Subject: paradoxical subreg problem Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 28 Jan 2002 11:36:00 -0000 Message-ID: <16350.1012242676@porcupine.cygnus.com> X-SW-Source: 2002-01/txt/msg01810.txt.bz2 What a rats nest. This relates of PRs 5169, 5185 and 5264. 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)) Think very very carefully about the semantics of a paradoxical subreg. 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? 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. As you can probably guess, the compiler evaluates the expression at compile time, which is wrong. Can someone explain to me clearly what the semantics of a paradoxical subreg really are? jeff