• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instsimplify -S | FileCheck %s
3
4define i1 @test1(i1 %a) {
5; CHECK-LABEL: @test1(
6; CHECK-NEXT:    ret i1 true
7;
8  %b = xor i1 %a, true
9  %res = sub i1 %a, %b
10  ret i1 %res
11}
12
13define <2 x i1> @test2(<2 x i1> %a) {
14; CHECK-LABEL: @test2(
15; CHECK-NEXT:    ret <2 x i1> <i1 true, i1 true>
16;
17  %b = xor <2 x i1> %a, <i1 true, i1 true>
18  %res = sub <2 x i1> %a, %b
19  ret <2 x i1> %res
20}
21
22define i1 @test5(i1 %a) {
23; CHECK-LABEL: @test5(
24; CHECK-NEXT:    ret i1 false
25;
26  %res = add i1 %a, %a
27  ret i1 %res
28}
29
30define <2 x i1> @test6(<2 x i1> %a) {
31; CHECK-LABEL: @test6(
32; CHECK-NEXT:    ret <2 x i1> zeroinitializer
33;
34  %res = add <2 x i1> %a, %a
35  ret <2 x i1> %res
36}
37
38define i1 @test7(i1 %a) {
39; CHECK-LABEL: @test7(
40; CHECK-NEXT:    ret i1 [[A:%.*]]
41;
42  %c = xor i1 %a, true
43  %res = add i1 %c, true
44  ret i1 %res
45}
46
47; TODO: simplify this to %a
48define i1 @test8(i1 %a) {
49; CHECK-LABEL: @test8(
50; CHECK-NEXT:    [[C:%.*]] = add i1 [[A:%.*]], true
51; CHECK-NEXT:    [[RES:%.*]] = xor i1 [[C]], true
52; CHECK-NEXT:    ret i1 [[RES]]
53;
54  %c = add i1 %a, true
55  %res = xor i1 %c, true
56  ret i1 %res
57}
58
59define i1 @test9(i1 %a) {
60; CHECK-LABEL: @test9(
61; CHECK-NEXT:    ret i1 [[A:%.*]]
62;
63  %c = xor i1 %a, true
64  %res = sub i1 %c, true
65  ret i1 %res
66}
67
68; TODO: simplify this to %a
69define i1 @test10(i1 %a) {
70; CHECK-LABEL: @test10(
71; CHECK-NEXT:    [[C:%.*]] = sub i1 [[A:%.*]], true
72; CHECK-NEXT:    [[RES:%.*]] = xor i1 [[C]], true
73; CHECK-NEXT:    ret i1 [[RES]]
74;
75  %c = sub i1 %a, true
76  %res = xor i1 %c, true
77  ret i1 %res
78}
79