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]

[PATCH] Re: sparc -m64 can't grok (short)(1 << 15)


> On Dec  6, 1999, Alexandre Oliva <oliva@lsd.ic.unicamp.br> wrote:
> 
>> On Dec  6, 1999, "David S. Miller" <davem@redhat.com> wrote:
>>> What did you compile egcs with, SunPRO?
>
>> gcc 2.95.2
>
>> But you may have a point here, I didn't do a full bootstrap, just a
>> one-stage build.  I'll try a full bootstrap.
>
> Bootstrap finished a few hours ago, but the problem remains.
>
> It's indeed a bug with -m64 :-(

I assume you're compiling it with 32bit host wide int, right?
That is not the best way how to compile the dual arch compiler, because many
optimizations won't take place at all.
I usually compile the 32bit->64bit cross with
-DHOST_BITS_PER_WIDE_INT=64 -DHOST_WIDE_INT=long\ long
Anyway, does the patch below fix it for you?
The issue seems input_operand from gen_movhi not accepted because it is
negative 32bit constant, but sparc_emit_set_const32 seeing a valid
SPARC_SETHI_P and aborting.

BTW: David, I've just checked and code generated by -m32 in the bi arch
compiler differs to output of the plain 32bit compiler. One of the things is
that SPARC_SETHI_P is more picky about the constants it has if it has 64bit
host wide int. I wonder if we should create a global
HOST_WIDE_INT sparc_sethi_mask = 0x3ff;
and initialize it
if (TARGET_ARCH64) sparc_sethi_mask = ~(unsigned HOST_WIDE_INT) 0xfffffc00;
and then
#define SPARC_SETHI_P(X) (((unsigned HOST_WIDE_INT) (X) & sparc_sethi_mask) == 0)

or

#define SPARC_SETHI_P(X) \
(((unsigned HOST_WIDE_INT) (X) & \
  (TARGET_ARCH64 ? ~(unsigned HOST_WIDE_INT) 0xfffffc00 : 0x3ff)) == 0)

1999-12-06  Jakub Jelinek  <jakub@redhat.com>

	* config/sparc/sparc.c (input_operand): Accept valid HImode sethi
	operand.

--- sparc.c.jj14	Wed Dec  1 09:40:38 1999
+++ sparc.c	Mon Dec  6 16:13:46 1999
@@ -1079,7 +1079,8 @@ input_operand (op, mode)
 	   && ((SPARC_SETHI_P (INTVAL (op))
 		&& (! TARGET_ARCH64
 		    || (INTVAL (op) >= 0)
-		    || mode == SImode))
+		    || mode == SImode
+		    || mode == HImode))
 	       || SPARC_SIMM13_P (INTVAL (op))
 	       || (mode == DImode
 		   && ! TARGET_ARCH64)))



Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.18 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________


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