2 /* { dg-require-effective-target pclmul } */
3 /* { dg-options "-O2 -mpclmul" } */
8 #include "pclmul-check.h"
10 extern void abort (void);
14 static __m128i s1
[NUM
];
15 static __m128i s2
[NUM
];
16 /* We need this array to generate mem form of inst */
17 static __m128i s2m
[NUM
];
19 static __m128i e_00
[NUM
];
20 static __m128i e_01
[NUM
];
21 static __m128i e_10
[NUM
];
22 static __m128i e_11
[NUM
];
24 static __m128i d_00
[NUM
];
25 static __m128i d_01
[NUM
];
26 static __m128i d_10
[NUM
];
27 static __m128i d_11
[NUM
];
29 /* Initialize input/output vectors. (Currently, there is only one set
30 of input/output vectors). */
32 init_data (__m128i
*ls1
, __m128i
*ls2
, __m128i
*le_00
, __m128i
*le_01
,
33 __m128i
*le_10
, __m128i
*le_11
)
37 for (i
= 0; i
< NUM
; i
++)
39 ls1
[i
] = _mm_set_epi32 (0x7B5B5465, 0x73745665,
40 0x63746F72, 0x5D53475D);
41 ls2
[i
] = _mm_set_epi32 (0x48692853, 0x68617929,
42 0x5B477565, 0x726F6E5D);
43 s2m
[i
] = _mm_set_epi32 (0x48692853, 0x68617929,
44 0x5B477565, 0x726F6E5D);
45 le_00
[i
] = _mm_set_epi32 (0x1D4D84C8, 0x5C3440C0,
46 0x929633D5, 0xD36F0451);
47 le_01
[i
] = _mm_set_epi32 (0x1A2BF6DB, 0x3A30862F,
48 0xBABF262D, 0xF4B7D5C9);
49 le_10
[i
] = _mm_set_epi32 (0x1BD17C8D, 0x556AB5A1,
50 0x7FA540AC, 0x2A281315);
51 le_11
[i
] = _mm_set_epi32 (0x1D1E1F2C, 0x592E7C45,
52 0xD66EE03E, 0x410FD4ED);
61 init_data (s1
, s2
, e_00
, e_01
, e_10
, e_11
);
63 for (i
= 0; i
< NUM
; i
+= 2)
65 d_00
[i
] = _mm_clmulepi64_si128 (s1
[i
], s2m
[i
], 0x00);
66 d_01
[i
] = _mm_clmulepi64_si128 (s1
[i
], s2
[i
], 0x01);
67 d_10
[i
] = _mm_clmulepi64_si128 (s1
[i
], s2
[i
], 0x10);
68 d_11
[i
] = _mm_clmulepi64_si128 (s1
[i
], s2
[i
], 0x11);
70 d_11
[i
+ 1] = _mm_clmulepi64_si128 (s1
[i
+ 1], s2
[i
+ 1], 0x11);
71 d_00
[i
+ 1] = _mm_clmulepi64_si128 (s1
[i
+ 1], s2
[i
+ 1], 0x00);
72 d_10
[i
+ 1] = _mm_clmulepi64_si128 (s1
[i
+ 1], s2m
[i
+ 1], 0x10);
73 d_01
[i
+ 1] = _mm_clmulepi64_si128 (s1
[i
+ 1], s2
[i
+ 1], 0x01);
76 for (i
= 0; i
< NUM
; i
++)
78 if (memcmp (d_00
+ i
, e_00
+ i
, sizeof (__m128i
)))
80 if (memcmp (d_01
+ i
, e_01
+ i
, sizeof (__m128i
)))
82 if (memcmp (d_10
+ i
, e_10
+ i
, sizeof (__m128i
)))
84 if (memcmp(d_11
+ i
, e_11
+ i
, sizeof (__m128i
)))