155 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=i686--| FileCheck %s --check-prefixes=X863; RUN: llc < %s -mtriple=x86_64--| FileCheck %s --check-prefixes=X644 5;6; PR352027;8 9declare void @on_less()10declare void @on_equal()11declare void @on_greater()12 13define void @eq_first(i32 %0, i32 %1) {14; X86-LABEL: eq_first:15; X86: # %bb.0:16; X86-NEXT: movl {{[0-9]+}}(%esp), %eax17; X86-NEXT: cmpl %eax, {{[0-9]+}}(%esp)18; X86-NEXT: jl on_less@PLT # TAILCALL19; X86-NEXT: # %bb.1:20; X86-NEXT: je on_equal@PLT # TAILCALL21; X86-NEXT: # %bb.2:22; X86-NEXT: jmp on_greater@PLT # TAILCALL23;24; X64-LABEL: eq_first:25; X64: # %bb.0:26; X64-NEXT: cmpl %esi, %edi27; X64-NEXT: jl on_less@PLT # TAILCALL28; X64-NEXT: # %bb.1:29; X64-NEXT: je on_equal@PLT # TAILCALL30; X64-NEXT: # %bb.2:31; X64-NEXT: jmp on_greater@PLT # TAILCALL32 %3 = icmp slt i32 %0, %133 br i1 %3, label %4, label %5344:35 tail call void @on_less()36 br label %9375:38 %6 = icmp eq i32 %0, %139 br i1 %6, label %7, label %8407:41 tail call void @on_equal()42 br label %9438:44 tail call void @on_greater()45 br label %9469:47 ret void48}49 50define void @gt_first(i32 %0, i32 %1) {51; X86-LABEL: gt_first:52; X86: # %bb.0:53; X86-NEXT: movl {{[0-9]+}}(%esp), %eax54; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx55; X86-NEXT: cmpl %eax, %ecx56; X86-NEXT: jl on_less@PLT # TAILCALL57; X86-NEXT: # %bb.1:58; X86-NEXT: jg on_greater@PLT # TAILCALL59; X86-NEXT: # %bb.2:60; X86-NEXT: jmp on_equal@PLT # TAILCALL61;62; X64-LABEL: gt_first:63; X64: # %bb.0:64; X64-NEXT: cmpl %esi, %edi65; X64-NEXT: jl on_less@PLT # TAILCALL66; X64-NEXT: # %bb.1:67; X64-NEXT: jg on_greater@PLT # TAILCALL68; X64-NEXT: # %bb.2:69; X64-NEXT: jmp on_equal@PLT # TAILCALL70 %3 = icmp slt i32 %0, %171 br i1 %3, label %4, label %5724:73 tail call void @on_less()74 br label %9755:76 %6 = icmp slt i32 %1, %077 br i1 %6, label %7, label %8787:79 tail call void @on_greater()80 br label %9818:82 tail call void @on_equal()83 br label %9849:85 ret void86}87 88define void @cmp_sub_same_order(i32 %x, i32 %y, ptr %p) {89; X86-LABEL: cmp_sub_same_order:90; X86: # %bb.0: # %entry91; X86-NEXT: movl {{[0-9]+}}(%esp), %eax92; X86-NEXT: subl {{[0-9]+}}(%esp), %eax93; X86-NEXT: jge .LBB2_294; X86-NEXT: # %bb.1: # %cond.true95; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx96; X86-NEXT: movl %eax, (%ecx)97; X86-NEXT: .LBB2_2: # %cond.end98; X86-NEXT: retl99;100; X64-LABEL: cmp_sub_same_order:101; X64: # %bb.0: # %entry102; X64-NEXT: subl %esi, %edi103; X64-NEXT: jge .LBB2_2104; X64-NEXT: # %bb.1: # %cond.true105; X64-NEXT: movl %edi, (%rdx)106; X64-NEXT: .LBB2_2: # %cond.end107; X64-NEXT: retq108entry:109 %cmp = icmp slt i32 %x, %y110 br i1 %cmp, label %cond.true, label %cond.end111 112cond.true:113 %sub = sub nsw i32 %x, %y114 store i32 %sub, ptr %p115 br label %cond.end116 117cond.end:118 ret void119}120 121define void @cmp_sub_different_order(i32 %x, i32 %y, ptr %p) {122; X86-LABEL: cmp_sub_different_order:123; X86: # %bb.0: # %entry124; X86-NEXT: movl {{[0-9]+}}(%esp), %eax125; X86-NEXT: subl {{[0-9]+}}(%esp), %eax126; X86-NEXT: jge .LBB3_2127; X86-NEXT: # %bb.1: # %cond.true128; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx129; X86-NEXT: movl %eax, (%ecx)130; X86-NEXT: .LBB3_2: # %cond.end131; X86-NEXT: retl132;133; X64-LABEL: cmp_sub_different_order:134; X64: # %bb.0: # %entry135; X64-NEXT: subl %esi, %edi136; X64-NEXT: jge .LBB3_2137; X64-NEXT: # %bb.1: # %cond.true138; X64-NEXT: movl %edi, (%rdx)139; X64-NEXT: .LBB3_2: # %cond.end140; X64-NEXT: retq141entry:142 %cmp = icmp sgt i32 %y, %x143 br i1 %cmp, label %cond.true, label %cond.end144 145cond.true:146 %sub = sub nsw i32 %x, %y147 store i32 %sub, ptr %p148 br label %cond.end149 150cond.end:151 ret void152}153 154declare void @use(i32)155