This is the mail archive of the gcc-patches@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]

Re: simplify_relational_operation and unsigned char


On 10/29/2009 11:35 AM, Amir Gonnen wrote:
(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.

CONST_INTs should always be truncated and sign-extended, so EQ and NE are doing the right thing. That (const_int 129) should have been transformed to (const_int -127).


Paolo


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