Chris Lattner | 18fdaba | 2010-03-05 06:19:13 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=x86 %s -o - |
| 2 | ; RUN: llc -march=x86-64 %s -o - |
| 3 | |
| 4 | ; PR6497 |
| 5 | |
| 6 | ; Chain and flag folding issues. |
| 7 | define i32 @test1() nounwind ssp { |
| 8 | entry: |
| 9 | %tmp5.i = volatile load i32* undef ; <i32> [#uses=1] |
| 10 | %conv.i = zext i32 %tmp5.i to i64 ; <i64> [#uses=1] |
| 11 | %tmp12.i = volatile load i32* undef ; <i32> [#uses=1] |
| 12 | %conv13.i = zext i32 %tmp12.i to i64 ; <i64> [#uses=1] |
| 13 | %shl.i = shl i64 %conv13.i, 32 ; <i64> [#uses=1] |
| 14 | %or.i = or i64 %shl.i, %conv.i ; <i64> [#uses=1] |
| 15 | %add16.i = add i64 %or.i, 256 ; <i64> [#uses=1] |
| 16 | %shr.i = lshr i64 %add16.i, 8 ; <i64> [#uses=1] |
| 17 | %conv19.i = trunc i64 %shr.i to i32 ; <i32> [#uses=1] |
| 18 | volatile store i32 %conv19.i, i32* undef |
| 19 | ret i32 undef |
| 20 | } |
Chris Lattner | f2f64e9 | 2010-03-10 23:46:44 +0000 | [diff] [blame] | 21 | |
| 22 | ; PR6533 |
| 23 | define void @test2(i1 %x, i32 %y) nounwind { |
| 24 | %land.ext = zext i1 %x to i32 ; <i32> [#uses=1] |
| 25 | %and = and i32 %y, 1 ; <i32> [#uses=1] |
| 26 | %xor = xor i32 %and, %land.ext ; <i32> [#uses=1] |
| 27 | %cmp = icmp eq i32 %xor, 1 ; <i1> [#uses=1] |
| 28 | br i1 %cmp, label %if.end, label %if.then |
| 29 | |
| 30 | if.then: ; preds = %land.end |
| 31 | ret void |
| 32 | |
| 33 | if.end: ; preds = %land.end |
| 34 | ret void |
| 35 | } |
Chris Lattner | b3e87b2 | 2010-03-12 07:15:36 +0000 | [diff] [blame] | 36 | |
| 37 | ; PR6577 |
| 38 | %pair = type { i64, double } |
| 39 | |
Chris Lattner | da0688e | 2010-03-14 18:44:35 +0000 | [diff] [blame] | 40 | define void @test3() { |
Chris Lattner | b3e87b2 | 2010-03-12 07:15:36 +0000 | [diff] [blame] | 41 | dependentGraph243.exit: |
| 42 | %subject19 = load %pair* undef ; <%1> [#uses=1] |
| 43 | %0 = extractvalue %pair %subject19, 1 ; <double> [#uses=2] |
| 44 | %1 = select i1 undef, double %0, double undef ; <double> [#uses=1] |
| 45 | %2 = select i1 undef, double %1, double %0 ; <double> [#uses=1] |
| 46 | %3 = insertvalue %pair undef, double %2, 1 ; <%1> [#uses=1] |
| 47 | store %pair %3, %pair* undef |
| 48 | ret void |
| 49 | } |
Chris Lattner | da0688e | 2010-03-14 18:44:35 +0000 | [diff] [blame] | 50 | |
| 51 | ; PR6605 |
| 52 | define i64 @test4(i8* %P) nounwind ssp { |
| 53 | entry: |
| 54 | %tmp1 = load i8* %P ; <i8> [#uses=3] |
| 55 | %tobool = icmp eq i8 %tmp1, 0 ; <i1> [#uses=1] |
| 56 | %tmp58 = sext i1 %tobool to i8 ; <i8> [#uses=1] |
| 57 | %mul.i = and i8 %tmp58, %tmp1 ; <i8> [#uses=1] |
| 58 | %conv6 = zext i8 %mul.i to i32 ; <i32> [#uses=1] |
| 59 | %cmp = icmp ne i8 %tmp1, 1 ; <i1> [#uses=1] |
| 60 | %conv11 = zext i1 %cmp to i32 ; <i32> [#uses=1] |
| 61 | %call12 = tail call i32 @safe(i32 %conv11) nounwind ; <i32> [#uses=1] |
| 62 | %and = and i32 %conv6, %call12 ; <i32> [#uses=1] |
| 63 | %tobool13 = icmp eq i32 %and, 0 ; <i1> [#uses=1] |
| 64 | br i1 %tobool13, label %if.else, label %return |
| 65 | |
| 66 | if.else: ; preds = %entry |
| 67 | br label %return |
| 68 | |
| 69 | return: ; preds = %if.else, %entry |
| 70 | ret i64 undef |
| 71 | } |
| 72 | |
| 73 | declare i32 @safe(i32) |