summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/vec-extract-5.c
blob: 9ee7bf2aa6c3ecd2859ec96787b12c0ed5e00847 (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
70
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
/* { dg-options "-O2 -mcpu=power8" } */

#include <altivec.h>

signed char
add_signed_char_0 (vector signed char *p)
{
  return vec_extract (*p, 0) + 1;
}

signed char
add_signed_char_1 (vector signed char *p)
{
  return vec_extract (*p, 1) + 1;
}

signed char
add_signed_char_2 (vector signed char *p)
{
  return vec_extract (*p, 2) + 1;
}

signed char
add_signed_char_3 (vector signed char *p)
{
  return vec_extract (*p, 3) + 1;
}

signed char
add_signed_char_4 (vector signed char *p)
{
  return vec_extract (*p, 4) + 1;
}

signed char
add_signed_char_5 (vector signed char *p)
{
  return vec_extract (*p, 5) + 1;
}

signed char
add_signed_char_6 (vector signed char *p)
{
  return vec_extract (*p, 6) + 1;
}

signed char
add_signed_char_7 (vector signed char *p)
{
  return vec_extract (*p, 7) + 1;
}

signed char
add_signed_char_n (vector signed char *p, int n)
{
  return vec_extract (*p, n) + 1;
}

/* { dg-final { scan-assembler-not "lxvd2x"   } } */
/* { dg-final { scan-assembler-not "lxvw4x"   } } */
/* { dg-final { scan-assembler-not "lxvx"     } } */
/* { dg-final { scan-assembler-not "lxv"      } } */

/* With recent enhancements to the code generator, it is considered
 * legal to implement vec_extract with lvx and xxpermdi.  Previous
 * versions of this test forbid both instructions.  */