Dan Gohman | 12e0329 | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86 | FileCheck %s |
Dan Gohman | 47b5330 | 2009-09-21 18:32:20 +0000 | [diff] [blame^] | 2 | ; rdar://7226797 |
Dan Gohman | 12e0329 | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 3 | |
| 4 | ; LLVM should omit the testl and use the flags result from the orl. |
| 5 | |
| 6 | ; CHECK: or: |
| 7 | define void @or(float* %A, i32 %IA, i32 %N) nounwind { |
| 8 | entry: |
| 9 | %0 = ptrtoint float* %A to i32 ; <i32> [#uses=1] |
| 10 | %1 = and i32 %0, 3 ; <i32> [#uses=1] |
| 11 | %2 = xor i32 %IA, 1 ; <i32> [#uses=1] |
| 12 | ; CHECK: orl %ecx, %edx |
Dan Gohman | 3c5ec3c | 2009-09-18 21:23:12 +0000 | [diff] [blame] | 13 | ; CHECK-NEXT: je |
Dan Gohman | 12e0329 | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 14 | %3 = or i32 %2, %1 ; <i32> [#uses=1] |
| 15 | %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1] |
| 16 | br i1 %4, label %return, label %bb |
| 17 | |
| 18 | bb: ; preds = %entry |
| 19 | store float 0.000000e+00, float* %A, align 4 |
| 20 | ret void |
| 21 | |
| 22 | return: ; preds = %entry |
| 23 | ret void |
| 24 | } |
| 25 | ; CHECK: xor: |
| 26 | define void @xor(float* %A, i32 %IA, i32 %N) nounwind { |
| 27 | entry: |
| 28 | %0 = ptrtoint float* %A to i32 ; <i32> [#uses=1] |
| 29 | %1 = and i32 %0, 3 ; <i32> [#uses=1] |
| 30 | ; CHECK: xorl $1, %e |
Dan Gohman | 3c5ec3c | 2009-09-18 21:23:12 +0000 | [diff] [blame] | 31 | ; CHECK-NEXT: je |
Dan Gohman | 12e0329 | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 32 | %2 = xor i32 %IA, 1 ; <i32> [#uses=1] |
| 33 | %3 = xor i32 %2, %1 ; <i32> [#uses=1] |
| 34 | %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1] |
| 35 | br i1 %4, label %return, label %bb |
| 36 | |
| 37 | bb: ; preds = %entry |
| 38 | store float 0.000000e+00, float* %A, align 4 |
| 39 | ret void |
| 40 | |
| 41 | return: ; preds = %entry |
| 42 | ret void |
| 43 | } |
| 44 | ; CHECK: and: |
| 45 | define void @and(float* %A, i32 %IA, i32 %N, i8* %p) nounwind { |
| 46 | entry: |
| 47 | store i8 0, i8* %p |
| 48 | %0 = ptrtoint float* %A to i32 ; <i32> [#uses=1] |
| 49 | %1 = and i32 %0, 3 ; <i32> [#uses=1] |
| 50 | %2 = xor i32 %IA, 1 ; <i32> [#uses=1] |
| 51 | ; CHECK: andl $3, % |
| 52 | ; CHECK-NEXT: movb % |
Dan Gohman | 3c5ec3c | 2009-09-18 21:23:12 +0000 | [diff] [blame] | 53 | ; CHECK-NEXT: je |
Dan Gohman | 12e0329 | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 54 | %3 = and i32 %2, %1 ; <i32> [#uses=1] |
| 55 | %t = trunc i32 %3 to i8 |
| 56 | store i8 %t, i8* %p |
| 57 | %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1] |
| 58 | br i1 %4, label %return, label %bb |
| 59 | |
| 60 | bb: ; preds = %entry |
| 61 | store float 0.000000e+00, float* null, align 4 |
| 62 | ret void |
| 63 | |
| 64 | return: ; preds = %entry |
| 65 | ret void |
| 66 | } |
| 67 | |
| 68 | ; Just like @and, but without the trunc+store. This should use a testl |
| 69 | ; instead of an andl. |
| 70 | ; CHECK: test: |
| 71 | define void @test(float* %A, i32 %IA, i32 %N, i8* %p) nounwind { |
| 72 | entry: |
| 73 | store i8 0, i8* %p |
| 74 | %0 = ptrtoint float* %A to i32 ; <i32> [#uses=1] |
| 75 | %1 = and i32 %0, 3 ; <i32> [#uses=1] |
| 76 | %2 = xor i32 %IA, 1 ; <i32> [#uses=1] |
| 77 | ; CHECK: testb $3, % |
Dan Gohman | 3c5ec3c | 2009-09-18 21:23:12 +0000 | [diff] [blame] | 78 | ; CHECK-NEXT: je |
Dan Gohman | 12e0329 | 2009-09-18 19:59:53 +0000 | [diff] [blame] | 79 | %3 = and i32 %2, %1 ; <i32> [#uses=1] |
| 80 | %4 = icmp eq i32 %3, 0 ; <i1> [#uses=1] |
| 81 | br i1 %4, label %return, label %bb |
| 82 | |
| 83 | bb: ; preds = %entry |
| 84 | store float 0.000000e+00, float* null, align 4 |
| 85 | ret void |
| 86 | |
| 87 | return: ; preds = %entry |
| 88 | ret void |
| 89 | } |