[ET Trac] #2530: Thorn Vectors fails to compile using gcc 8.X on POWER9

Roland Haas trac-noreply at einsteintoolkit.org
Thu May 20 15:04:50 CDT 2021


#2530: Thorn Vectors fails to compile using gcc 8.X on POWER9

 Reporter: Roland Haas
   Status: new
Milestone: 
  Version: development version
     Type: bug
 Priority: minor
Component: EinsteinToolkit thorn

Comment (by Roland Haas):

It turns out it wants a cast to `vector double *` \(see [http://openpowerfoundation.org/wp-content/uploads/resources/Intrinsics-Reference/Intrinsics-Reference-20200211.pdf](http://openpowerfoundation.org/wp-content/uploads/resources/Intrinsics-Reference/Intrinsics-Reference-20200211.pdf) which does list both `vec_st(vector double x, long long int, double * )` and  `vec_st(vector double x, long long int, vector double * )` and apparently gcc 8 only supports the latter one\). So this:

```c++
#if 0
g++ -c -g3 -mcpu=power9 -mvsx -O1 -Wall $@ $0
exit
#endif

#include <altivec.h>

void foo(vector double x, double &p, double &q, double &r, double &s)
{
  const long long null = 0;
  *(vector double*)&p = x;
  vec_vsx_st(x, null, &q);
  vec_st(x, null, (vector double*)&r);
}
```

and produces code:

```plaintext
Disassembly of section .text:

0000000000000000 <_Z3fooDv2_dRdS0_S0_S0_>:
#include <altivec.h>

void foo(vector double x, double &p, double &q, double &r, double &s)
{
  const long long null = 0;
  *(vector double*)&p = x;
   0:   0d 00 45 f4     stxv    vs34,0(r5)
  vec_vsx_st(x, null, &q);
   4:   0d 00 46 f4     stxv    vs34,0(r6)
  vec_st(x, null, (vector double*)&r);
   8:   ce 39 40 7c     stvx    v2,0,r7
}
   c:   20 00 80 4e     blr
  10:   00 00 00 00     .long 0x0
  14:   00 09 00 00     .long 0x900
  18:   00 00 00 00     .long 0x0
```

where `stvx` is the regular altivec one and `stxv` is the ISA3 \(POWER9\) instruction.

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2530/thorn-vectors-fails-to-compile-using-gcc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/trac/attachments/20210520/23fc96c7/attachment.html 


More information about the Trac mailing list