public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* simplify_relational_operation and unsigned char
@ 2009-10-29 14:18 Amir Gonnen
  2009-10-29 17:19 ` Richard Henderson
  2009-10-29 19:26 ` Dave Korn
  0 siblings, 2 replies; 3+ messages in thread
From: Amir Gonnen @ 2009-10-29 14:18 UTC (permalink / raw)
  To: gcc

(gcc-4.4.1)

Hi,
I found out some strange behavior of simplify_relational_operation.
Apparently it assumes QImode is signed even though this could not be
deduced from the EQ operator.
Here is an example:

rtx reg = gen_reg_rtx(QImode);
...
rtx test = simplify_relational_operation(EQ, VOIDmode, QImode, reg,
GEN_INT(129));

In this case simplify_relational_operation returns const_int 0 because
of comparisons optimization with upper and lower bounds performed on
simplify_const_relational_operation.
The problem with this behavior was the removal of a "case 129:" in a
switch during cse pass (proprietary target and backend).

Perhaps EQ and NE could be treated as unsigned, like the
GEU,LEU,GTU,LTU operators?

Amir

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: simplify_relational_operation and unsigned char
  2009-10-29 14:18 simplify_relational_operation and unsigned char Amir Gonnen
@ 2009-10-29 17:19 ` Richard Henderson
  2009-10-29 19:26 ` Dave Korn
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2009-10-29 17:19 UTC (permalink / raw)
  To: Amir Gonnen; +Cc: gcc

On 10/29/2009 03:35 AM, Amir Gonnen wrote:
> rtx test = simplify_relational_operation(EQ, VOIDmode, QImode, reg,
> GEN_INT(129));

CONST_INT is always signed.

If you really wrote this as you quote here, that would be the breakage. 
  Try gen_int_mode (129, QImode) instead.



r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: simplify_relational_operation and unsigned char
  2009-10-29 14:18 simplify_relational_operation and unsigned char Amir Gonnen
  2009-10-29 17:19 ` Richard Henderson
@ 2009-10-29 19:26 ` Dave Korn
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Korn @ 2009-10-29 19:26 UTC (permalink / raw)
  To: Amir Gonnen; +Cc: gcc

Amir Gonnen wrote:

> Perhaps EQ and NE could be treated as unsigned, like the
> GEU,LEU,GTU,LTU operators?

  :) What exactly is "signed equality" and how does/would it differ from
"unsigned equality"?  I'm not sure the concept makes any sense!  (And that's
always a warning sign that your diagnosis has gone astray somewhere and led
you to a false understanding of the problem you're working on.)

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-29 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-29 14:18 simplify_relational_operation and unsigned char Amir Gonnen
2009-10-29 17:19 ` Richard Henderson
2009-10-29 19:26 ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).