| 1 |
#include <stdlib.h> |
| 2 |
#include "m128-check.h" |
| 3 |
|
| 4 |
static void sm3_test (void); |
| 5 |
|
| 6 |
static unsigned |
| 7 |
rol32 (unsigned w, int n) |
| 8 |
{ |
| 9 |
int count = n % 32; |
| 10 |
return ((w << n) | (w >> (32 - n))); |
| 11 |
} |
| 12 |
|
| 13 |
static void |
| 14 |
__attribute__ ((noinline)) |
| 15 |
do_test (void) |
| 16 |
{ |
| 17 |
sm3_test (); |
| 18 |
} |
| 19 |
|
| 20 |
int |
| 21 |
main () |
| 22 |
{ |
| 23 |
/* Run SM3 test only if host has SM3 support. */ |
| 24 |
if (__builtin_cpu_supports ("sm3")) |
| 25 |
{ |
| 26 |
do_test (); |
| 27 |
#ifdef DEBUG |
| 28 |
printf ("PASSED\n"); |
| 29 |
#endif |
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
#ifdef DEBUG |
| 34 |
printf ("SKIPPED\n"); |
| 35 |
#endif |
| 36 |
return 0; |
| 37 |
} |