Returning vectors by value

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Returning vectors by value

Robert Quill
Hi all,

We would like to be able to add support to CLang for returning vectors
by value so you could do something like:

int2 my_func(int x)
{
   return (int2)(x,x);
}

main()
{
   printf("%d", my_func(5).x);
}

Obviously this is a completely pointless example but it demonstrates
what we would like to be able to do. At the moment we hit an assert in
EmitCallExprLValue: "Can't have a scalar return unless the return type
is a reference type!"

I was wondering if anyone had any advice about the right way to go about
solving this?

Thanks for your help,

Rob
-
This message is subject to Imagination Technologies' e-mail terms: http://www.imgtec.com/e-mail.htm

Imagination Technologies Ltd is a limited company registered in England No:  1306335
Registered Office: Imagination House, Home Park Estate, Kings Langley, Hertfordshire, WD4 8LZ.  

Email to and from the company may be monitored for compliance and other administrative purposes.  
-

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Returning vectors by value

Chris Lattner

On Feb 18, 2010, at 3:58 AM, Robert Quill wrote:

> Hi all,
>
> We would like to be able to add support to CLang for returning vectors
> by value so you could do something like:
>
> int2 my_func(int x)
> {
>   return (int2)(x,x);
> }
>
> main()
> {
>   printf("%d", my_func(5).x);
> }
>
> Obviously this is a completely pointless example but it demonstrates
> what we would like to be able to do. At the moment we hit an assert in
> EmitCallExprLValue: "Can't have a scalar return unless the return type
> is a reference type!"

this is just a missing case in the code generator, please file a bugzilla.

-Chris

>
> I was wondering if anyone had any advice about the right way to go about
> solving this?
>
> Thanks for your help,
>
> Rob
> -
> This message is subject to Imagination Technologies' e-mail terms: http://www.imgtec.com/e-mail.htm
>
> Imagination Technologies Ltd is a limited company registered in England No:  1306335
> Registered Office: Imagination House, Home Park Estate, Kings Langley, Hertfordshire, WD4 8LZ.  
>
> Email to and from the company may be monitored for compliance and other administrative purposes.  
> -
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev