42 lines · plain
1; RUN: llc < %s -mtriple=i686-- -mcpu=yonah | FileCheck %s2; rdar://57520253 4; We want:5; CHECK: movl 4(%esp), %ecx6; CHECK-NEXT: andl $15, %ecx7; CHECK-NEXT: movl $42, %eax8; CHECK-NEXT: cmovel %ecx, %eax9; CHECK-NEXT: ret10;11; We don't want:12; movl 4(%esp), %eax13; movl %eax, %ecx # bad: extra copy14; andl $15, %ecx15; testl $15, %eax # bad: peep obstructed16; movl $42, %eax17; cmovel %ecx, %eax18; ret19;20; We also don't want:21; movl $15, %ecx # bad: larger encoding22; andl 4(%esp), %ecx23; movl $42, %eax24; cmovel %ecx, %eax25; ret26;27; We also don't want:28; movl 4(%esp), %ecx29; andl $15, %ecx30; testl %ecx, %ecx # bad: unnecessary test31; movl $42, %eax32; cmovel %ecx, %eax33; ret34 35define i32 @t1(i32 %X) nounwind {36entry:37 %tmp2 = and i32 %X, 15 ; <i32> [#uses=2]38 %tmp4 = icmp eq i32 %tmp2, 0 ; <i1> [#uses=1]39 %retval = select i1 %tmp4, i32 %tmp2, i32 42 ; <i32> [#uses=1]40 ret i32 %retval41}42