Chris Lattner | 21da638 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | grep {testl.*%e.x.*%e.x} |
| 2 | ; rdar://5752025 |
Chris Lattner | 21da638 | 2008-02-19 17:37:35 +0000 | [diff] [blame] | 3 | |
| 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 | |
| 22 | define i32 @t1(i32 %X) nounwind { |
| 23 | entry: |
| 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 | |