blob: 772ff6c3e76649a4f950a0966faa090e12cf242c [file] [log] [blame]
Dan Gohman0a063102009-09-08 23:54:48 +00001; RUN: llc < %s -march=x86 -mcpu=yonah | grep {testl.*%e.x.*%e.x}
Chris Lattner21da6382008-02-19 17:37:35 +00002; rdar://5752025
Chris Lattner21da6382008-02-19 17:37:35 +00003
4; We don't want to fold the and into the test, because the and clobbers its
5; input forcing a copy. We want:
6; movl $15, %ecx
7; andl 4(%esp), %ecx
8; testl %ecx, %ecx
9; movl $42, %eax
10; cmove %ecx, %eax
11; ret
12;
13; Not:
14; movl 4(%esp), %eax
15; movl %eax, %ecx
16; andl $15, %ecx
17; testl $15, %eax
18; movl $42, %eax
19; cmove %ecx, %eax
20; ret
21
22define i32 @t1(i32 %X) nounwind {
23entry:
24 %tmp2 = and i32 %X, 15 ; <i32> [#uses=2]
25 %tmp4 = icmp eq i32 %tmp2, 0 ; <i1> [#uses=1]
26 %retval = select i1 %tmp4, i32 %tmp2, i32 42 ; <i32> [#uses=1]
27 ret i32 %retval
28}
29