public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* RFAdvice - a couple of old lost Altivec patches
@ 2002-10-02 16:19 Zack Weinberg
  2002-10-02 16:57 ` Dale Johannesen
  0 siblings, 1 reply; 9+ messages in thread
From: Zack Weinberg @ 2002-10-02 16:19 UTC (permalink / raw)
  To: gcc

I've been going through a customer's old 2.95+Altivec tree trying to
bring them up to 3.2.  I found a couple of patches that appear not to
have made it into 3.2, but may still be desirable there.

One is very simple: it adds to ppc-asm.h 

#define vX X

for X in 0 .. 31.  (Near the existing such defines for rX and fX.)
This can be put in easily but I don't know if it's wanted or not.

The other is a bit hairier.  The existing easy_vector_constant()
routine in rs6000.c only considers all-bits-zero easy.  The patch adds
a whole bunch more bit patterns that are considered easy - I quote the
code below for reference.  This is a clearly desirable feature; the
difficulty is, the routine is written to the old layout of
CONST_VECTOR.  I'm having trouble figuring out how to update it for
the new one.  Anyone have suggestions?

zw

int
easy_vector_constant (op)
     register rtx op;

{
  unsigned HOST_WIDE_INT immed;
  if (GET_CODE (op) != CONST_VECTOR
      || GET_MODE (op) != SVmode)
    return 0;

  immed = CONST_VECTOR_0 (op);

  /* If the four 32-bit words aren't the same, it can't be done unless it
     matches an lvsl or lvsr value.  */
  if (immed != CONST_VECTOR_1 (op)
      || immed != CONST_VECTOR_2 (op)
      || immed != CONST_VECTOR_3 (op))
    {
      if (immed + 0x04040404 == CONST_VECTOR_1 (op)
	  && CONST_VECTOR_1 (op) + 0x04040404 == CONST_VECTOR_2 (op)
	  && CONST_VECTOR_2 (op) + 0x04040404 == CONST_VECTOR_3 (op)
	  && (immed >> 16) + 0x0202 == (immed & 0xffff)
	  && (immed >> 24) + 1 == ((immed >> 16) & 0xff)
	  && (immed >>= 24) <= 0x10)
	{
	  if (immed == 0x10)
	    /* Use lvsr 0,0.  */
	    return 7;
	  else
	    /* Use lvsl 0,immed. */
	    return 8;
	}
      else
    return 0;
    }

  /* vxor v,v,v and vspltisw v,0 will work.  */
  else if (immed == 0)
    return 1;

  /* vcmpequw v,v,v and vspltisw v,-1 will work.  */
  else if (immed + 1 == 0)
    return 2;

  /* vsubcuw v,v,v and vspltisw v,1 will work.  */
  else if (immed == 1)
    return 3;

  /* vspltisw will work.  */
  else if (immed + 16 < 32)
    return 4;

  /* The two 16-bit halves aren't the same.  */
  else if (immed >> 16 != (immed & 0xffff))
    return 0;

  /* vspltish will work.  */
  else if (((immed + 16) & 0xffff) < 32)
    return 5;

  /* The two 8-bit halves aren't the same.  */
  else if (immed >> 24 != (immed & 0xff))
    return 0;

  /* vspltisb will work.  */
  else if (((immed + 16) & 0xff) < 32)
    return 6;

  return 0;
}

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

* Re: RFAdvice - a couple of old lost Altivec patches
  2002-10-02 16:19 RFAdvice - a couple of old lost Altivec patches Zack Weinberg
@ 2002-10-02 16:57 ` Dale Johannesen
  2002-10-02 17:42   ` Zack Weinberg
  0 siblings, 1 reply; 9+ messages in thread
From: Dale Johannesen @ 2002-10-02 16:57 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Dale Johannesen, gcc


On Wednesday, October 2, 2002, at 03:33 PM, Zack Weinberg wrote:

> I've been going through a customer's old 2.95+Altivec tree trying to
> bring them up to 3.2....
> The other is a bit hairier.  The existing easy_vector_constant()
> routine in rs6000.c only considers all-bits-zero easy.  The patch adds
> a whole bunch more bit patterns that are considered easy - I quote the
> code below for reference.  This is a clearly desirable feature; the
> difficulty is, the routine is written to the old layout of
> CONST_VECTOR.  I'm having trouble figuring out how to update it for
> the new one.  Anyone have suggestions?

I can do better than that, we have it working.  Unfortunately this patch
came originally from Motorola (according to my archive search here) and
is therefore off limits for FSF, last I heard.

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

* Re: RFAdvice - a couple of old lost Altivec patches
  2002-10-02 16:57 ` Dale Johannesen
