aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/p9-splat-1.c
blob: 9502384cce02beb5bef61b2f118be004443ae154 (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
/* { dg-do compile { target lp64 } } */
/* { dg-options "-mdejagnu-cpu=power9 -mvsx -O2" } */
/* { dg-require-effective-target powerpc_vsx } */

#include <altivec.h>

vector int
foo_r (int a)
{
  return (vector int) { a, a, a, a };		/* mtvsrws */
}

vector int
foo_r2 (int a)
{
  return vec_splats (a);			/* mtvsrws */
}

vector int
foo_p (int *a)
{
  return (vector int) { *a, *a, *a, *a };	/* lxvwsx */
}

/* { dg-final { scan-assembler-times "mtvsrws" 2 } } */
/* { dg-final { scan-assembler-times "lxvwsx"  1 } } */