1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt %s -instcombine -S | FileCheck %s
7 ; @llvm.umul.with.overflow(%x, %y) + extractvalue + not
9 define i1 @t0_basic(i8 %x, i8 %y) {
10 ; CHECK-LABEL: @t0_basic(
11 ; CHECK-NEXT: [[T0:%.*]] = udiv i8 -1, [[X:%.*]]
12 ; CHECK-NEXT: [[R:%.*]] = icmp uge i8 [[T0]], [[Y:%.*]]
13 ; CHECK-NEXT: ret i1 [[R]]
16 %r = icmp uge i8 %t0, %y
20 define <2 x i1> @t1_vec(<2 x i8> %x, <2 x i8> %y) {
21 ; CHECK-LABEL: @t1_vec(
22 ; CHECK-NEXT: [[T0:%.*]] = udiv <2 x i8> <i8 -1, i8 -1>, [[X:%.*]]
23 ; CHECK-NEXT: [[R:%.*]] = icmp uge <2 x i8> [[T0]], [[Y:%.*]]
24 ; CHECK-NEXT: ret <2 x i1> [[R]]
26 %t0 = udiv <2 x i8> <i8 -1, i8 -1>, %x
27 %r = icmp uge <2 x i8> %t0, %y
31 define <3 x i1> @t2_vec_undef(<3 x i8> %x, <3 x i8> %y) {
32 ; CHECK-LABEL: @t2_vec_undef(
33 ; CHECK-NEXT: [[T0:%.*]] = udiv <3 x i8> <i8 -1, i8 undef, i8 -1>, [[X:%.*]]
34 ; CHECK-NEXT: [[R:%.*]] = icmp uge <3 x i8> [[T0]], [[Y:%.*]]
35 ; CHECK-NEXT: ret <3 x i1> [[R]]
37 %t0 = udiv <3 x i8> <i8 -1, i8 undef, i8 -1>, %x
38 %r = icmp uge <3 x i8> %t0, %y
44 define i1 @t3_commutative(i8 %x) {
45 ; CHECK-LABEL: @t3_commutative(
46 ; CHECK-NEXT: [[T0:%.*]] = udiv i8 -1, [[X:%.*]]
47 ; CHECK-NEXT: [[Y:%.*]] = call i8 @gen8()
48 ; CHECK-NEXT: [[R:%.*]] = icmp ule i8 [[Y]], [[T0]]
49 ; CHECK-NEXT: ret i1 [[R]]
53 %r = icmp ule i8 %y, %t0 ; swapped
59 declare void @use8(i8)
61 define i1 @n4_extrause(i8 %x, i8 %y) {
62 ; CHECK-LABEL: @n4_extrause(
63 ; CHECK-NEXT: [[T0:%.*]] = udiv i8 -1, [[X:%.*]]
64 ; CHECK-NEXT: call void @use8(i8 [[T0]])
65 ; CHECK-NEXT: [[R:%.*]] = icmp uge i8 [[T0]], [[Y:%.*]]
66 ; CHECK-NEXT: ret i1 [[R]]
69 call void @use8(i8 %t0)
70 %r = icmp uge i8 %t0, %y
74 define i1 @n5_not_negone(i8 %x, i8 %y) {
75 ; CHECK-LABEL: @n5_not_negone(
76 ; CHECK-NEXT: [[T0:%.*]] = udiv i8 -2, [[X:%.*]]
77 ; CHECK-NEXT: [[R:%.*]] = icmp uge i8 [[T0]], [[Y:%.*]]
78 ; CHECK-NEXT: ret i1 [[R]]
80 %t0 = udiv i8 -2, %x ; not -1
81 %r = icmp uge i8 %t0, %y
85 define i1 @n6_wrong_pred0(i8 %x, i8 %y) {
86 ; CHECK-LABEL: @n6_wrong_pred0(
87 ; CHECK-NEXT: [[T0:%.*]] = udiv i8 -1, [[X:%.*]]
88 ; CHECK-NEXT: [[R:%.*]] = icmp ule i8 [[T0]], [[Y:%.*]]
89 ; CHECK-NEXT: ret i1 [[R]]
92 %r = icmp ule i8 %t0, %y ; not uge
96 define i1 @n6_wrong_pred1(i8 %x, i8 %y) {
97 ; CHECK-LABEL: @n6_wrong_pred1(
98 ; CHECK-NEXT: [[T0:%.*]] = udiv i8 -1, [[X:%.*]]
99 ; CHECK-NEXT: [[R:%.*]] = icmp ugt i8 [[T0]], [[Y:%.*]]
100 ; CHECK-NEXT: ret i1 [[R]]
103 %r = icmp ugt i8 %t0, %y ; not uge