Sanjay Patel | e104a5f | 2016-09-16 17:54:52 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
James Molloy | b6be1eb | 2015-09-24 16:06:32 +0000 | [diff] [blame] | 2 | ; RUN: opt -instsimplify -S < %s | FileCheck %s |
| 3 | |
James Molloy | b6be1eb | 2015-09-24 16:06:32 +0000 | [diff] [blame] | 4 | define i1 @test(i8 %p, i8* %pq) { |
Sanjay Patel | e104a5f | 2016-09-16 17:54:52 +0000 | [diff] [blame] | 5 | ; CHECK-LABEL: @test( |
| 6 | ; CHECK-NEXT: ret i1 false |
| 7 | ; |
James Molloy | b6be1eb | 2015-09-24 16:06:32 +0000 | [diff] [blame] | 8 | %q = load i8, i8* %pq, !range !0 ; %q is known nonzero; no known bits |
| 9 | %1 = or i8 %p, 2 ; %1[1] = 1 |
| 10 | %2 = and i8 %1, 254 ; %2[0] = 0, %2[1] = 1 |
| 11 | %A = lshr i8 %2, 1 ; We should know that %A is nonzero. |
| 12 | %x = icmp eq i8 %A, 0 |
James Molloy | b6be1eb | 2015-09-24 16:06:32 +0000 | [diff] [blame] | 13 | ret i1 %x |
| 14 | } |
| 15 | |
| 16 | !0 = !{ i8 1, i8 5 } |
Sanjay Patel | dc2917b | 2016-11-27 15:54:45 +0000 | [diff] [blame^] | 17 | |
| 18 | define i32 @shl_shl(i32 %A) { |
| 19 | ; CHECK-LABEL: @shl_shl( |
| 20 | ; CHECK-NEXT: ret i32 0 |
| 21 | ; |
| 22 | %B = shl i32 %A, 6 |
| 23 | %C = shl i32 %B, 28 |
| 24 | ret i32 %C |
| 25 | } |
| 26 | |
| 27 | ; FIXME |
| 28 | |
| 29 | define <2 x i33> @shl_shl_splat_vec(<2 x i33> %A) { |
| 30 | ; CHECK-LABEL: @shl_shl_splat_vec( |
| 31 | ; CHECK-NEXT: [[B:%.*]] = shl <2 x i33> %A, <i33 5, i33 5> |
| 32 | ; CHECK-NEXT: [[C:%.*]] = shl <2 x i33> [[B]], <i33 28, i33 28> |
| 33 | ; CHECK-NEXT: ret <2 x i33> [[C]] |
| 34 | ; |
| 35 | %B = shl <2 x i33> %A, <i33 5, i33 5> |
| 36 | %C = shl <2 x i33> %B, <i33 28, i33 28> |
| 37 | ret <2 x i33> %C |
| 38 | } |
| 39 | |
| 40 | ; FIXME |
| 41 | |
| 42 | define <2 x i33> @shl_shl_vec(<2 x i33> %A) { |
| 43 | ; CHECK-LABEL: @shl_shl_vec( |
| 44 | ; CHECK-NEXT: [[B:%.*]] = shl <2 x i33> %A, <i33 6, i33 5> |
| 45 | ; CHECK-NEXT: [[C:%.*]] = shl <2 x i33> [[B]], <i33 27, i33 28> |
| 46 | ; CHECK-NEXT: ret <2 x i33> [[C]] |
| 47 | ; |
| 48 | %B = shl <2 x i33> %A, <i33 6, i33 5> |
| 49 | %C = shl <2 x i33> %B, <i33 27, i33 28> |
| 50 | ret <2 x i33> %C |
| 51 | } |
| 52 | |
| 53 | define i232 @lshr_lshr(i232 %A) { |
| 54 | ; CHECK-LABEL: @lshr_lshr( |
| 55 | ; CHECK-NEXT: ret i232 0 |
| 56 | ; |
| 57 | %B = lshr i232 %A, 231 |
| 58 | %C = lshr i232 %B, 1 |
| 59 | ret i232 %C |
| 60 | } |
| 61 | |
| 62 | ; FIXME |
| 63 | |
| 64 | define <2 x i32> @lshr_lshr_splat_vec(<2 x i32> %A) { |
| 65 | ; CHECK-LABEL: @lshr_lshr_splat_vec( |
| 66 | ; CHECK-NEXT: [[B:%.*]] = lshr <2 x i32> %A, <i32 28, i32 28> |
| 67 | ; CHECK-NEXT: [[C:%.*]] = lshr <2 x i32> [[B]], <i32 4, i32 4> |
| 68 | ; CHECK-NEXT: ret <2 x i32> [[C]] |
| 69 | ; |
| 70 | %B = lshr <2 x i32> %A, <i32 28, i32 28> |
| 71 | %C = lshr <2 x i32> %B, <i32 4, i32 4> |
| 72 | ret <2 x i32> %C |
| 73 | } |
| 74 | |
| 75 | ; FIXME |
| 76 | |
| 77 | define <2 x i32> @lshr_lshr_vec(<2 x i32> %A) { |
| 78 | ; CHECK-LABEL: @lshr_lshr_vec( |
| 79 | ; CHECK-NEXT: [[B:%.*]] = lshr <2 x i32> %A, <i32 29, i32 28> |
| 80 | ; CHECK-NEXT: [[C:%.*]] = lshr <2 x i32> [[B]], <i32 4, i32 5> |
| 81 | ; CHECK-NEXT: ret <2 x i32> [[C]] |
| 82 | ; |
| 83 | %B = lshr <2 x i32> %A, <i32 29, i32 28> |
| 84 | %C = lshr <2 x i32> %B, <i32 4, i32 5> |
| 85 | ret <2 x i32> %C |
| 86 | } |
| 87 | |