@ 2002-10-02 17:42   ` Zack Weinberg
  2002-10-02 19:01     ` Stan Shebs
  2002-10-02 21:29     ` Aldy Hernandez
  0 siblings, 2 replies; 9+ messages in thread
From: Zack Weinberg @ 2002-10-02 17:42 UTC (permalink / raw)
  To: Dale Johannesen; +Cc: gcc

On Wed, Oct 02, 2002 at 03:39:34PM -0700, Dale Johannesen wrote:
> >This is a clearly desirable feature; the
> >difficulty is, the routine is written to the old layout of
> >CONST_VECTOR.  I'm having trouble figuring out how to update it for
> >the new one.  Anyone have suggestions?
> 
> I can do better than that, we have it working.  Unfortunately this patch
> came originally from Motorola (according to my archive search here) and
> is therefore off limits for FSF, last I heard.

I thought the copyright issues with the Motorola code had been
resolved, but you may be more up on this than I am.  Disappointing.

zw

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

* Re: RFAdvice - a couple of old lost Altivec patches
  2002-10-02 17:42   ` Zack Weinberg
@ 2002-10-02 19:01     ` Stan Shebs
  2002-10-02 21:09       ` Kumar Gala
  2002-10-02 21:48       ` Daniel Berlin
  2002-10-02 21:29     ` Aldy Hernandez
  1 sibling, 2 replies; 9+ messages in thread
From: Stan Shebs @ 2002-10-02 19:01 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Dale Johannesen, gcc

Zack Weinberg wrote:

>On Wed, Oct 02, 2002 at 03:39:34PM -0700, Dale Johannesen wrote:
>
>>>This is a clearly desirable feature; the
>>>difficulty is, the routine is written to the old layout of
>>>CONST_VECTOR.  I'm having trouble figuring out how to update it for
>>>the new one.  Anyone have suggestions?
>>>
>>I can do better than that, we have it working.  Unfortunately this patch
>>came originally from Motorola (according to my archive search here) and
>>is therefore off limits for FSF, last I heard.
>>
>
>I thought the copyright issues with the Motorola code had been
>resolved, but you may be more up on this than I am.  Disappointing.
>
The last I remember, it was somewhat confused, but hopefully Kumar sees
this and clarifies for us.  Of course, if you take old easy_vector_constant
bits of interest and simply rewrite them for the current code base, that
completely finesses the problem.  (And if there is no other reasonable way
to express those old bits, then there is no creativity involved and thus
no copyright to worry about!)

Stan


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

* Re: RFAdvice - a couple of old lost Altivec patches
  2002-10-02 19:01     ` Stan Shebs
@ 2002-10-02 21:09       ` Kumar Gala
  2002-10-02 21:48       ` Daniel Berlin
  1 sibling, 0 replies; 9+ messages in thread
From: Kumar Gala @ 2002-10-02 21:09 UTC (permalink / raw)
  To: Stan Shebs; +Cc: Zack Weinberg, Dale Johannesen, gcc

> The last I remember, it was somewhat confused, but hopefully Kumar sees
> this and clarifies for us.  Of course, if you take old 
> easy_vector_constant
> bits of interest and simply rewrite them for the current code base, 
> that
> completely finesses the problem.  (And if there is no other reasonable 
> way
> to express those old bits, then there is no creativity involved and 
> thus
> no copyright to worry about!)

Glad to be of help.  We have assigned over the copyright for the 
AltiVec changes to gcc 2.95.2, gdb, and binutils over to the FSF.  If 
you need any clarification check with the FSF clerks.

- kumar

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

* Re: RFAdvice - a couple of old lost Altivec patches
  2002-10-02 17:42   ` Zack Weinberg
  2002-10-02 19:01     ` Stan Shebs
@ 2002-10-02 21:29     ` Aldy Hernandez
  2002-10-02 21:38       ` Zack Weinberg
  1 sibling, 1 reply; 9+ messages in thread
From: Aldy Hernandez @ 2002-10-02 21:29 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Dale Johannesen, gcc

>>>>> "Zack" == Zack Weinberg <zack@codesourcery.com> writes:

 > On Wed, Oct 02, 2002 at 03:39:34PM -0700, Dale Johannesen wrote:
 >> >This is a clearly desirable feature; the
 >> >difficulty is, the routine is written to the old layout of
 >> >CONST_VECTOR.  I'm having trouble figuring out how to update it for
 >> >the new one.  Anyone have suggestions?
 >> 
 >> I can do better than that, we have it working.  Unfortunately this patch
 >> came originally from Motorola (according to my archive search here) and
 >> is therefore off limits for FSF, last I heard.

 > I thought the copyright issues with the Motorola code had been
 > resolved, but you may be more up on this than I am.  Disappointing.

Sigh, I'm a bit behind reading the gcc list...

Motorola has signed the copyright.  You should be able to take Apple's
code.

And yes, I saw the original easy_vector stuff.  I was just too lazy to
do it back then.  Actually, back then I hadn't written the
CONST_VECTOR stuff yet.

Aldy

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

* Re: RFAdvice - a couple of old lost Altivec patches
  2002-10-02 21:29     ` Aldy Hernandez
