brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · a28bad2 Raw
102 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=LNX3; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s --check-prefix=WIN4 5; Reuse the flags value from the add instructions instead of emitting separate6; testl instructions.7 8; Use the flags on the add.9 10define i32 @test1(ptr %x, i32 %y, i32 %a, i32 %b) nounwind {11; LNX-LABEL: test1:12; LNX:       # %bb.0:13; LNX-NEXT:    movl %edx, %eax14; LNX-NEXT:    addl (%rdi), %esi15; LNX-NEXT:    cmovnsl %ecx, %eax16; LNX-NEXT:    retq17;18; WIN-LABEL: test1:19; WIN:       # %bb.0:20; WIN-NEXT:    movl %r8d, %eax21; WIN-NEXT:    addl (%rcx), %edx22; WIN-NEXT:    cmovnsl %r9d, %eax23; WIN-NEXT:    retq24	%tmp2 = load i32, ptr %x, align 4		; <i32> [#uses=1]25	%tmp4 = add i32 %tmp2, %y		; <i32> [#uses=1]26	%tmp5 = icmp slt i32 %tmp4, 0		; <i1> [#uses=1]27	%tmp.0 = select i1 %tmp5, i32 %a, i32 %b		; <i32> [#uses=1]28	ret i32 %tmp.029}30 31declare void @foo(i32)32 33; Don't use the flags result of the and here, since the and has no34; other use. A simple test is better.35 36define void @test2(i32 %x) nounwind {37; LNX-LABEL: test2:38; LNX:       # %bb.0:39; LNX-NEXT:    testb $16, %dil40; LNX-NEXT:    jne .LBB1_241; LNX-NEXT:  # %bb.1: # %true42; LNX-NEXT:    pushq %rax43; LNX-NEXT:    callq foo@PLT44; LNX-NEXT:    popq %rax45; LNX-NEXT:  .LBB1_2: # %false46; LNX-NEXT:    retq47;48; WIN-LABEL: test2:49; WIN:       # %bb.0:50; WIN-NEXT:    subq $40, %rsp51; WIN-NEXT:    testb $16, %cl52; WIN-NEXT:    jne .LBB1_253; WIN-NEXT:  # %bb.1: # %true54; WIN-NEXT:    callq foo55; WIN-NEXT:  .LBB1_2: # %false56; WIN-NEXT:    addq $40, %rsp57; WIN-NEXT:    retq58  %y = and i32 %x, 1659  %t = icmp eq i32 %y, 060  br i1 %t, label %true, label %false61true:62  call void @foo(i32 %x)63  ret void64false:65  ret void66}67 68; Do use the flags result of the and here, since the and has another use.69 70define void @test3(i32 %x) nounwind {71; LNX-LABEL: test3:72; LNX:       # %bb.0:73; LNX-NEXT:    andl $16, %edi74; LNX-NEXT:    jne .LBB2_275; LNX-NEXT:  # %bb.1: # %true76; LNX-NEXT:    pushq %rax77; LNX-NEXT:    callq foo@PLT78; LNX-NEXT:    popq %rax79; LNX-NEXT:  .LBB2_2: # %false80; LNX-NEXT:    retq81;82; WIN-LABEL: test3:83; WIN:       # %bb.0:84; WIN-NEXT:    subq $40, %rsp85; WIN-NEXT:    andl $16, %ecx86; WIN-NEXT:    jne .LBB2_287; WIN-NEXT:  # %bb.1: # %true88; WIN-NEXT:    callq foo89; WIN-NEXT:  .LBB2_2: # %false90; WIN-NEXT:    addq $40, %rsp91; WIN-NEXT:    retq92  %y = and i32 %x, 1693  %t = icmp eq i32 %y, 094  br i1 %t, label %true, label %false95true:96  call void @foo(i32 %y)97  ret void98false:99  ret void100}101 102