This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: paradoxical subreg problem
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: law at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 28 Jan 02 14:02:14 EST
- Subject: Re: paradoxical subreg problem
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.
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.
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.