| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target aes } */ |
| 3 |
/* { dg-options "-O2 -maes" } */ |
| 4 |
|
| 5 |
#ifndef CHECK_H |
| 6 |
#define CHECK_H "aes-check.h" |
| 7 |
#endif |
| 8 |
|
| 9 |
#ifndef TEST |
| 10 |
#define TEST aes_test |
| 11 |
#endif |
| 12 |
|
| 13 |
#include CHECK_H |
| 14 |
|
| 15 |
#include <wmmintrin.h> |
| 16 |
#include <string.h> |
| 17 |
|
| 18 |
extern void abort (void); |
| 19 |
|
| 20 |
#define NUM 1024 |
| 21 |
#define IMM8 1 |
| 22 |
|
| 23 |
static __m128i src1[NUM]; |
| 24 |
static __m128i edst[NUM]; |
| 25 |
|
| 26 |
static __m128i resdst[NUM]; |
| 27 |
|
| 28 |
/* Initialize input/output vectors. (Currently, there is only one set |
| 29 |
of input/output vectors). */ |
| 30 |
|
| 31 |
static void |
| 32 |
init_data (__m128i *s1, __m128i *d) |
| 33 |
{ |
| 34 |
int i; |
| 35 |
for (i = 0; i < NUM; i++) |
| 36 |
{ |
| 37 |
s1[i] = _mm_setr_epi32 (0x16157e2b, 0xa6d2ae28, |
| 38 |
0x8815f7ab, 0x3c4fcf09); |
| 39 |
d[i] = _mm_setr_epi32 (0x24b5e434, 0x3424b5e5, |
| 40 |
0xeb848a01, 0x01eb848b); |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
static void |
| 45 |
TEST (void) |
| 46 |
{ |
| 47 |
int i; |
| 48 |
|
| 49 |
init_data (src1, edst); |
| 50 |
|
| 51 |
for (i = 0; i < NUM; i += 16) |
| 52 |
{ |
| 53 |
resdst[i] = _mm_aeskeygenassist_si128 (src1[i], IMM8); |
| 54 |
resdst[i + 1] = _mm_aeskeygenassist_si128 (src1[i + 1], IMM8); |
| 55 |
resdst[i + 2] = _mm_aeskeygenassist_si128 (src1[i + 2], IMM8); |
| 56 |
resdst[i + 3] = _mm_aeskeygenassist_si128 (src1[i + 3], IMM8); |
| 57 |
resdst[i + 4] = _mm_aeskeygenassist_si128 (src1[i + 4], IMM8); |
| 58 |
resdst[i + 5] = _mm_aeskeygenassist_si128 (src1[i + 5], IMM8); |
| 59 |
resdst[i + 6] = _mm_aeskeygenassist_si128 (src1[i + 6], IMM8); |
| 60 |
resdst[i + 7] = _mm_aeskeygenassist_si128 (src1[i + 7], IMM8); |
| 61 |
resdst[i + 8] = _mm_aeskeygenassist_si128 (src1[i + 8], IMM8); |
| 62 |
resdst[i + 9] = _mm_aeskeygenassist_si128 (src1[i + 9], IMM8); |
| 63 |
resdst[i + 10] = _mm_aeskeygenassist_si128 (src1[i + 10], IMM8); |
| 64 |
resdst[i + 11] = _mm_aeskeygenassist_si128 (src1[i + 11], IMM8); |
| 65 |
resdst[i + 12] = _mm_aeskeygenassist_si128 (src1[i + 12], IMM8); |
| 66 |
resdst[i + 13] = _mm_aeskeygenassist_si128 (src1[i + 13], IMM8); |
| 67 |
resdst[i + 14] = _mm_aeskeygenassist_si128 (src1[i + 14], IMM8); |
| 68 |
resdst[i + 15] = _mm_aeskeygenassist_si128 (src1[i + 15], IMM8); |
| 69 |
} |
| 70 |
|
| 71 |
for (i = 0; i < NUM; i++) |
| 72 |
if (memcmp(edst + i, resdst + i, sizeof (__m128i))) |
| 73 |
abort (); |
| 74 |
} |