summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/crc32-1.c
blob: b3ed5b6842a15a5945e5a441ff9155329c3dd776 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do compile } */
/* { dg-options "-O2 -mcrc32" } */
/* { dg-final { scan-assembler "crc32b\[^\\n\]*eax" } } */
/* { dg-final { scan-assembler "crc32w\[^\\n\]*eax" } } */
/* { dg-final { scan-assembler "crc32l\[^\\n\]*eax" } } */

unsigned int
crc32b (unsigned int x, unsigned char y)
{
  return __builtin_ia32_crc32qi (x, y);
}

unsigned int
crc32w (unsigned int x, unsigned short y)
{
  return __builtin_ia32_crc32hi (x, y);
}

unsigned int
crc32d (unsigned int x, unsigned int y)
{
  return __builtin_ia32_crc32si (x, y);
}