64-bit powerpc compare with constant problem

David Edelsohn dje@watson.ibm.com
Sat Feb 12 19:57:00 GMT 2000


	Sigh.  This is proving much more difficult to get right than I
originally had expected.  PowerPC can perform the logical OR and logical
XOR of any 32-bit quantity using two instructions with immediate operands,
operating on a 32-bit register in 32-bit mode and a 64-bit register in
64-bit mode.  I am running into the problem that GCC carries around
integer values in the host platform's widest signed integer.

	For the two DImode logical OR/XOR patterns, I want to accept any
32-bit unsigned constant.  One important use of this is materializing
64-bit constants in a register.  Given GCC's limited CONST_INT, I cannot
see how to accept any 32-bit value on a 32-bit host without GCC equating
32-bit constants in which the high bit is set with a signed 32-bit
constant.  GCC treats the operation as if it would affect the upper 32
bits of a 64-bit word.

	For instance, I want to accept 0xfffffffe without accepting -2.

	The only solution I can see is to describe the logical operations
as accepting unsigned constants (limiting them to 31 bits on 32-bit hosts)
and creating/accepting 32-bit, unsigned CONST_DOUBLE values and/or
creating a separate "unspec" pattern to handle the 32-bit quantity for
special patterns.  These solutions bothers me, but I do not see how else
to work around this limitation in GCC's host-dependent handling of
integers.

	Any suggestions?

David
===============================================================================
David Edelsohn                                      T.J. Watson Research Center
dje@watson.ibm.com                                  P.O. Box 218
+1 914 945 4364 (TL 862)                            Yorktown Heights, NY 10598


More information about the Gcc-bugs mailing list