aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/vec-splat-constant-v8hi.c
blob: 59418d3bb0a8ef0d1142843f2b73add30f1ef676 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* { dg-do compile } */
/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10 -O2" } */

#include <altivec.h>

/* Test whether XXSPLTIW is generated for V8HI vector constants.  We make sure
   the power9 support (XXSPLTIB/VUPKLSB) is not done.  */

vector short
v8hi_const_1 (void)
{
  return (vector short) { 1, 1, 1, 1, 1, 1, 1, 1 };	/* VSLTPISH.  */
}

vector short
v8hi_const_126 (void)
{
  return (vector short) { 126, 126, 126, 126,
			  126, 126, 126, 126 };		/* XXSPLTIW.  */
}

vector short
v8hi_const_1023 (void)
{
  return (vector short) { 1023, 1023, 1023, 1023,
			  1023, 1023, 1023, 1023 };	/* XXSPLTIW.  */
}

vector short
v8hi_splats_1 (void)
{
  return vec_splats ((short)1);				/* VSLTPISH.  */
}

vector short
v8hi_splats_126 (void)
{
  return vec_splats ((short)126);			/* XXSPLTIW.  */
}

vector short
v8hi_splats_1023 (void)
{
  return vec_splats ((short)1023);			/* XXSPLTIW.  */
}

/* Test that we can optimiza V8HI where all of the even elements are the same
   and all of the odd elements are the same.  */
vector short
v8hi_const_1023_1000 (void)
{
  return (vector short) { 1023, 1000, 1023, 1000,
			  1023, 1000, 1023, 1000 };	/* XXSPLTIW.  */
}

/* { dg-final { scan-assembler-times {\mxxspltiw\M}  5 } } */
/* { dg-final { scan-assembler-times {\mvspltish\M}  2 } } */
/* { dg-final { scan-assembler-not   {\mxxspltib\M}    } } */
/* { dg-final { scan-assembler-not   {\mvupklsb\M}     } } */
/* { dg-final { scan-assembler-not   {\mlxvx?\M}       } } */
/* { dg-final { scan-assembler-not   {\mplxv\M}        } } */