brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 8b7d87d Raw
72 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:    xorl %edx, %edx15; X86-NEXT:    divl %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:    xorl %edx, %edx33; X64-NEXT:    divl %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 = urem 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:    cmpl $858993460, %eax # imm = 0x3333333452; X86-NEXT:    movl $42, %eax53; X86-NEXT:    jb .LBB1_254; X86-NEXT:  # %bb.1:55; X86-NEXT:    movl $-10, %eax56; X86-NEXT:  .LBB1_2:57; X86-NEXT:    retl58;59; X64-LABEL: test_optsize:60; X64:       # %bb.0:61; X64-NEXT:    imull $-858993459, %edi, %eax # imm = 0xCCCCCCCD62; X64-NEXT:    cmpl $858993460, %eax # imm = 0x3333333463; X64-NEXT:    movl $42, %ecx64; X64-NEXT:    movl $-10, %eax65; X64-NEXT:    cmovbl %ecx, %eax66; X64-NEXT:    retq67  %rem = urem i32 %X, 568  %cmp = icmp eq i32 %rem, 069  %ret = select i1 %cmp, i32 42, i32 -1070  ret i32 %ret71}72