1; RUN: opt -lint -disable-output %s 2>&1 | FileCheck %s
2
3define <2 x i32> @use_vector_sdiv(<2 x i32> %a) nounwind {
4  %b = sdiv <2 x i32> %a, <i32 5, i32 8>
5  ret <2 x i32> %b
6}
7
8define <2 x i32> @use_vector_srem(<2 x i32> %a) nounwind {
9  %b = srem <2 x i32> %a, <i32 5, i32 8>
10  ret <2 x i32> %b
11}
12
13define <2 x i32> @use_vector_udiv(<2 x i32> %a) nounwind {
14  %b = udiv <2 x i32> %a, <i32 5, i32 8>
15  ret <2 x i32> %b
16}
17
18define <2 x i32> @use_vector_urem(<2 x i32> %a) nounwind {
19  %b = urem <2 x i32> %a, <i32 5, i32 8>
20  ret <2 x i32> %b
21}
22
23define i32 @use_sdiv_by_zero(i32 %a) nounwind {
24; CHECK: Undefined behavior: Division by zero
25; CHECK-NEXT: %b = sdiv i32 %a, 0
26  %b = sdiv i32 %a, 0
27  ret i32 %b
28}
29
30define i32 @use_sdiv_by_zeroinitializer(i32 %a) nounwind {
31; CHECK: Undefined behavior: Division by zero
32; CHECK-NEXT: %b = sdiv i32 %a, 0
33  %b = sdiv i32 %a, zeroinitializer
34   ret i32 %b
35}
36
37define <2 x i32> @use_vector_sdiv_by_zero_x(<2 x i32> %a) nounwind {
38; CHECK: Undefined behavior: Division by zero
39; CHECK-NEXT: %b = sdiv <2 x i32> %a, <i32 0, i32 5>
40  %b = sdiv <2 x i32> %a, <i32 0, i32 5>
41  ret <2 x i32> %b
42}
43
44define <2 x i32> @use_vector_sdiv_by_zero_y(<2 x i32> %a) nounwind {
45; CHECK: Undefined behavior: Division by zero
46; CHECK-NEXT:  %b = sdiv <2 x i32> %a, <i32 4, i32 0>
47  %b = sdiv <2 x i32> %a, <i32 4, i32 0>
48  ret <2 x i32> %b
49}
50
51define <2 x i32> @use_vector_sdiv_by_zero_xy(<2 x i32> %a) nounwind {
52; CHECK: Undefined behavior: Division by zero
53; CHECK-NEXT: %b = sdiv <2 x i32> %a, zeroinitializer
54  %b = sdiv <2 x i32> %a, <i32 0, i32 0>
55  ret <2 x i32> %b
56}
57
58define <2 x i32> @use_vector_sdiv_by_undef_x(<2 x i32> %a) nounwind {
59; CHECK: Undefined behavior: Division by zero
60; CHECK-NEXT: %b = sdiv <2 x i32> %a, <i32 undef, i32 5>
61  %b = sdiv <2 x i32> %a, <i32 undef, i32 5>
62  ret <2 x i32> %b
63}
64
65define <2 x i32> @use_vector_sdiv_by_undef_y(<2 x i32> %a) nounwind {
66; CHECK: Undefined behavior: Division by zero
67; CHECK-NEXT: %b = sdiv <2 x i32> %a, <i32 5, i32 undef>
68  %b = sdiv <2 x i32> %a, <i32 5, i32 undef>
69  ret <2 x i32> %b
70}
71
72define <2 x i32> @use_vector_sdiv_by_undef_xy(<2 x i32> %a) nounwind {
73; CHECK: Undefined behavior: Division by zero
74; CHECK-NEXT: %b = sdiv <2 x i32> %a, undef
75  %b = sdiv <2 x i32> %a, <i32 undef, i32 undef>
76  ret <2 x i32> %b
77}
78
79