1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 define i1 @cmp_x_and_negp2_with_eq(i8 %x) {
5 ; CHECK-LABEL: @cmp_x_and_negp2_with_eq(
6 ; CHECK-NEXT: [[R:%.*]] = icmp slt i8 [[X:%.*]], -126
7 ; CHECK-NEXT: ret i1 [[R]]
10 %r = icmp eq i8 %andx, 128
14 define i1 @cmp_x_and_negp2_with_eq_fail_not_signmask(i8 %x) {
15 ; CHECK-LABEL: @cmp_x_and_negp2_with_eq_fail_not_signmask(
16 ; CHECK-NEXT: [[ANDX:%.*]] = and i8 [[X:%.*]], -2
17 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[ANDX]], -124
18 ; CHECK-NEXT: ret i1 [[R]]
21 %r = icmp eq i8 %andx, 132
25 define <2 x i1> @cmp_x_and_negp2_with_ne(<2 x i8> %x) {
26 ; CHECK-LABEL: @cmp_x_and_negp2_with_ne(
27 ; CHECK-NEXT: [[R:%.*]] = icmp sgt <2 x i8> [[X:%.*]], <i8 -121, i8 -113>
28 ; CHECK-NEXT: ret <2 x i1> [[R]]
30 %andx = and <2 x i8> %x, <i8 -8, i8 -16>
31 %r = icmp ne <2 x i8> %andx, <i8 128, i8 128>
35 define <2 x i1> @cmp_x_and_negp2_with_ne_or_z(<2 x i8> %x) {
36 ; CHECK-LABEL: @cmp_x_and_negp2_with_ne_or_z(
37 ; CHECK-NEXT: [[R:%.*]] = icmp sge <2 x i8> [[X:%.*]], <i8 -128, i8 -112>
38 ; CHECK-NEXT: ret <2 x i1> [[R]]
40 %andx = and <2 x i8> %x, <i8 0, i8 -16>
41 %r = icmp ne <2 x i8> %andx, <i8 128, i8 128>
45 define <2 x i1> @cmp_x_and_negp2_with_ne_fail_not_p2(<2 x i8> %x) {
46 ; CHECK-LABEL: @cmp_x_and_negp2_with_ne_fail_not_p2(
47 ; CHECK-NEXT: [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 -8, i8 -15>
48 ; CHECK-NEXT: [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], splat (i8 -128)
49 ; CHECK-NEXT: ret <2 x i1> [[R]]
51 %andx = and <2 x i8> %x, <i8 -8, i8 -15>
52 %r = icmp ne <2 x i8> %andx, <i8 128, i8 128>