aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/sm3-check.h
blob: ad9847402fcd95362772d195dcec0ef92db1f040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdlib.h>
#include "m128-check.h"

static void sm3_test (void);

static unsigned
rol32 (unsigned w, int n)
{
  int count = n % 32;
  return ((w << n) | (w >> (32 - n)));
}

static void
__attribute__ ((noinline))
do_test (void)
{
  sm3_test ();
}

int
main ()
{
  /* Run SM3 test only if host has SM3 support.  */
  if (__builtin_cpu_supports ("sm3"))
    {
      do_test ();
#ifdef DEBUG
      printf ("PASSED\n");
#endif
      return 0;
    }

#ifdef DEBUG
  printf ("SKIPPED\n");
#endif
  return 0;
}