71 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-- | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefix=X644 5; Make sure none of these crash, and that the power-of-two transformations6; trigger correctly.7 8define i128 @test1(i128 %x) nounwind {9; X86-LABEL: test1:10; X86: # %bb.0:11; X86-NEXT: pushl %ebp12; X86-NEXT: movl %esp, %ebp13; X86-NEXT: andl $-16, %esp14; X86-NEXT: subl $16, %esp15; X86-NEXT: movl 8(%ebp), %eax16; X86-NEXT: movl 32(%ebp), %ecx17; X86-NEXT: movl 36(%ebp), %edx18; X86-NEXT: shrdl $2, %edx, %ecx19; X86-NEXT: shrl $2, %edx20; X86-NEXT: movl %edx, 4(%eax)21; X86-NEXT: movl %ecx, (%eax)22; X86-NEXT: movl $0, 12(%eax)23; X86-NEXT: movl $0, 8(%eax)24; X86-NEXT: movl %ebp, %esp25; X86-NEXT: popl %ebp26; X86-NEXT: retl $427;28; X64-LABEL: test1:29; X64: # %bb.0:30; X64-NEXT: movq %rsi, %rax31; X64-NEXT: shrq $2, %rax32; X64-NEXT: xorl %edx, %edx33; X64-NEXT: retq34 %tmp = udiv i128 %x, 7378697629483820646435 ret i128 %tmp36}37 38define i128 @test2(i128 %x) nounwind {39; X86-LABEL: test2:40; X86 doesn't have __divti3, so the urem is expanded into a loop.41; X86: udiv-do-while42;43; X64-LABEL: test2:44; X64: # %bb.0:45; X64-NEXT: pushq %rax46; X64-NEXT: xorl %edx, %edx47; X64-NEXT: movq $-4, %rcx48; X64-NEXT: callq __udivti3@PLT49; X64-NEXT: popq %rcx50; X64-NEXT: retq51 %tmp = udiv i128 %x, -7378697629483820646452 ret i128 %tmp53}54 55define i128 @test3(i128 %x) nounwind {56; X86-LABEL: test3:57; X86 doesn't have __divti3, so the urem is expanded into a loop.58; X86: udiv-do-while59;60; X64-LABEL: test3:61; X64: # %bb.0:62; X64-NEXT: pushq %rax63; X64-NEXT: movq $-3, %rdx64; X64-NEXT: movq $-5, %rcx65; X64-NEXT: callq __udivti3@PLT66; X64-NEXT: popq %rcx67; X64-NEXT: retq68 %tmp = udiv i128 %x, -7378697629483820646769 ret i128 %tmp70}71