@ 2002-10-02 21:38       ` Zack Weinberg
  2002-10-03 11:26         ` Dale Johannesen
  0 siblings, 1 reply; 9+ messages in thread
From: Zack Weinberg @ 2002-10-02 21:38 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: Dale Johannesen, gcc

On Wed, Oct 02, 2002 at 08:19:28PM -0700, Aldy Hernandez wrote:
> 
>  > I thought the copyright issues with the Motorola code had been
>  > resolved, but you may be more up on this than I am.  Disappointing.
> 
> Sigh, I'm a bit behind reading the gcc list...
> 
> Motorola has signed the copyright.  You should be able to take Apple's
> code.

I think I'll rework it a bit so it doesn't need front end changes, but
yes, I plan to do that.  Dale, could you send me/point me at the other
half of this code - the caller of easy_vector_constant, that is, which
has to issue the right insn for each pattern?

zw

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

* Re: RFAdvice - a couple of old lost Altivec patches
  2002-10-02 19:01     ` Stan Shebs
  2002-10-02 21:09       ` Kumar Gala
@ 2002-10-02 21:48       ` Daniel Berlin
  1 sibling, 0 replies; 9+ messages in thread
From: Daniel Berlin @ 2002-10-02 21:48 UTC (permalink / raw)
  To: Stan Shebs; +Cc: Zack Weinberg, Dale Johannesen, gcc



On Wed, 2 Oct 2002, Stan Shebs wrote:

> Zack Weinberg wrote:
> 
> >On Wed, Oct 02, 2002 at 03:39:34PM -0700, Dale Johannesen wrote:
> >
> >>>This is a clearly desirable feature; the
> >>>difficulty is, the routine is written to the old layout of
> >>>CONST_VECTOR.  I'm having trouble figuring out how to update it for
> >>>the new one.  Anyone have suggestions?
> >>>
> >>I can do better than that, we have it working.  Unfortunately this patch
> >>came originally from Motorola (according to my archive search here) and
> >>is therefore off limits for FSF, last I heard.
> >>
> >
> >I thought the copyright issues with the Motorola code had been
> >resolved, but you may be more up on this than I am.  Disappointing.
> >
> The last I remember, it was somewhat confused, but hopefully Kumar sees
> this and clarifies for us.  Of course, if you take old easy_vector_constant
> bits of interest and simply rewrite them for the current code base, that
> completely finesses the problem.  (And if there is no other reasonable way
> to express those old bits, then there is no creativity involved and thus
> no copyright to worry about!)

I actually have taken the program that generates the instruction sequences 
for all the 16 bit constants, and made it output what is necessary to use 
it in easy_vector_constant.

Of course, it's *way* too big.
If you like, however, I can just make it output a compact DFA we can walk 
to generate the vector constants.


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

* Re: RFAdvice - a couple of old lost Altivec patches
  2002-10-02 21:38       ` Zack Weinberg
@ 2002-10-03 11:26         ` Dale Johannesen
  0 siblings, 0 replies; 9+ messages in thread
From: Dale Johannesen @ 2002-10-03 11:26 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Dale Johannesen, Aldy Hernandez, gcc


On Wednesday, October 2, 2002, at 09:09 PM, Zack Weinberg wrote:

> On Wed, Oct 02, 2002 at 08:19:28PM -0700, Aldy Hernandez wrote:
>>
>>> I thought the copyright issues with the Motorola code had been
>>> resolved, but you may be more up on this than I am.  Disappointing.
>>
>> Sigh, I'm a bit behind reading the gcc list...
>>
>> Motorola has signed the copyright.  You should be able to take Apple's
>> code.
>
> I think I'll rework it a bit so it doesn't need front end changes, but
> yes, I plan to do that.  Dale, could you send me/point me at the other
> half of this code - the caller of easy_vector_constant, that is, which
> has to issue the right insn for each pattern?

Sent, privately so as not to flood this list with code (if anybody
else wants it let me know).  Stan, can you post the url for apple's
branch?

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

end of thread, other threads:[~2002-10-03 17:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-02 16:19 RFAdvice - a couple of old lost Altivec patches Zack Weinberg
2002-10-02 16:57 ` Dale Johannesen
2002-10-02 17:42   ` Zack Weinberg
2002-10-02 19:01     ` Stan Shebs
2002-10-02 21:09       ` Kumar Gala
2002-10-02 21:48       ` Daniel Berlin
2002-10-02 21:29     ` Aldy Hernandez
2002-10-02 21:38       ` Zack Weinberg
2002-10-03 11:26         ` Dale Johannesen

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).