• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -instsimplify -S < %s | FileCheck %s
3
4define i1 @test(i8 %p, i8* %pq) {
5; CHECK-LABEL: @test(
6; CHECK-NEXT:    ret i1 false
7;
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
13  ret i1 %x
14}
15
16!0 = !{ i8 1, i8 5 }
17
18define 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
27define <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
30;
31  %B = shl <2 x i33> %A, <i33 5, i33 5>
32  %C = shl <2 x i33> %B, <i33 28, i33 28>
33  ret <2 x i33> %C
34}
35
36; FIXME
37
38define <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]]
43;
44  %B = shl <2 x i33> %A, <i33 6, i33 5>
45  %C = shl <2 x i33> %B, <i33 27, i33 28>
46  ret <2 x i33> %C
47}
48
49define i232 @lshr_lshr(i232 %A) {
50; CHECK-LABEL: @lshr_lshr(
51; CHECK-NEXT:    ret i232 0
52;
53  %B = lshr i232 %A, 231
54  %C = lshr i232 %B, 1
55  ret i232 %C
56}
57
58define <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
61;
62  %B = lshr <2 x i32> %A, <i32 28, i32 28>
63  %C = lshr <2 x i32> %B, <i32 4, i32 4>
64  ret <2 x i32> %C
65}
66
67define <2 x i32> @lshr_lshr_vec(<2 x i32> %A) {
68; CHECK-LABEL: @lshr_lshr_vec(
69; CHECK-NEXT:    ret <2 x i32> zeroinitializer
70;
71  %B = lshr <2 x i32> %A, <i32 29, i32 28>
72  %C = lshr <2 x i32> %B, <i32 4, i32 5>
73  ret <2 x i32> %C
74}
75
76