* gcc.target/i386/pr70021.c: Add -mtune=skylake.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sha1msg2-2.c
blob21eaf8dd9fe119b7b99fb9d40c8bdbc262574a2d
1 /* { dg-do run } */
2 /* { dg-options "-O2 -msha" } */
3 /* { dg-require-effective-target sha } */
5 #include "sha-check.h"
6 #include "m128-check.h"
7 #include <x86intrin.h>
8 #include <immintrin.h>
10 static void
11 compute_sha1msg2 (int *s1, int *s2, int *r)
13 int w13, w14, w15, w16, w17, w18, w19;
15 w13 = s2[2];
16 w14 = s2[1];
17 w15 = s2[0];
18 w16 = __rold (s1[3] ^ w13, 1);
19 w17 = __rold (s1[2] ^ w14, 1);
20 w18 = __rold (s1[1] ^ w15, 1);
21 w19 = __rold (s1[0] ^ w16, 1);
23 r[0] = w19;
24 r[1] = w18;
25 r[2] = w17;
26 r[3] = w16;
29 static void
30 sha_test (void)
32 union128i_d s1, s2, res;
33 int res_ref[4];
35 s1.x = _mm_set_epi32 (111, 222, 333, 444);
36 s2.x = _mm_set_epi32 (555, 666, 777, 0);
38 res.x = _mm_sha1msg2_epu32 (s1.x, s2.x);
40 compute_sha1msg2 (s1.a, s2.a, res_ref);
42 if (check_union128i_d (res, res_ref))
43 abort ();