summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c
blob: d0b3eb09ef7e0c64fbfc6cae220e82b0dfd52e6a (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
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf" } */

float load_sf (float *p)
{
  float f = *p;
  __asm__ ("# reg %x0" : "+v" (f));
  return f;
}

double load_df (double *p)
{
  double d = *p;
  __asm__ ("# reg %x0" : "+v" (d));
  return d;
}

double load_dfsf (float *p)
{
  double d = (double) *p;
  __asm__ ("# reg %x0" : "+v" (d));
  return d;
}

void store_sf (float *p, float f)
{
  __asm__ ("# reg %x0" : "+v" (f));
  *p = f;
}

void store_df (double *p, double d)
{
  __asm__ ("# reg %x0" : "+v" (d));
  *p = d;
}

/* { dg-final { scan-assembler-times "lxsspx"  2 } } */
/* { dg-final { scan-assembler-times "lxsdx"   1 } } */
/* { dg-final { scan-assembler-times "stxsspx" 1 } } */
/* { dg-final { scan-assembler-times "stxsdx"  1 } } */