151 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -global-isel=0 -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64,SDAG-X643; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64,FAST-X644; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64,GISEL-X645; RUN: llc < %s -global-isel=0 -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,DAG-X86,SDAG-X866; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,DAG-X86,FAST-X867; RUN: llc < %s -global-isel -global-isel-abort=1 -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86,GISEL-X868 9define i8 @test_srem_i8(i8 %arg1, i8 %arg2) nounwind {10; SDAG-X64-LABEL: test_srem_i8:11; SDAG-X64: # %bb.0:12; SDAG-X64-NEXT: movsbl %dil, %eax13; SDAG-X64-NEXT: idivb %sil14; SDAG-X64-NEXT: movsbl %ah, %eax15; SDAG-X64-NEXT: # kill: def $al killed $al killed $eax16; SDAG-X64-NEXT: retq17;18; FAST-X64-LABEL: test_srem_i8:19; FAST-X64: # %bb.0:20; FAST-X64-NEXT: movsbl %dil, %eax21; FAST-X64-NEXT: idivb %sil22; FAST-X64-NEXT: shrw $8, %ax23; FAST-X64-NEXT: # kill: def $al killed $al killed $ax24; FAST-X64-NEXT: retq25;26; GISEL-X64-LABEL: test_srem_i8:27; GISEL-X64: # %bb.0:28; GISEL-X64-NEXT: movsbl %dil, %eax29; GISEL-X64-NEXT: idivb %sil30; GISEL-X64-NEXT: shrw $8, %ax31; GISEL-X64-NEXT: # kill: def $al killed $al killed $ax32; GISEL-X64-NEXT: retq33;34; SDAG-X86-LABEL: test_srem_i8:35; SDAG-X86: # %bb.0:36; SDAG-X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax37; SDAG-X86-NEXT: idivb {{[0-9]+}}(%esp)38; SDAG-X86-NEXT: movsbl %ah, %eax39; SDAG-X86-NEXT: # kill: def $al killed $al killed $eax40; SDAG-X86-NEXT: retl41;42; FAST-X86-LABEL: test_srem_i8:43; FAST-X86: # %bb.0:44; FAST-X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax45; FAST-X86-NEXT: idivb {{[0-9]+}}(%esp)46; FAST-X86-NEXT: movb %ah, %al47; FAST-X86-NEXT: retl48;49; GISEL-X86-LABEL: test_srem_i8:50; GISEL-X86: # %bb.0:51; GISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax52; GISEL-X86-NEXT: cbtw53; GISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx54; GISEL-X86-NEXT: idivb %cl55; GISEL-X86-NEXT: movb %ah, %al56; GISEL-X86-NEXT: retl57 %ret = srem i8 %arg1, %arg258 ret i8 %ret59}60 61define i16 @test_srem_i16(i16 %arg1, i16 %arg2) nounwind {62; X64-LABEL: test_srem_i16:63; X64: # %bb.0:64; X64-NEXT: movl %edi, %eax65; X64-NEXT: # kill: def $ax killed $ax killed $eax66; X64-NEXT: cwtd67; X64-NEXT: idivw %si68; X64-NEXT: movl %edx, %eax69; X64-NEXT: retq70;71; DAG-X86-LABEL: test_srem_i16:72; DAG-X86: # %bb.0:73; DAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax74; DAG-X86-NEXT: cwtd75; DAG-X86-NEXT: idivw {{[0-9]+}}(%esp)76; DAG-X86-NEXT: movl %edx, %eax77; DAG-X86-NEXT: retl78;79; GISEL-X86-LABEL: test_srem_i16:80; GISEL-X86: # %bb.0:81; GISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax82; GISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx83; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax84; GISEL-X86-NEXT: cwtd85; GISEL-X86-NEXT: idivw %cx86; GISEL-X86-NEXT: movl %edx, %eax87; GISEL-X86-NEXT: retl88 %ret = srem i16 %arg1, %arg289 ret i16 %ret90}91 92define i32 @test_srem_i32(i32 %arg1, i32 %arg2) nounwind {93; X64-LABEL: test_srem_i32:94; X64: # %bb.0:95; X64-NEXT: movl %edi, %eax96; X64-NEXT: cltd97; X64-NEXT: idivl %esi98; X64-NEXT: movl %edx, %eax99; X64-NEXT: retq100;101; X86-LABEL: test_srem_i32:102; X86: # %bb.0:103; X86-NEXT: movl {{[0-9]+}}(%esp), %eax104; X86-NEXT: cltd105; X86-NEXT: idivl {{[0-9]+}}(%esp)106; X86-NEXT: movl %edx, %eax107; X86-NEXT: retl108 %ret = srem i32 %arg1, %arg2109 ret i32 %ret110}111 112define i64 @test_srem_i64(i64 %arg1, i64 %arg2) nounwind {113; X64-LABEL: test_srem_i64:114; X64: # %bb.0:115; X64-NEXT: movq %rdi, %rax116; X64-NEXT: cqto117; X64-NEXT: idivq %rsi118; X64-NEXT: movq %rdx, %rax119; X64-NEXT: retq120;121; DAG-X86-LABEL: test_srem_i64:122; DAG-X86: # %bb.0:123; DAG-X86-NEXT: subl $12, %esp124; DAG-X86-NEXT: pushl {{[0-9]+}}(%esp)125; DAG-X86-NEXT: pushl {{[0-9]+}}(%esp)126; DAG-X86-NEXT: pushl {{[0-9]+}}(%esp)127; DAG-X86-NEXT: pushl {{[0-9]+}}(%esp)128; DAG-X86-NEXT: calll __moddi3129; DAG-X86-NEXT: addl $28, %esp130; DAG-X86-NEXT: retl131;132; GISEL-X86-LABEL: test_srem_i64:133; GISEL-X86: # %bb.0:134; GISEL-X86-NEXT: pushl %esi135; GISEL-X86-NEXT: subl $24, %esp136; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax137; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx138; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx139; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %esi140; GISEL-X86-NEXT: movl %eax, (%esp)141; GISEL-X86-NEXT: movl %ecx, {{[0-9]+}}(%esp)142; GISEL-X86-NEXT: movl %edx, {{[0-9]+}}(%esp)143; GISEL-X86-NEXT: movl %esi, {{[0-9]+}}(%esp)144; GISEL-X86-NEXT: calll __moddi3145; GISEL-X86-NEXT: addl $24, %esp146; GISEL-X86-NEXT: popl %esi147; GISEL-X86-NEXT: retl148 %ret = srem i64 %arg1, %arg2149 ret i64 %ret150}151