Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / aesenclast.c
blob0786316bc57a0ae8570383645e6766ae85225cb5
1 /* { dg-do run } */
2 /* { dg-require-effective-target aes } */
3 /* { dg-options "-O2 -maes" } */
5 #include <wmmintrin.h>
6 #include <string.h>
8 #include "aes-check.h"
10 extern void abort (void);
12 #define NUM 1024
14 static __m128i src1[NUM];
15 static __m128i src2[NUM];
16 static __m128i edst[NUM];
18 static __m128i resdst[NUM];
20 /* Initialize input/output vectors. (Currently, there is only one
21 set of input/output vectors). */
23 static void
24 init_data (__m128i *s1, __m128i *s2, __m128i *d)
26 int i;
27 for (i = 0; i < NUM; i++)
29 s1[i] = _mm_setr_epi32 (0x5d53475d, 0x63746f72,
30 0x73745665, 0x7b5b5465);
31 s2[i] = _mm_setr_epi32 (0x726f6e5d, 0x5b477565,
32 0x68617929, 0x48692853);
33 d[i] = _mm_setr_epi32 (0x53fdc611, 0x177ec425,
34 0x938c5964, 0xc7fb881e);
38 static void
39 aes_test (void)
41 int i;
43 init_data (src1, src2, edst);
45 for (i = 0; i < NUM; i += 16)
47 resdst[i] = _mm_aesenclast_si128 (src1[i], src2[i]);
48 resdst[i + 1] = _mm_aesenclast_si128 (src1[i + 1], src2[i + 1]);
49 resdst[i + 2] = _mm_aesenclast_si128 (src1[i + 2], src2[i + 2]);
50 resdst[i + 3] = _mm_aesenclast_si128 (src1[i + 3], src2[i + 3]);
51 resdst[i + 4] = _mm_aesenclast_si128 (src1[i + 4], src2[i + 4]);
52 resdst[i + 5] = _mm_aesenclast_si128 (src1[i + 5], src2[i + 5]);
53 resdst[i + 6] = _mm_aesenclast_si128 (src1[i + 6], src2[i + 6]);
54 resdst[i + 7] = _mm_aesenclast_si128 (src1[i + 7], src2[i + 7]);
55 resdst[i + 8] = _mm_aesenclast_si128 (src1[i + 8], src2[i + 8]);
56 resdst[i + 9] = _mm_aesenclast_si128 (src1[i + 9], src2[i + 9]);
57 resdst[i + 10] = _mm_aesenclast_si128 (src1[i + 10], src2[i + 10]);
58 resdst[i + 11] = _mm_aesenclast_si128 (src1[i + 11], src2[i + 11]);
59 resdst[i + 12] = _mm_aesenclast_si128 (src1[i + 12], src2[i + 12]);
60 resdst[i + 13] = _mm_aesenclast_si128 (src1[i + 13], src2[i + 13]);
61 resdst[i + 14] = _mm_aesenclast_si128 (src1[i + 14], src2[i + 14]);
62 resdst[i + 15] = _mm_aesenclast_si128 (src1[i + 15], src2[i + 15]);
65 for (i = 0; i < NUM; i++)
66 if (memcmp(edst + i, resdst + i, sizeof (__m128i)))
67 abort ();