summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c
blob: c4f791dbba6f81ab2a86a20aa1877b3209549167 (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
63
64
65
66
67
68
69
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
/* { dg-require-effective-target lp64 } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-O2 -mcpu=power9" } */

#include <altivec.h>

vector unsigned int
rlmi_test_1 (vector unsigned int x, vector unsigned int y,
	     vector unsigned int z)
{
  return vec_rlmi (x, y, z);
}

vector unsigned long long
rlmi_test_2 (vector unsigned long long x, vector unsigned long long y,
	     vector unsigned long long z)
{
  return vec_rlmi (x, y, z);
}

vector unsigned int
vrlnm_test_1 (vector unsigned int x, vector unsigned int y)
{
  return vec_vrlnm (x, y);
}

vector unsigned long long
vrlnm_test_2 (vector unsigned long long x, vector unsigned long long y)
{
  return vec_vrlnm (x, y);
}

vector unsigned int
rlnm_test_1 (vector unsigned int x, vector unsigned int y,
	     vector unsigned int z)
{
  return vec_rlnm (x, y, z);
}

vector unsigned long long
rlnm_test_2 (vector unsigned long long x, vector unsigned long long y,
	     vector unsigned long long z)
{
  return vec_rlnm (x, y, z);
}

/* Expected code generation for rlmi_test_1 is vrlwmi.
   Expected code generation for rlmi_test_2 is vrldmi.
   Expected code generation for vrlnm_test_1 is vrlwnm.
   Expected code generation for vrlnm_test_2 is vrldnm.
   Expected code generation for the others is more complex, because
   the second and third arguments are combined by a shift and OR,
   and because there is no splat-immediate doubleword.
    - For rlnm_test_1: vspltisw, vslw, xxlor, vrlwnm.
    - For rlnm_test_2: xxspltib, vextsb2d, vsld, xxlor, vrldnm.
   There is a choice of splat instructions in both cases, so we
   just check for "splt".  */

/* { dg-final { scan-assembler-times "vrlwmi" 1 } } */
/* { dg-final { scan-assembler-times "vrldmi" 1 } } */
/* { dg-final { scan-assembler-times "splt" 2 } } */
/* { dg-final { scan-assembler-times "vextsb2d" 1 } } */
/* { dg-final { scan-assembler-times "vslw" 1 } } */
/* { dg-final { scan-assembler-times "vsld" 1 } } */
/* { dg-final { scan-assembler-times "xxlor" 2 } } */
/* { dg-final { scan-assembler-times "vrlwnm" 2 } } */
/* { dg-final { scan-assembler-times "vrldnm" 2 } } */