1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=X86-64
3 ; RUN: llc < %s -mtriple=x86_64-cygwin | FileCheck %s -check-prefix=WIN64
4 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64
5 ; RUN: llc < %s -mtriple=x86_64-mingw32 | FileCheck %s -check-prefix=WIN64
7 define i64 @mod128(i128 %x) nounwind {
8 ; X86-64-LABEL: mod128:
10 ; X86-64-NEXT: pushq %rax
11 ; X86-64-NEXT: movl $3, %edx
12 ; X86-64-NEXT: xorl %ecx, %ecx
13 ; X86-64-NEXT: callq __modti3@PLT
14 ; X86-64-NEXT: popq %rcx
17 ; WIN64-LABEL: mod128:
19 ; WIN64-NEXT: subq $72, %rsp
20 ; WIN64-NEXT: movq %rdx, {{[0-9]+}}(%rsp)
21 ; WIN64-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
22 ; WIN64-NEXT: movq $3, {{[0-9]+}}(%rsp)
23 ; WIN64-NEXT: movq $0, {{[0-9]+}}(%rsp)
24 ; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
25 ; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
26 ; WIN64-NEXT: callq __modti3
27 ; WIN64-NEXT: movq %xmm0, %rax
28 ; WIN64-NEXT: addq $72, %rsp
33 %2 = trunc i128 %1 to i64
37 define i64 @div128(i128 %x) nounwind {
38 ; X86-64-LABEL: div128:
40 ; X86-64-NEXT: pushq %rax
41 ; X86-64-NEXT: movl $3, %edx
42 ; X86-64-NEXT: xorl %ecx, %ecx
43 ; X86-64-NEXT: callq __divti3@PLT
44 ; X86-64-NEXT: popq %rcx
47 ; WIN64-LABEL: div128:
49 ; WIN64-NEXT: subq $72, %rsp
50 ; WIN64-NEXT: movq %rdx, {{[0-9]+}}(%rsp)
51 ; WIN64-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
52 ; WIN64-NEXT: movq $3, {{[0-9]+}}(%rsp)
53 ; WIN64-NEXT: movq $0, {{[0-9]+}}(%rsp)
54 ; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
55 ; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
56 ; WIN64-NEXT: callq __divti3
57 ; WIN64-NEXT: movq %xmm0, %rax
58 ; WIN64-NEXT: addq $72, %rsp
63 %2 = trunc i128 %1 to i64
67 define i64 @umod128(i128 %x) nounwind {
68 ; X86-64-LABEL: umod128:
70 ; X86-64-NEXT: pushq %rax
71 ; X86-64-NEXT: movl $3, %edx
72 ; X86-64-NEXT: xorl %ecx, %ecx
73 ; X86-64-NEXT: callq __umodti3@PLT
74 ; X86-64-NEXT: popq %rcx
77 ; WIN64-LABEL: umod128:
79 ; WIN64-NEXT: subq $72, %rsp
80 ; WIN64-NEXT: movq %rdx, {{[0-9]+}}(%rsp)
81 ; WIN64-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
82 ; WIN64-NEXT: movq $3, {{[0-9]+}}(%rsp)
83 ; WIN64-NEXT: movq $0, {{[0-9]+}}(%rsp)
84 ; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
85 ; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
86 ; WIN64-NEXT: callq __umodti3
87 ; WIN64-NEXT: movq %xmm0, %rax
88 ; WIN64-NEXT: addq $72, %rsp
93 %2 = trunc i128 %1 to i64
97 define i64 @udiv128(i128 %x) nounwind {
98 ; X86-64-LABEL: udiv128:
100 ; X86-64-NEXT: pushq %rax
101 ; X86-64-NEXT: movl $3, %edx
102 ; X86-64-NEXT: xorl %ecx, %ecx
103 ; X86-64-NEXT: callq __udivti3@PLT
104 ; X86-64-NEXT: popq %rcx
107 ; WIN64-LABEL: udiv128:
109 ; WIN64-NEXT: subq $72, %rsp
110 ; WIN64-NEXT: movq %rdx, {{[0-9]+}}(%rsp)
111 ; WIN64-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
112 ; WIN64-NEXT: movq $3, {{[0-9]+}}(%rsp)
113 ; WIN64-NEXT: movq $0, {{[0-9]+}}(%rsp)
114 ; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
115 ; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
116 ; WIN64-NEXT: callq __udivti3
117 ; WIN64-NEXT: movq %xmm0, %rax
118 ; WIN64-NEXT: addq $72, %rsp
123 %2 = trunc i128 %1 to i64