Evan Cheng | 005de5e | 2010-04-13 18:54:04 +0000 | [diff] [blame^] | 1 | ; RUN: llc < %s -mtriple=i386-apple-darwin10 -mcpu=core2 | FileCheck %s |
Evan Cheng | 9ab2b98 | 2009-12-18 21:31:31 +0000 | [diff] [blame] | 2 | ; rdar://7475489 |
| 3 | |
Chris Lattner | 133ce87 | 2010-01-02 00:00:03 +0000 | [diff] [blame] | 4 | define i32 @test1(i32 %a, i32 %b) nounwind ssp { |
Evan Cheng | 9ab2b98 | 2009-12-18 21:31:31 +0000 | [diff] [blame] | 5 | entry: |
Chris Lattner | 133ce87 | 2010-01-02 00:00:03 +0000 | [diff] [blame] | 6 | ; CHECK: test1: |
Evan Cheng | 9ab2b98 | 2009-12-18 21:31:31 +0000 | [diff] [blame] | 7 | ; CHECK: xorb |
| 8 | ; CHECK-NOT: andb |
| 9 | ; CHECK-NOT: shrb |
| 10 | ; CHECK: testb $64 |
| 11 | %0 = and i32 %a, 16384 |
| 12 | %1 = icmp ne i32 %0, 0 |
| 13 | %2 = and i32 %b, 16384 |
| 14 | %3 = icmp ne i32 %2, 0 |
| 15 | %4 = xor i1 %1, %3 |
| 16 | br i1 %4, label %bb1, label %bb |
| 17 | |
| 18 | bb: ; preds = %entry |
| 19 | %5 = tail call i32 (...)* @foo() nounwind ; <i32> [#uses=1] |
| 20 | ret i32 %5 |
| 21 | |
| 22 | bb1: ; preds = %entry |
| 23 | %6 = tail call i32 (...)* @bar() nounwind ; <i32> [#uses=1] |
| 24 | ret i32 %6 |
| 25 | } |
| 26 | |
| 27 | declare i32 @foo(...) |
| 28 | |
| 29 | declare i32 @bar(...) |
Chris Lattner | 133ce87 | 2010-01-02 00:00:03 +0000 | [diff] [blame] | 30 | |
| 31 | |
| 32 | |
| 33 | ; PR3351 - (P == 0) & (Q == 0) -> (P|Q) == 0 |
| 34 | define i32 @test2(i32* %P, i32* %Q) nounwind ssp { |
| 35 | entry: |
| 36 | %a = icmp eq i32* %P, null ; <i1> [#uses=1] |
| 37 | %b = icmp eq i32* %Q, null ; <i1> [#uses=1] |
| 38 | %c = and i1 %a, %b |
| 39 | br i1 %c, label %bb1, label %return |
| 40 | |
| 41 | bb1: ; preds = %entry |
| 42 | ret i32 4 |
| 43 | |
| 44 | return: ; preds = %entry |
| 45 | ret i32 192 |
| 46 | ; CHECK: test2: |
| 47 | ; CHECK: movl 4(%esp), %eax |
| 48 | ; CHECK-NEXT: orl 8(%esp), %eax |
| 49 | ; CHECK-NEXT: jne LBB2_2 |
| 50 | } |
| 51 | |
| 52 | ; PR3351 - (P != 0) | (Q != 0) -> (P|Q) != 0 |
| 53 | define i32 @test3(i32* %P, i32* %Q) nounwind ssp { |
| 54 | entry: |
| 55 | %a = icmp ne i32* %P, null ; <i1> [#uses=1] |
| 56 | %b = icmp ne i32* %Q, null ; <i1> [#uses=1] |
| 57 | %c = or i1 %a, %b |
| 58 | br i1 %c, label %bb1, label %return |
| 59 | |
| 60 | bb1: ; preds = %entry |
| 61 | ret i32 4 |
| 62 | |
| 63 | return: ; preds = %entry |
| 64 | ret i32 192 |
| 65 | ; CHECK: test3: |
| 66 | ; CHECK: movl 4(%esp), %eax |
| 67 | ; CHECK-NEXT: orl 8(%esp), %eax |
| 68 | ; CHECK-NEXT: je LBB3_2 |
| 69 | } |
Evan Cheng | fc5a03e | 2010-04-13 18:50:27 +0000 | [diff] [blame] | 70 | |
| 71 | ; <rdar://problem/7598384>: |
| 72 | ; |
| 73 | ; jCC L1 |
| 74 | ; jmp L2 |
| 75 | ; L1: |
| 76 | ; ... |
| 77 | ; L2: |
| 78 | ; ... |
| 79 | ; |
| 80 | ; to: |
| 81 | ; |
| 82 | ; jnCC L2 |
| 83 | ; L1: |
| 84 | ; ... |
| 85 | ; L2: |
| 86 | ; ... |
| 87 | define float @test4(float %x, float %y) nounwind readnone optsize ssp { |
| 88 | entry: |
| 89 | %0 = fpext float %x to double ; <double> [#uses=1] |
| 90 | %1 = fpext float %y to double ; <double> [#uses=1] |
| 91 | %2 = fmul double %0, %1 ; <double> [#uses=3] |
| 92 | %3 = fcmp oeq double %2, 0.000000e+00 ; <i1> [#uses=1] |
| 93 | br i1 %3, label %bb2, label %bb1 |
| 94 | |
| 95 | ; CHECK: jne |
| 96 | ; CHECK-NEXT: jnp |
| 97 | ; CHECK-NOT: jmp |
| 98 | ; CHECK: LBB |
| 99 | |
| 100 | bb1: ; preds = %entry |
| 101 | %4 = fadd double %2, -1.000000e+00 ; <double> [#uses=1] |
| 102 | br label %bb2 |
| 103 | |
| 104 | bb2: ; preds = %entry, %bb1 |
| 105 | %.0.in = phi double [ %4, %bb1 ], [ %2, %entry ] ; <double> [#uses=1] |
| 106 | %.0 = fptrunc double %.0.in to float ; <float> [#uses=1] |
| 107 | ret float %.0 |
| 108 | } |