1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 declare void @use.i8(i8)
5 define i1 @sdiv_exact_eq_0(i8 %x, i8 %y) {
6 ; CHECK-LABEL: @sdiv_exact_eq_0(
7 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[X:%.*]], 0
8 ; CHECK-NEXT: ret i1 [[R]]
10 %d = sdiv exact i8 %x, %y
15 define i1 @udiv_exact_ne_0(i8 %x, i8 %y) {
16 ; CHECK-LABEL: @udiv_exact_ne_0(
17 ; CHECK-NEXT: [[R:%.*]] = icmp ne i8 [[X:%.*]], 0
18 ; CHECK-NEXT: ret i1 [[R]]
20 %d = udiv exact i8 %x, %y
25 define i1 @sdiv_exact_ne_1(i8 %x, i8 %y) {
26 ; CHECK-LABEL: @sdiv_exact_ne_1(
27 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[X:%.*]], 0
28 ; CHECK-NEXT: ret i1 [[R]]
30 %d = sdiv exact i8 %x, %y
35 define i1 @udiv_exact_eq_1(i8 %x, i8 %y) {
36 ; CHECK-LABEL: @udiv_exact_eq_1(
37 ; CHECK-NEXT: [[R:%.*]] = icmp ne i8 [[X:%.*]], [[Y:%.*]]
38 ; CHECK-NEXT: ret i1 [[R]]
40 %d = udiv exact i8 %x, %y
45 define i1 @sdiv_exact_eq_9_no_of(i8 %x, i8 %y) {
46 ; CHECK-LABEL: @sdiv_exact_eq_9_no_of(
47 ; CHECK-NEXT: [[YY:%.*]] = and i8 [[Y:%.*]], 7
48 ; CHECK-NEXT: [[TMP1:%.*]] = mul nuw nsw i8 [[YY]], 9
49 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[TMP1]], [[X:%.*]]
50 ; CHECK-NEXT: ret i1 [[R]]
53 %d = sdiv exact i8 %x, %yy
58 define i1 @sdiv_exact_eq_9_may_of(i8 %x, i8 %y) {
59 ; CHECK-LABEL: @sdiv_exact_eq_9_may_of(
60 ; CHECK-NEXT: [[D:%.*]] = sdiv exact i8 [[X:%.*]], [[Y:%.*]]
61 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[D]], 9
62 ; CHECK-NEXT: ret i1 [[R]]
64 %d = sdiv exact i8 %x, %y
69 define i1 @sdiv_exact_eq_9_no_of_fail_multiuse(i8 %x, i8 %y) {
70 ; CHECK-LABEL: @sdiv_exact_eq_9_no_of_fail_multiuse(
71 ; CHECK-NEXT: [[YY:%.*]] = and i8 [[Y:%.*]], 7
72 ; CHECK-NEXT: [[D:%.*]] = sdiv exact i8 [[X:%.*]], [[YY]]
73 ; CHECK-NEXT: call void @use.i8(i8 [[D]])
74 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[D]], 9
75 ; CHECK-NEXT: ret i1 [[R]]
78 %d = sdiv exact i8 %x, %yy
79 call void @use.i8(i8 %d)
84 define i1 @sdiv_exact_eq_9_must_of_todo_is_false(i8 %x, i8 %y) {
85 ; CHECK-LABEL: @sdiv_exact_eq_9_must_of_todo_is_false(
86 ; CHECK-NEXT: [[YY:%.*]] = or i8 [[Y:%.*]], 55
87 ; CHECK-NEXT: [[D:%.*]] = sdiv exact i8 [[X:%.*]], [[YY]]
88 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[D]], 9
89 ; CHECK-NEXT: ret i1 [[R]]
92 %d = sdiv exact i8 %x, %yy
97 define i1 @udiv_exact_ne_30_no_of(i8 %x, i8 %y) {
98 ; CHECK-LABEL: @udiv_exact_ne_30_no_of(
99 ; CHECK-NEXT: [[YY:%.*]] = and i8 [[Y:%.*]], 7
100 ; CHECK-NEXT: [[TMP1:%.*]] = mul nuw i8 [[YY]], 30
101 ; CHECK-NEXT: [[R:%.*]] = icmp ne i8 [[TMP1]], [[X:%.*]]
102 ; CHECK-NEXT: ret i1 [[R]]
105 %d = udiv exact i8 %x, %yy
106 %r = icmp ne i8 %d, 30