aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/pr70963.c
blob: 463ea5bf96ea9508f2891d3367351a395fb16804 (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
32
33
34
35
36
37
38
39
40
41
42
43
/* { dg-do run { target powerpc64*-*-* } } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
/* { dg-options "-mdejagnu-cpu=power8" } */

#include <stdlib.h>
#include <stdio.h>
#include <altivec.h>

static int failed;
static void test (void);

static void check (int result, const char *name)
{
  if (!result)
    {
      failed++;
      printf ("fail %s\n", name);
    }
}
    
int main (void)
{
  test ();
  if (failed)
    abort ();
  return 0;
}

vector double x = { 81.0, 76.0 };
vector long long y = { 81, 76 };

static void test()
{
  vector long long a = vec_cts (x, 0);
  vector double b = vec_ctf (a, 0);
  vector long long c = __builtin_vsx_xvcvdpuxds_scale (x, 0);
  vector double d = vec_ctf (c, 0);
  check (vec_all_eq (a, y), "vec_cts");
  check (vec_all_eq (b, x), "vec_ctf");
  check (vec_all_eq (c, y), "xvcvdpuxds");
  check (vec_all_eq (d, x), "vec_ctf unsigned");
}