]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c
1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p8vector_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
5 /* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model=dynamic -fno-unroll-loops -fno-unroll-all-loops" } */
7 typedef vector
unsigned long long crypto_t
;
8 typedef vector
unsigned long long v2di_t
;
9 typedef vector
unsigned int v4si_t
;
10 typedef vector
unsigned short v8hi_t
;
11 typedef vector
unsigned char v16qi_t
;
13 crypto_t
crpyto1 (crypto_t a
)
15 return __builtin_crypto_vsbox (a
);
18 crypto_t
crypto2 (crypto_t a
, crypto_t b
)
20 return __builtin_crypto_vcipher (a
, b
);
23 crypto_t
crypto3 (crypto_t a
, crypto_t b
)
25 return __builtin_crypto_vcipherlast (a
, b
);
28 crypto_t
crypto4 (crypto_t a
, crypto_t b
)
30 return __builtin_crypto_vncipher (a
, b
);
33 crypto_t
crypto5 (crypto_t a
, crypto_t b
)
35 return __builtin_crypto_vncipherlast (a
, b
);
38 v16qi_t
crypto6a (v16qi_t a
, v16qi_t b
, v16qi_t c
)
40 return __builtin_crypto_vpermxor (a
, b
, c
);
43 v8hi_t
crypto6b (v8hi_t a
, v8hi_t b
, v8hi_t c
)
45 return __builtin_crypto_vpermxor (a
, b
, c
);
48 v4si_t
crypto6c (v4si_t a
, v4si_t b
, v4si_t c
)
50 return __builtin_crypto_vpermxor (a
, b
, c
);
53 v2di_t
crypto6d (v2di_t a
, v2di_t b
, v2di_t c
)
55 return __builtin_crypto_vpermxor (a
, b
, c
);
58 v16qi_t
crypto7a (v16qi_t a
, v16qi_t b
)
60 return __builtin_crypto_vpmsumb (a
, b
);
63 v16qi_t
crypto7b (v16qi_t a
, v16qi_t b
)
65 return __builtin_crypto_vpmsum (a
, b
);
68 v8hi_t
crypto7c (v8hi_t a
, v8hi_t b
)
70 return __builtin_crypto_vpmsumh (a
, b
);
73 v8hi_t
crypto7d (v8hi_t a
, v8hi_t b
)
75 return __builtin_crypto_vpmsum (a
, b
);
78 v4si_t
crypto7e (v4si_t a
, v4si_t b
)
80 return __builtin_crypto_vpmsumw (a
, b
);
83 v4si_t
crypto7f (v4si_t a
, v4si_t b
)
85 return __builtin_crypto_vpmsum (a
, b
);
88 v2di_t
crypto7g (v2di_t a
, v2di_t b
)
90 return __builtin_crypto_vpmsumd (a
, b
);
93 v2di_t
crypto7h (v2di_t a
, v2di_t b
)
95 return __builtin_crypto_vpmsum (a
, b
);
98 v2di_t
crypto8a (v2di_t a
)
100 return __builtin_crypto_vshasigmad (a
, 0, 8);
103 v2di_t
crypto8b (v2di_t a
)
105 return __builtin_crypto_vshasigma (a
, 0, 8);
108 v4si_t
crypto8c (v4si_t a
)
110 return __builtin_crypto_vshasigmaw (a
, 1, 15);
113 v4si_t
crypto8d (v4si_t a
)
115 return __builtin_crypto_vshasigma (a
, 1, 15);
118 /* Note space is used after the instruction so that vcipherlast does not match
120 /* { dg-final { scan-assembler-times "vcipher " 1 } } */
121 /* { dg-final { scan-assembler-times "vcipherlast " 1 } } */
122 /* { dg-final { scan-assembler-times "vncipher " 1 } } */
123 /* { dg-final { scan-assembler-times "vncipherlast " 1 } } */
124 /* { dg-final { scan-assembler-times "vpermxor " 4 } } */
125 /* { dg-final { scan-assembler-times "vpmsumb " 2 } } */
126 /* { dg-final { scan-assembler-times "vpmsumd " 2 } } */
127 /* { dg-final { scan-assembler-times "vpmsumh " 2 } } */
128 /* { dg-final { scan-assembler-times "vpmsumw " 2 } } */
129 /* { dg-final { scan-assembler-times "vsbox " 1 } } */
130 /* { dg-final { scan-assembler-times "vshasigmad " 2 } } */
131 /* { dg-final { scan-assembler-times "vshasigmaw " 2 } } */