https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98477

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #7)
> here is a testcase for the fcsel usage for integer cmov:

A slightly better example where there is no use of inline-asm or forcing to
specific registers:
```
#define vector16 __attribute__((vector_size(16)))
void
foo (int a, int *b, vector16 int c, vector16 int d)
{
  int t = a ? c[0] : d[0];
  *b = t;
}

```
We should be able to produce:
```
foo:
        cmp     w0, 0
        fcsel   s1, s1, s0, eq
        str     s1, [x1]
        ret
```

And here is a decent one for float modes (-O2 -fno-ssa-phiopt is needed though,
otherwise the tree level does the VCE after the cmov):
```
#define vector8 __attribute__((vector_size(8)))
void
foo (int a, double *b, long long c, long long d)
{
  double ct;
  double dt;
  __builtin_memcpy(&ct, &c, sizeof(long long));
  __builtin_memcpy(&dt, &d, sizeof(long long));
  double t = a ? ct : dt;
  *b = t;
}
```

Reply via email to