aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/pr96373.c
blob: f0471b6f68b06cddecaa7fc4f259853d38e9d814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* { dg-do run { target { powerpc*-*-linux* } } } */
/* { dg-options "-O2 -ftree-vectorize" } */

/* Verify it can run successfully, especially on Power10 and later.   */

#define _GNU_SOURCE
#include <fenv.h>

__attribute__ ((noipa)) void
div (double *d, double *s, int n)
{
  for (; n; n--, d++, s++)
    *d = *d / *s;
}

int main()
{
  double d[] = {1,2,3,4,5,6,7,8,9,10,11};
  double s[] = {11,10,9,8,7,6,5,4,3,2,1};

  feenableexcept(FE_DIVBYZERO|FE_INVALID);
  div(d, s, 11);

  int i;
  for (i = 0; i < 11; i++)
    __builtin_printf(" %f", d[i]);

  __builtin_printf("\n");

  return 0;
}