This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

paradoxical subreg problem



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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]