; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
define i1 @cmp_x_and_negp2_with_eq(i8 %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_eq(
; CHECK-NEXT: [[ANDX:%.*]] = and i8 [[X:%.*]], -2
; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[ANDX]], -128
; CHECK-NEXT: ret i1 [[R]]
;
%andx = and i8 %x, -2
%r = icmp eq i8 %andx, 128
ret i1 %r
}
define i1 @cmp_x_and_negp2_with_eq_fail_not_signmask(i8 %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_eq_fail_not_signmask(
; CHECK-NEXT: [[ANDX:%.*]] = and i8 [[X:%.*]], -2
; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[ANDX]], -124
; CHECK-NEXT: ret i1 [[R]]
;
%andx = and i8 %x, -2
%r = icmp eq i8 %andx, 132
ret i1 %r
}
define <2 x i1> @cmp_x_and_negp2_with_ne(<2 x i8> %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_ne(
; CHECK-NEXT: [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 -8, i8 -16>
; CHECK-NEXT: [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], <i8 -128, i8 -128>
; CHECK-NEXT: ret <2 x i1> [[R]]
;
%andx = and <2 x i8> %x, <i8 -8, i8 -16>
%r = icmp ne <2 x i8> %andx, <i8 128, i8 128>
ret <2 x i1> %r
}
define <2 x i1> @cmp_x_and_negp2_with_ne_or_z(<2 x i8> %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_ne_or_z(
; CHECK-NEXT: [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 0, i8 -16>
; CHECK-NEXT: [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], <i8 -128, i8 -128>
; CHECK-NEXT: ret <2 x i1> [[R]]
;
%andx = and <2 x i8> %x, <i8 0, i8 -16>
%r = icmp ne <2 x i8> %andx, <i8 128, i8 128>
ret <2 x i1> %r
}
define <2 x i1> @cmp_x_and_negp2_with_ne_fail_not_p2(<2 x i8> %x) {
; CHECK-LABEL: @cmp_x_and_negp2_with_ne_fail_not_p2(
; CHECK-NEXT: [[ANDX:%.*]] = and <2 x i8> [[X:%.*]], <i8 -8, i8 -15>
; CHECK-NEXT: [[R:%.*]] = icmp ne <2 x i8> [[ANDX]], <i8 -128, i8 -128>
; CHECK-NEXT: ret <2 x i1> [[R]]
;
%andx = and <2 x i8> %x, <i8 -8, i8 -15>
%r = icmp ne <2 x i8> %andx, <i8 128, i8 128>
ret <2 x i1> %r
}