paradoxical subreg problem
law@redhat.com
law@redhat.com
Mon Jan 28 12:15:00 GMT 2002
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
More information about the Gcc
mailing list