PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sha1msg1-2.c
blob35a60571f86368ddfbfbae16e2a8026ec72de171
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 <immintrin.h>
9 static void
10 compute_sha1msg1 (int *s1, int *s2, int *r)
12 int w0, w1, w2, w3, w4, w5;
14 w0 = s1[3];
15 w1 = s1[2];
16 w2 = s1[1];
17 w3 = s1[0];
18 w4 = s2[3];
19 w5 = s2[2];
21 r[0] = w5 ^ w3;
22 r[1] = w4 ^ w2;
23 r[2] = w3 ^ w1;
24 r[3] = w2 ^ w0;
27 static void
28 sha_test (void)
30 union128i_d s1, s2, res;
31 int res_ref[4];
33 s1.x = _mm_set_epi32 (111, 222, 333, 444);
34 s2.x = _mm_set_epi32 (555, 666, 0, 0);
36 res.x = _mm_sha1msg1_epu32 (s1.x, s2.x);
38 compute_sha1msg1 (s1.a, s2.a, res_ref);
40 if (check_union128i_d (res, res_ref))
41 abort ();