• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-- | FileCheck %s --check-prefix=X86
3; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefix=X64
4
5; Make sure none of these crash, and that the power-of-two transformations
6; trigger correctly.
7
8define i128 @test1(i128 %x) nounwind {
9; X86-LABEL: test1:
10; X86:       # %bb.0:
11; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
12; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
13; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
14; X86-NEXT:    shrdl $2, %edx, %ecx
15; X86-NEXT:    shrl $2, %edx
16; X86-NEXT:    movl %edx, 4(%eax)
17; X86-NEXT:    movl %ecx, (%eax)
18; X86-NEXT:    movl $0, 12(%eax)
19; X86-NEXT:    movl $0, 8(%eax)
20; X86-NEXT:    retl $4
21;
22; X64-LABEL: test1:
23; X64:       # %bb.0:
24; X64-NEXT:    movq %rsi, %rax
25; X64-NEXT:    shrq $2, %rax
26; X64-NEXT:    xorl %edx, %edx
27; X64-NEXT:    retq
28  %tmp = udiv i128 %x, 73786976294838206464
29  ret i128 %tmp
30}
31
32define i128 @test2(i128 %x) nounwind {
33; X86-LABEL: test2:
34; X86:       # %bb.0:
35; X86-NEXT:    pushl %ebp
36; X86-NEXT:    movl %esp, %ebp
37; X86-NEXT:    pushl %edi
38; X86-NEXT:    pushl %esi
39; X86-NEXT:    andl $-8, %esp
40; X86-NEXT:    subl $16, %esp
41; X86-NEXT:    movl 8(%ebp), %esi
42; X86-NEXT:    movl %esp, %eax
43; X86-NEXT:    pushl $-1
44; X86-NEXT:    pushl $-4
45; X86-NEXT:    pushl $0
46; X86-NEXT:    pushl $0
47; X86-NEXT:    pushl 24(%ebp)
48; X86-NEXT:    pushl 20(%ebp)
49; X86-NEXT:    pushl 16(%ebp)
50; X86-NEXT:    pushl 12(%ebp)
51; X86-NEXT:    pushl %eax
52; X86-NEXT:    calll __udivti3
53; X86-NEXT:    addl $32, %esp
54; X86-NEXT:    movl (%esp), %eax
55; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
56; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
57; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
58; X86-NEXT:    movl %edi, 12(%esi)
59; X86-NEXT:    movl %edx, 8(%esi)
60; X86-NEXT:    movl %ecx, 4(%esi)
61; X86-NEXT:    movl %eax, (%esi)
62; X86-NEXT:    movl %esi, %eax
63; X86-NEXT:    leal -8(%ebp), %esp
64; X86-NEXT:    popl %esi
65; X86-NEXT:    popl %edi
66; X86-NEXT:    popl %ebp
67; X86-NEXT:    retl $4
68;
69; X64-LABEL: test2:
70; X64:       # %bb.0:
71; X64-NEXT:    pushq %rax
72; X64-NEXT:    xorl %edx, %edx
73; X64-NEXT:    movq $-4, %rcx
74; X64-NEXT:    callq __udivti3
75; X64-NEXT:    popq %rcx
76; X64-NEXT:    retq
77  %tmp = udiv i128 %x, -73786976294838206464
78  ret i128 %tmp
79}
80
81define i128 @test3(i128 %x) nounwind {
82; X86-LABEL: test3:
83; X86:       # %bb.0:
84; X86-NEXT:    pushl %ebp
85; X86-NEXT:    movl %esp, %ebp
86; X86-NEXT:    pushl %edi
87; X86-NEXT:    pushl %esi
88; X86-NEXT:    andl $-8, %esp
89; X86-NEXT:    subl $16, %esp
90; X86-NEXT:    movl 8(%ebp), %esi
91; X86-NEXT:    movl %esp, %eax
92; X86-NEXT:    pushl $-1
93; X86-NEXT:    pushl $-5
94; X86-NEXT:    pushl $-1
95; X86-NEXT:    pushl $-3
96; X86-NEXT:    pushl 24(%ebp)
97; X86-NEXT:    pushl 20(%ebp)
98; X86-NEXT:    pushl 16(%ebp)
99; X86-NEXT:    pushl 12(%ebp)
100; X86-NEXT:    pushl %eax
101; X86-NEXT:    calll __udivti3
102; X86-NEXT:    addl $32, %esp
103; X86-NEXT:    movl (%esp), %eax
104; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
105; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
106; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
107; X86-NEXT:    movl %edi, 12(%esi)
108; X86-NEXT:    movl %edx, 8(%esi)
109; X86-NEXT:    movl %ecx, 4(%esi)
110; X86-NEXT:    movl %eax, (%esi)
111; X86-NEXT:    movl %esi, %eax
112; X86-NEXT:    leal -8(%ebp), %esp
113; X86-NEXT:    popl %esi
114; X86-NEXT:    popl %edi
115; X86-NEXT:    popl %ebp
116; X86-NEXT:    retl $4
117;
118; X64-LABEL: test3:
119; X64:       # %bb.0:
120; X64-NEXT:    pushq %rax
121; X64-NEXT:    movq $-3, %rdx
122; X64-NEXT:    movq $-5, %rcx
123; X64-NEXT:    callq __udivti3
124; X64-NEXT:    popq %rcx
125; X64-NEXT:    retq
126  %tmp = udiv i128 %x, -73786976294838206467
127  ret i128 %tmp
128}
129