#include <altivec.h>
#define B_INIT1 { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, \
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10 };
#define B_INIT2 { 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, \
0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x70 };
#define H_INIT1 { 0x0102, 0x0304, 0x0506, 0x0708, \
0x090A, 0x0B0C, 0x0D0E, 0x0F10 };
#define H_INIT2 { 0x7172, 0x7374, 0x7576, 0x7778, \
0x797A, 0x7B7C, 0x7D7E, 0x7F70 };
#define W_INIT1 { 0x01020304, 0x05060708, \
0x090A0B0C, 0x0D0E0F10 };
#define W_INIT2 { 0x71727374, 0x75767778, \
0x797A7B7C, 0x7D7E7F70 };
#define D_INIT1 { 0x0102030405060708, \
0x090A0B0C0D0E0F10 };
#define D_INIT2 { 0x7172737475767778, \
0x797A7B7C7D7E7F70 };
vector unsigned char test_vpmsumb(void)
{
vector unsigned char a = B_INIT1
vector unsigned char b = B_INIT2
return __builtin_altivec_crypto_vpmsumb(a, b);
}
vector unsigned short test_vpmsumh(void)
{
vector unsigned short a = H_INIT1
vector unsigned short b = H_INIT2
return __builtin_altivec_crypto_vpmsumh(a, b);
}
vector unsigned int test_vpmsumw(void)
{
vector unsigned int a = W_INIT1
vector unsigned int b = W_INIT2
return __builtin_altivec_crypto_vpmsumw(a, b);
}
vector unsigned long long test_vpmsumd(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return __builtin_altivec_crypto_vpmsumd(a, b);
}
vector unsigned long long test_vsbox(void)
{
vector unsigned long long a = D_INIT1
return __builtin_altivec_crypto_vsbox(a);
}
vector unsigned char test_vpermxorb(void)
{
vector unsigned char a = B_INIT1
vector unsigned char b = B_INIT2
vector unsigned char c = B_INIT2
return __builtin_altivec_crypto_vpermxor(a, b, c);
}
vector bool char test_vpermxorbc(vector bool char a,
vector bool char b,
vector bool char c) {
return vec_permxor(a, b, c);
}
vector signed char test_vpermxorsc(vector signed char a,
vector signed char b,
vector signed char c) {
return vec_permxor(a, b, c);
}
vector unsigned char test_vpermxoruc(vector unsigned char a,
vector unsigned char b,
vector unsigned char c) {
return vec_permxor(a, b, c);
}
vector unsigned char test_vpermxoruc_be(vector unsigned char a,
vector unsigned char b,
vector unsigned char c) {
return __builtin_altivec_crypto_vpermxor_be(a, b, c);
}
vector unsigned long long test_vcipher(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return __builtin_altivec_crypto_vcipher(a, b);
}
vector unsigned long long test_vcipherlast(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return __builtin_altivec_crypto_vcipherlast(a, b);
}
vector unsigned long long test_vncipher(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return __builtin_altivec_crypto_vncipher(a, b);
}
vector unsigned long long test_vncipherlast(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return __builtin_altivec_crypto_vncipherlast(a, b);
}
vector unsigned int test_vshasigmaw(void)
{
vector unsigned int a = W_INIT1
return __builtin_altivec_crypto_vshasigmaw(a, 1, 15);
}
vector unsigned long long test_vshasigmad(void)
{
vector unsigned long long a = D_INIT2
return __builtin_altivec_crypto_vshasigmad(a, 1, 15);
}
vector unsigned char test_vpmsumb_e(void)
{
vector unsigned char a = B_INIT1
vector unsigned char b = B_INIT2
return __builtin_crypto_vpmsumb(a, b);
}
vector unsigned short test_vpmsumh_e(void)
{
vector unsigned short a = H_INIT1
vector unsigned short b = H_INIT2
return __builtin_crypto_vpmsumb(a, b);
}
vector unsigned int test_vpmsumw_e(void)
{
vector unsigned int a = W_INIT1
vector unsigned int b = W_INIT2
return __builtin_crypto_vpmsumb(a, b);
}
vector unsigned long long test_vpmsumd_e(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return __builtin_crypto_vpmsumb(a, b);
}
vector unsigned long long test_vsbox_e(void)
{
vector unsigned long long a = D_INIT1
return __builtin_crypto_vsbox(a);
}
vector unsigned char test_vpermxorb_e(void)
{
vector unsigned char a = B_INIT1
vector unsigned char b = B_INIT2
vector unsigned char c = B_INIT2
return __builtin_crypto_vpermxor(a, b, c);
}
vector unsigned short test_vpermxorh_e(void)
{
vector unsigned short a = H_INIT1
vector unsigned short b = H_INIT2
vector unsigned short c = H_INIT2
return __builtin_crypto_vpermxor(a, b, c);
}
vector unsigned int test_vpermxorw_e(void)
{
vector unsigned int a = W_INIT1
vector unsigned int b = W_INIT2
vector unsigned int c = W_INIT2
return __builtin_crypto_vpermxor(a, b, c);
}
vector unsigned long long test_vpermxord_e(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
vector unsigned long long c = D_INIT2
return __builtin_crypto_vpermxor(a, b, c);
}
vector unsigned long long test_vcipher_e(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return __builtin_crypto_vcipher(a, b);
}
vector unsigned long long test_vcipherlast_e(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return __builtin_crypto_vcipherlast(a, b);
}
vector unsigned int test_vshasigmaw_e(void)
{
vector unsigned int a = W_INIT1
return __builtin_crypto_vshasigmaw(a, 1, 15);
}
vector unsigned long long test_vshasigmad_e(void)
{
vector unsigned long long a = D_INIT2
return __builtin_crypto_vshasigmad(a, 0, 15);
}
vector unsigned long long test_vec_sbox_be(void)
{
vector unsigned long long a = D_INIT1
return vec_sbox_be(a);
}
vector unsigned long long test_vec_cipher_be(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return vec_cipher_be(a, b);
}
vector unsigned long long test_vec_cipherlast_be(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return vec_cipherlast_be(a, b);
}
vector unsigned long long test_vec_ncipher_be(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return vec_ncipher_be(a, b);
}
vector unsigned long long test_vec_ncipherlast_be(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return vec_ncipherlast_be(a, b);
}
vector unsigned int test_vec_shasigma_bew(void)
{
vector unsigned int a = W_INIT1
return vec_shasigma_be(a, 1, 15);
}
vector unsigned long long test_vec_shasigma_bed(void)
{
vector unsigned long long a = D_INIT2
return vec_shasigma_be(a, 1, 15);
}
vector unsigned char test_vec_pmsum_beb(void)
{
vector unsigned char a = B_INIT1
vector unsigned char b = B_INIT2
return vec_pmsum_be(a, b);
}
vector unsigned short test_vec_pmsum_beh(void)
{
vector unsigned short a = H_INIT1
vector unsigned short b = H_INIT2
return vec_pmsum_be(a, b);
}
vector unsigned int test_vec_pmsum_bew(void)
{
vector unsigned int a = W_INIT1
vector unsigned int b = W_INIT2
return vec_pmsum_be(a, b);
}
vector unsigned long long test_vec_pmsum_bed(void)
{
vector unsigned long long a = D_INIT1
vector unsigned long long b = D_INIT2
return vec_pmsum_be(a, b);
}