public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Zack Weinberg <zack@codesourcery.com>
To: gcc@gcc.gnu.org
Subject: RFAdvice - a couple of old lost Altivec patches
Date: Wed, 02 Oct 2002 16:19:00 -0000	[thread overview]
Message-ID: <20021002223338.GA6772@codesourcery.com> (raw)

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;
}

             reply	other threads:[~2002-10-02 22:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-02 16:19 Zack Weinberg [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021002223338.GA6772@codesourcery.com \
    --to=zack@codesourcery.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).