GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 19820 - How to get results from a V2SF ?
Summary: How to get results from a V2SF ?
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.3.4
: P2 enhancement
Target Milestone: 4.8.0
Assignee: Not yet assigned to anyone
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2005-02-08 11:02 UTC by Paul Matthews
Modified: 2014-06-12 17:37 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-18 01:38:57


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Matthews 2005-02-08 11:02:23 UTC
This is probably not really a bug, just a hole in the documentation. While
google can demonstrate how to get values into vectors, and the info pages the
names of the manipulation functions avaliable, there seems to be no
documentation on how to get at the results of the manipulation.

How do you get at the results?

typedef float V2SF __attribute__((vector_size(8)));

int main()
{
  V2SF a = { 2.0, 3.0 };
  V2SF b = { 4.0, 5.0 };
  V2SF c;

  c = __builtin_ia32_pfmul(a,b);  
  
  /* how to get at the values in c? */
    
  return 0;
};
Comment 1 Andrew Pinski 2005-02-08 13:37:46 UTC
Hmm, I thought this was documented but you use an union.
Comment 2 Andrew Pinski 2005-06-20 18:42:24 UTC
Confirmed.
Comment 3 Andrew Pinski 2008-11-14 23:19:07 UTC
You can do:
float *cf = &c;
return cf[0] + cf[1];

Or after my patch just c[0] + c[1].
Comment 4 Andrew Pinski 2011-11-17 21:54:48 UTC
This is now fixed in 4.7.0, you can do [0] for C (not for C++).
Comment 5 Marc Glisse 2013-01-13 10:35:41 UTC
Subscripts are documented for 4.6:
http://gcc.gnu.org/onlinedocs/gcc-4.6.3/gcc/Vector-Extensions.html
and they are available for C++ in 4.8, so closing.
Comment 6 Marc Glisse 2013-01-13 10:40:44 UTC
Or was I too fast closing it and we need to explain the union / cast to pointer tricks in the 4.6 and 4.7 documentations for C++ users? In doubt, I am putting the status back to what it was, sorry.
Comment 7 Marc Glisse 2014-06-12 17:37:27 UTC
4.7 branch is closed.