public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Vector constant question
@ 2001-12-11 17:28 Stan Shebs
  2001-12-11 21:04 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Stan Shebs @ 2001-12-11 17:28 UTC (permalink / raw)
  To: gcc

I've been working on support for AltiVec vector constants, getting
generally good results by adapting compound literal handling for
arrays, and have it working in some simple cases now.

One place where I'm using array code is in expr.c:store_constructor,
on the theory that a vector looks like a short fixed-length array.
Unfortunately the ARRAY_TYPE case wants the tree node to have a
TYPE_DOMAIN value, but for vectors that field is defined as
TYPE_DEBUG_REPRESENTATION_TYPE and is thus unavailable.  I think
I want to use the array store_constructor code, because it has
lots of IQ that makes sense for vector setup.  Does this make
sense, and if so, should I adapt the array code to only look
at the domain if it's an actual array and fake it if it's a vector,
or would it better to clone and strip the array code to make a
dedicated case for vectors?

Stan

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

* Re: Vector constant question
  2001-12-11 17:28 Vector constant question Stan Shebs
@ 2001-12-11 21:04 ` Richard Henderson
  2001-12-11 21:16   ` Stan Shebs
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2001-12-11 21:04 UTC (permalink / raw)
  To: Stan Shebs; +Cc: gcc

On Tue, Dec 11, 2001 at 05:11:15PM -0800, Stan Shebs wrote:
> One place where I'm using array code is in expr.c:store_constructor,
> on the theory that a vector looks like a short fixed-length array.

Err.. I wonder if you've seen the VEC_CONST rtl, and if you
havn't whether that changes your mind.


r~

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

* Re: Vector constant question
  2001-12-11 21:04 ` Richard Henderson
@ 2001-12-11 21:16   ` Stan Shebs
  2001-12-12  2:17     ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Stan Shebs @ 2001-12-11 21:16 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc

Richard Henderson wrote:
> 
> On Tue, Dec 11, 2001 at 05:11:15PM -0800, Stan Shebs wrote:
> > One place where I'm using array code is in expr.c:store_constructor,
> > on the theory that a vector looks like a short fixed-length array.
> 
> Err.. I wonder if you've seen the VEC_CONST rtl, and if you
> havn't whether that changes your mind.

You mean the one that seems to be entirely unused? :-)  Actually, the
Motorola AltiVec support goes that way, creating an rtx just as
soon as the () construct is completely parsed.  But then aren't
you tied to having all constants in the initializer?  For instance,
Motorola's version doesn't accept

main()
{
  extern int foo(void);
  vector_int_typedef loc1 = (vector_int_typedef) (1, foo(), 3, 4);
}

while for my version

  vector_int_typedef loc1 = (vector_int_typedef) {1, foo(), 3, 4};

works just fine (OK, it blows up in reload due to some bizarre
register usage).  Since the theory was to base vector constants
on compound literals, it seems that we ought to allow any construct
between the {} that would be valid for arrays and other types, which
means that sometimes we can have single vec_const rtxes, and other
times we'd have to generate code to compose a vector value.

Stan

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

* Re: Vector constant question
  2001-12-11 21:16   ` Stan Shebs
@ 2001-12-12  2:17     ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2001-12-12  2:17 UTC (permalink / raw)
  To: Stan Shebs; +Cc: gcc

On Tue, Dec 11, 2001 at 09:04:23PM -0800, Stan Shebs wrote:
> while for my version
> 
>   vector_int_typedef loc1 = (vector_int_typedef) {1, foo(), 3, 4};
> 
> works just fine...

Oh, that.

I think you'll have to hack up the array_ref code to 
handle it.  :-(


r~

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

end of thread, other threads:[~2001-12-12  5:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-11 17:28 Vector constant question Stan Shebs
2001-12-11 21:04 ` Richard Henderson
2001-12-11 21:16   ` Stan Shebs
2001-12-12  2:17     ` Richard Henderson

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