1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
11 ; CHECK-NEXT: [[DIV_NEG:%.*]] = ashr exact i8 [[X:%.*]], 5
12 ; CHECK-NEXT: [[DIV:%.*]] = sub nsw i8 0, [[DIV_NEG]]
13 ; CHECK-NEXT: ret i8 [[DIV]]
15 %div = sdiv exact i8 %x, -32
18 define i8 @n1(i8 %x) {
20 ; CHECK-NEXT: [[DIV:%.*]] = sdiv i8 [[X:%.*]], -32
21 ; CHECK-NEXT: ret i8 [[DIV]]
23 %div = sdiv i8 %x, -32 ; not exact
27 define <2 x i8> @t2_vec_splat(<2 x i8> %x) {
28 ; CHECK-LABEL: @t2_vec_splat(
29 ; CHECK-NEXT: [[DIV_NEG:%.*]] = ashr exact <2 x i8> [[X:%.*]], <i8 5, i8 5>
30 ; CHECK-NEXT: [[DIV:%.*]] = sub nsw <2 x i8> zeroinitializer, [[DIV_NEG]]
31 ; CHECK-NEXT: ret <2 x i8> [[DIV]]
33 %div = sdiv exact <2 x i8> %x, <i8 -32, i8 -32>
37 define <2 x i8> @t3_vec(<2 x i8> %x) {
38 ; CHECK-LABEL: @t3_vec(
39 ; CHECK-NEXT: [[DIV_NEG:%.*]] = ashr exact <2 x i8> [[X:%.*]], <i8 5, i8 4>
40 ; CHECK-NEXT: [[DIV:%.*]] = sub <2 x i8> zeroinitializer, [[DIV_NEG]]
41 ; CHECK-NEXT: ret <2 x i8> [[DIV]]
43 %div = sdiv exact <2 x i8> %x, <i8 -32, i8 -16>
47 define <2 x i8> @n4_vec_mixed(<2 x i8> %x) {
48 ; CHECK-LABEL: @n4_vec_mixed(
49 ; CHECK-NEXT: [[DIV:%.*]] = sdiv exact <2 x i8> [[X:%.*]], <i8 -32, i8 16>
50 ; CHECK-NEXT: ret <2 x i8> [[DIV]]
52 %div = sdiv exact <2 x i8> %x, <i8 -32, i8 16>
56 define <2 x i8> @n4_vec_undef(<2 x i8> %x) {
57 ; CHECK-LABEL: @n4_vec_undef(
58 ; CHECK-NEXT: ret <2 x i8> poison
60 %div = sdiv exact <2 x i8> %x, <i8 -32, i8 undef>