74 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=i686-unknown-linux-gnu < %s | FileCheck %s --check-prefix=X863; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=X644 5; On X86, division in expensive. BuildRemEqFold should therefore run even6; when optimizing for size. Only optimizing for minimum size retains a plain div.7 8define i32 @test_minsize(i32 %X) optsize minsize nounwind readnone {9; X86-LABEL: test_minsize:10; X86: # %bb.0:11; X86-NEXT: movl {{[0-9]+}}(%esp), %eax12; X86-NEXT: pushl $513; X86-NEXT: popl %ecx14; X86-NEXT: cltd15; X86-NEXT: idivl %ecx16; X86-NEXT: testl %edx, %edx17; X86-NEXT: je .LBB0_118; X86-NEXT: # %bb.2:19; X86-NEXT: pushl $-1020; X86-NEXT: popl %eax21; X86-NEXT: retl22; X86-NEXT: .LBB0_1:23; X86-NEXT: pushl $4224; X86-NEXT: popl %eax25; X86-NEXT: retl26;27; X64-LABEL: test_minsize:28; X64: # %bb.0:29; X64-NEXT: movl %edi, %eax30; X64-NEXT: pushq $531; X64-NEXT: popq %rcx32; X64-NEXT: cltd33; X64-NEXT: idivl %ecx34; X64-NEXT: testl %edx, %edx35; X64-NEXT: pushq $4236; X64-NEXT: popq %rcx37; X64-NEXT: pushq $-1038; X64-NEXT: popq %rax39; X64-NEXT: cmovel %ecx, %eax40; X64-NEXT: retq41 %rem = srem i32 %X, 542 %cmp = icmp eq i32 %rem, 043 %ret = select i1 %cmp, i32 42, i32 -1044 ret i32 %ret45}46 47define i32 @test_optsize(i32 %X) optsize nounwind readnone {48; X86-LABEL: test_optsize:49; X86: # %bb.0:50; X86-NEXT: imull $-858993459, {{[0-9]+}}(%esp), %eax # imm = 0xCCCCCCCD51; X86-NEXT: addl $429496729, %eax # imm = 0x1999999952; X86-NEXT: cmpl $858993459, %eax # imm = 0x3333333353; X86-NEXT: movl $42, %eax54; X86-NEXT: jb .LBB1_255; X86-NEXT: # %bb.1:56; X86-NEXT: movl $-10, %eax57; X86-NEXT: .LBB1_2:58; X86-NEXT: retl59;60; X64-LABEL: test_optsize:61; X64: # %bb.0:62; X64-NEXT: imull $-858993459, %edi, %eax # imm = 0xCCCCCCCD63; X64-NEXT: addl $429496729, %eax # imm = 0x1999999964; X64-NEXT: cmpl $858993459, %eax # imm = 0x3333333365; X64-NEXT: movl $42, %ecx66; X64-NEXT: movl $-10, %eax67; X64-NEXT: cmovbl %ecx, %eax68; X64-NEXT: retq69 %rem = srem i32 %X, 570 %cmp = icmp eq i32 %rem, 071 %ret = select i1 %cmp, i32 42, i32 -1072 ret i32 %ret73}74