1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -instsimplify -S < %s | FileCheck %s
4 define i1 @test(i8 %p, i8* %pq) {
6 ; CHECK-NEXT: ret i1 false
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.
18 define i32 @shl_shl(i32 %A) {
19 ; CHECK-LABEL: @shl_shl(
20 ; CHECK-NEXT: ret i32 0
27 define <2 x i33> @shl_shl_splat_vec(<2 x i33> %A) {
28 ; CHECK-LABEL: @shl_shl_splat_vec(
29 ; CHECK-NEXT: ret <2 x i33> zeroinitializer
31 %B = shl <2 x i33> %A, <i33 5, i33 5>
32 %C = shl <2 x i33> %B, <i33 28, i33 28>
38 define <2 x i33> @shl_shl_vec(<2 x i33> %A) {
39 ; CHECK-LABEL: @shl_shl_vec(
40 ; CHECK-NEXT: [[B:%.*]] = shl <2 x i33> %A, <i33 6, i33 5>
41 ; CHECK-NEXT: [[C:%.*]] = shl <2 x i33> [[B]], <i33 27, i33 28>
42 ; CHECK-NEXT: ret <2 x i33> [[C]]
44 %B = shl <2 x i33> %A, <i33 6, i33 5>
45 %C = shl <2 x i33> %B, <i33 27, i33 28>
49 define i232 @lshr_lshr(i232 %A) {
50 ; CHECK-LABEL: @lshr_lshr(
51 ; CHECK-NEXT: ret i232 0
53 %B = lshr i232 %A, 231
58 define <2 x i32> @lshr_lshr_splat_vec(<2 x i32> %A) {
59 ; CHECK-LABEL: @lshr_lshr_splat_vec(
60 ; CHECK-NEXT: ret <2 x i32> zeroinitializer
62 %B = lshr <2 x i32> %A, <i32 28, i32 28>
63 %C = lshr <2 x i32> %B, <i32 4, i32 4>
67 define <2 x i32> @lshr_lshr_vec(<2 x i32> %A) {
68 ; CHECK-LABEL: @lshr_lshr_vec(
69 ; CHECK-NEXT: ret <2 x i32> zeroinitializer
71 %B = lshr <2 x i32> %A, <i32 29, i32 28>
72 %C = lshr <2 x i32> %B, <i32 4, i32 5>