286 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X863; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefix=X644 5define void @si64(i64 %x, i64 %y, ptr %p, ptr %q) nounwind {6; X86-LABEL: si64:7; X86: # %bb.0:8; X86-NEXT: pushl %ebp9; X86-NEXT: pushl %ebx10; X86-NEXT: pushl %edi11; X86-NEXT: pushl %esi12; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx13; X86-NEXT: movl {{[0-9]+}}(%esp), %ebp14; X86-NEXT: pushl %ebp15; X86-NEXT: pushl %ebx16; X86-NEXT: pushl {{[0-9]+}}(%esp)17; X86-NEXT: pushl {{[0-9]+}}(%esp)18; X86-NEXT: calll __divdi319; X86-NEXT: addl $16, %esp20; X86-NEXT: movl %eax, %esi21; X86-NEXT: movl %edx, %edi22; X86-NEXT: pushl %ebp23; X86-NEXT: pushl %ebx24; X86-NEXT: pushl {{[0-9]+}}(%esp)25; X86-NEXT: pushl {{[0-9]+}}(%esp)26; X86-NEXT: calll __moddi327; X86-NEXT: addl $16, %esp28; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx29; X86-NEXT: movl %edi, 4(%ecx)30; X86-NEXT: movl %esi, (%ecx)31; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx32; X86-NEXT: movl %edx, 4(%ecx)33; X86-NEXT: movl %eax, (%ecx)34; X86-NEXT: popl %esi35; X86-NEXT: popl %edi36; X86-NEXT: popl %ebx37; X86-NEXT: popl %ebp38; X86-NEXT: retl39;40; X64-LABEL: si64:41; X64: # %bb.0:42; X64-NEXT: movq %rdx, %r843; X64-NEXT: movq %rdi, %rax44; X64-NEXT: cqto45; X64-NEXT: idivq %rsi46; X64-NEXT: movq %rax, (%r8)47; X64-NEXT: movq %rdx, (%rcx)48; X64-NEXT: retq49 %r = sdiv i64 %x, %y50 %t = srem i64 %x, %y51 store i64 %r, ptr %p52 store i64 %t, ptr %q53 ret void54}55 56define void @si32(i32 %x, i32 %y, ptr %p, ptr %q) nounwind {57; X86-LABEL: si32:58; X86: # %bb.0:59; X86-NEXT: pushl %esi60; X86-NEXT: movl {{[0-9]+}}(%esp), %eax61; X86-NEXT: cltd62; X86-NEXT: idivl {{[0-9]+}}(%esp)63; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx64; X86-NEXT: movl {{[0-9]+}}(%esp), %esi65; X86-NEXT: movl %eax, (%esi)66; X86-NEXT: movl %edx, (%ecx)67; X86-NEXT: popl %esi68; X86-NEXT: retl69;70; X64-LABEL: si32:71; X64: # %bb.0:72; X64-NEXT: movq %rdx, %r873; X64-NEXT: movl %edi, %eax74; X64-NEXT: cltd75; X64-NEXT: idivl %esi76; X64-NEXT: movl %eax, (%r8)77; X64-NEXT: movl %edx, (%rcx)78; X64-NEXT: retq79 %r = sdiv i32 %x, %y80 %t = srem i32 %x, %y81 store i32 %r, ptr %p82 store i32 %t, ptr %q83 ret void84}85 86define void @si16(i16 %x, i16 %y, ptr %p, ptr %q) nounwind {87; X86-LABEL: si16:88; X86: # %bb.0:89; X86-NEXT: pushl %esi90; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax91; X86-NEXT: cwtd92; X86-NEXT: idivw {{[0-9]+}}(%esp)93; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx94; X86-NEXT: movl {{[0-9]+}}(%esp), %esi95; X86-NEXT: movw %ax, (%esi)96; X86-NEXT: movw %dx, (%ecx)97; X86-NEXT: popl %esi98; X86-NEXT: retl99;100; X64-LABEL: si16:101; X64: # %bb.0:102; X64-NEXT: movq %rdx, %r8103; X64-NEXT: movl %edi, %eax104; X64-NEXT: # kill: def $ax killed $ax killed $eax105; X64-NEXT: cwtd106; X64-NEXT: idivw %si107; X64-NEXT: movw %ax, (%r8)108; X64-NEXT: movw %dx, (%rcx)109; X64-NEXT: retq110 %r = sdiv i16 %x, %y111 %t = srem i16 %x, %y112 store i16 %r, ptr %p113 store i16 %t, ptr %q114 ret void115}116 117define void @si8(i8 %x, i8 %y, ptr %p, ptr %q) nounwind {118; X86-LABEL: si8:119; X86: # %bb.0:120; X86-NEXT: pushl %ebx121; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax122; X86-NEXT: idivb {{[0-9]+}}(%esp)123; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx124; X86-NEXT: movl {{[0-9]+}}(%esp), %edx125; X86-NEXT: movsbl %ah, %ebx126; X86-NEXT: movb %al, (%edx)127; X86-NEXT: movb %bl, (%ecx)128; X86-NEXT: popl %ebx129; X86-NEXT: retl130;131; X64-LABEL: si8:132; X64: # %bb.0:133; X64-NEXT: movsbl %dil, %eax134; X64-NEXT: idivb %sil135; X64-NEXT: movsbl %ah, %esi136; X64-NEXT: movb %al, (%rdx)137; X64-NEXT: movb %sil, (%rcx)138; X64-NEXT: retq139 %r = sdiv i8 %x, %y140 %t = srem i8 %x, %y141 store i8 %r, ptr %p142 store i8 %t, ptr %q143 ret void144}145 146define void @ui64(i64 %x, i64 %y, ptr %p, ptr %q) nounwind {147; X86-LABEL: ui64:148; X86: # %bb.0:149; X86-NEXT: pushl %ebp150; X86-NEXT: pushl %ebx151; X86-NEXT: pushl %edi152; X86-NEXT: pushl %esi153; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx154; X86-NEXT: movl {{[0-9]+}}(%esp), %ebp155; X86-NEXT: pushl %ebp156; X86-NEXT: pushl %ebx157; X86-NEXT: pushl {{[0-9]+}}(%esp)158; X86-NEXT: pushl {{[0-9]+}}(%esp)159; X86-NEXT: calll __udivdi3160; X86-NEXT: addl $16, %esp161; X86-NEXT: movl %eax, %esi162; X86-NEXT: movl %edx, %edi163; X86-NEXT: pushl %ebp164; X86-NEXT: pushl %ebx165; X86-NEXT: pushl {{[0-9]+}}(%esp)166; X86-NEXT: pushl {{[0-9]+}}(%esp)167; X86-NEXT: calll __umoddi3168; X86-NEXT: addl $16, %esp169; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx170; X86-NEXT: movl %edi, 4(%ecx)171; X86-NEXT: movl %esi, (%ecx)172; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx173; X86-NEXT: movl %edx, 4(%ecx)174; X86-NEXT: movl %eax, (%ecx)175; X86-NEXT: popl %esi176; X86-NEXT: popl %edi177; X86-NEXT: popl %ebx178; X86-NEXT: popl %ebp179; X86-NEXT: retl180;181; X64-LABEL: ui64:182; X64: # %bb.0:183; X64-NEXT: movq %rdx, %r8184; X64-NEXT: movq %rdi, %rax185; X64-NEXT: xorl %edx, %edx186; X64-NEXT: divq %rsi187; X64-NEXT: movq %rax, (%r8)188; X64-NEXT: movq %rdx, (%rcx)189; X64-NEXT: retq190 %r = udiv i64 %x, %y191 %t = urem i64 %x, %y192 store i64 %r, ptr %p193 store i64 %t, ptr %q194 ret void195}196 197define void @ui32(i32 %x, i32 %y, ptr %p, ptr %q) nounwind {198; X86-LABEL: ui32:199; X86: # %bb.0:200; X86-NEXT: pushl %esi201; X86-NEXT: movl {{[0-9]+}}(%esp), %eax202; X86-NEXT: xorl %edx, %edx203; X86-NEXT: divl {{[0-9]+}}(%esp)204; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx205; X86-NEXT: movl {{[0-9]+}}(%esp), %esi206; X86-NEXT: movl %eax, (%esi)207; X86-NEXT: movl %edx, (%ecx)208; X86-NEXT: popl %esi209; X86-NEXT: retl210;211; X64-LABEL: ui32:212; X64: # %bb.0:213; X64-NEXT: movq %rdx, %r8214; X64-NEXT: movl %edi, %eax215; X64-NEXT: xorl %edx, %edx216; X64-NEXT: divl %esi217; X64-NEXT: movl %eax, (%r8)218; X64-NEXT: movl %edx, (%rcx)219; X64-NEXT: retq220 %r = udiv i32 %x, %y221 %t = urem i32 %x, %y222 store i32 %r, ptr %p223 store i32 %t, ptr %q224 ret void225}226 227define void @ui16(i16 %x, i16 %y, ptr %p, ptr %q) nounwind {228; X86-LABEL: ui16:229; X86: # %bb.0:230; X86-NEXT: pushl %esi231; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax232; X86-NEXT: xorl %edx, %edx233; X86-NEXT: divw {{[0-9]+}}(%esp)234; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx235; X86-NEXT: movl {{[0-9]+}}(%esp), %esi236; X86-NEXT: movw %ax, (%esi)237; X86-NEXT: movw %dx, (%ecx)238; X86-NEXT: popl %esi239; X86-NEXT: retl240;241; X64-LABEL: ui16:242; X64: # %bb.0:243; X64-NEXT: movq %rdx, %r8244; X64-NEXT: movl %edi, %eax245; X64-NEXT: # kill: def $ax killed $ax killed $eax246; X64-NEXT: xorl %edx, %edx247; X64-NEXT: divw %si248; X64-NEXT: movw %ax, (%r8)249; X64-NEXT: movw %dx, (%rcx)250; X64-NEXT: retq251 %r = udiv i16 %x, %y252 %t = urem i16 %x, %y253 store i16 %r, ptr %p254 store i16 %t, ptr %q255 ret void256}257 258define void @ui8(i8 %x, i8 %y, ptr %p, ptr %q) nounwind {259; X86-LABEL: ui8:260; X86: # %bb.0:261; X86-NEXT: pushl %ebx262; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax263; X86-NEXT: divb {{[0-9]+}}(%esp)264; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx265; X86-NEXT: movl {{[0-9]+}}(%esp), %edx266; X86-NEXT: movzbl %ah, %ebx267; X86-NEXT: movb %al, (%edx)268; X86-NEXT: movb %bl, (%ecx)269; X86-NEXT: popl %ebx270; X86-NEXT: retl271;272; X64-LABEL: ui8:273; X64: # %bb.0:274; X64-NEXT: movzbl %dil, %eax275; X64-NEXT: divb %sil276; X64-NEXT: movzbl %ah, %esi277; X64-NEXT: movb %al, (%rdx)278; X64-NEXT: movb %sil, (%rcx)279; X64-NEXT: retq280 %r = udiv i8 %x, %y281 %t = urem i8 %x, %y282 store i8 %r, ptr %p283 store i8 %t, ptr %q284 ret void285}286