1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-apple-darwin9 -mattr=sse4.2 | FileCheck %s --check-prefix=X32
3; RUN: llc < %s -mtriple=x86_64-apple-darwin9 -mattr=sse4.2 | FileCheck %s --check-prefix=X64
4
5declare i32 @llvm.x86.sse42.crc32.32.8(i32, i8) nounwind
6declare i32 @llvm.x86.sse42.crc32.32.16(i32, i16) nounwind
7declare i32 @llvm.x86.sse42.crc32.32.32(i32, i32) nounwind
8
9define i32 @crc32_32_8(i32 %a, i8 %b) nounwind {
10; X32-LABEL: crc32_32_8:
11; X32:       ## BB#0:
12; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
13; X32-NEXT:    crc32b {{[0-9]+}}(%esp), %eax
14; X32-NEXT:    retl
15;
16; X64-LABEL: crc32_32_8:
17; X64:       ## BB#0:
18; X64-NEXT:    crc32b %sil, %edi
19; X64-NEXT:    movl %edi, %eax
20; X64-NEXT:    retq
21  %tmp = call i32 @llvm.x86.sse42.crc32.32.8(i32 %a, i8 %b)
22  ret i32 %tmp
23}
24
25
26define i32 @crc32_32_16(i32 %a, i16 %b) nounwind {
27; X32-LABEL: crc32_32_16:
28; X32:       ## BB#0:
29; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
30; X32-NEXT:    crc32w {{[0-9]+}}(%esp), %eax
31; X32-NEXT:    retl
32;
33; X64-LABEL: crc32_32_16:
34; X64:       ## BB#0:
35; X64-NEXT:    crc32w %si, %edi
36; X64-NEXT:    movl %edi, %eax
37; X64-NEXT:    retq
38  %tmp = call i32 @llvm.x86.sse42.crc32.32.16(i32 %a, i16 %b)
39  ret i32 %tmp
40}
41
42
43define i32 @crc32_32_32(i32 %a, i32 %b) nounwind {
44; X32-LABEL: crc32_32_32:
45; X32:       ## BB#0:
46; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
47; X32-NEXT:    crc32l {{[0-9]+}}(%esp), %eax
48; X32-NEXT:    retl
49;
50; X64-LABEL: crc32_32_32:
51; X64:       ## BB#0:
52; X64-NEXT:    crc32l %esi, %edi
53; X64-NEXT:    movl %edi, %eax
54; X64-NEXT:    retq
55  %tmp = call i32 @llvm.x86.sse42.crc32.32.32(i32 %a, i32 %b)
56  ret i32 %tmp
57}
58
59