mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
b23e310c99
This is a patch that disables the poison-unsafe select -> and/or i1 folding. It has been blocking D72396 and also has been the source of a few miscompilations described in llvm.org/pr49688 . D99674 conditionally blocked this folding and successfully fixed the latter one. The former one was still blocked, and this patch addresses it. Note that a few test functions that has `_logical` suffix are now deoptimized. These are created by @nikic to check the impact of disabling this optimization by copying existing original functions and replacing and/or with select. I can see that most of these are poison-unsafe; they can be revived by introducing freeze instruction. I left comments at fcmp + select optimizations (or-fcmp.ll, and-fcmp.ll) because I think they are good targets for freeze fix. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D101191
2151 lines
55 KiB
LLVM
2151 lines
55 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
; There are 12 basic patterns (or 6 with DeMorganized equivalent) with
|
|
; 2 (commute logic op) *
|
|
; 2 (swap compare operands) *
|
|
; 2 (signed/unsigned)
|
|
; variations for a total of 96 tests.
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X == MAX) && (X < Y) --> false
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @slt_and_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_and_max(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_and_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_and_max_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define <2 x i1> @slt_and_max_commute(<2 x i8> %x, <2 x i8> %y) {
|
|
; CHECK-LABEL: @slt_and_max_commute(
|
|
; CHECK-NEXT: ret <2 x i1> zeroinitializer
|
|
;
|
|
%cmp = icmp slt <2 x i8> %x, %y
|
|
%cmpeq = icmp eq <2 x i8> %x, <i8 127, i8 127>
|
|
%r = and <2 x i1> %cmpeq, %cmp
|
|
ret <2 x i1> %r
|
|
}
|
|
|
|
define i1 @slt_swap_and_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_and_max(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_and_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_and_max_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_and_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_and_max_commute(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_and_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_and_max_commute_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_and_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_and_max(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_and_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_and_max_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_and_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_and_max_commute(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_and_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_and_max_commute_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_and_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_and_max(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_and_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_and_max_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_and_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_and_max_commute(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_and_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_and_max_commute_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X == MIN) && (X > Y) --> false
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @sgt_and_min(i9 %x, i9 %y) {
|
|
; CHECK-LABEL: @sgt_and_min(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp sgt i9 %x, %y
|
|
%cmpeq = icmp eq i9 %x, 256
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_and_min_logical(i9 %x, i9 %y) {
|
|
; CHECK-LABEL: @sgt_and_min_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp sgt i9 %x, %y
|
|
%cmpeq = icmp eq i9 %x, 256
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_and_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_and_min_commute(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_and_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_and_min_commute_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_and_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_and_min(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_and_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_and_min_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_and_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_and_min_commute(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_and_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_and_min_commute_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_and_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_and_min(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_and_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_and_min_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_and_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_and_min_commute(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_and_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_and_min_commute_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_and_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_and_min(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_and_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_and_min_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_and_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_and_min_commute(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_and_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_and_min_commute_logical(
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X != MAX) || (X >= Y) --> true
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @sge_or_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_or_not_max(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_or_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_or_not_max_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_or_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_or_not_max_commute(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_or_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_or_not_max_commute_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_or_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_or_not_max(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_or_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_or_not_max_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_or_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_or_not_max_commute(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_or_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_or_not_max_commute_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_or_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_or_not_max(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_or_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_or_not_max_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_or_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_or_not_max_commute(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_or_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_or_not_max_commute_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_or_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_or_not_max(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_or_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_or_not_max_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_or_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_or_not_max_commute(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_or_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_or_not_max_commute_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X != MIN) || (X <= Y) --> true
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @sle_or_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_or_not_min(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_or_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_or_not_min_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_or_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_or_not_min_commute(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_or_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_or_not_min_commute_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_or_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_or_not_min(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_or_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_or_not_min_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_or_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_or_not_min_commute(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_or_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_or_not_min_commute_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_or_not_min(i427 %x, i427 %y) {
|
|
; CHECK-LABEL: @ule_or_not_min(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp ule i427 %x, %y
|
|
%cmpeq = icmp ne i427 %x, 0
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_or_not_min_logical(i427 %x, i427 %y) {
|
|
; CHECK-LABEL: @ule_or_not_min_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp ule i427 %x, %y
|
|
%cmpeq = icmp ne i427 %x, 0
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_or_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_or_not_min_commute(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_or_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_or_not_min_commute_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_or_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_or_not_min(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_or_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_or_not_min_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_or_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_or_not_min_commute(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_or_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_or_not_min_commute_logical(
|
|
; CHECK-NEXT: ret i1 true
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X == MAX) && (X >= Y) --> X == MAX
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @sge_and_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_and_max(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_and_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_and_max_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_and_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_and_max_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_and_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_and_max_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_and_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_and_max(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_and_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_and_max_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_and_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_and_max_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_and_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_and_max_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_and_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_and_max(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_and_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_and_max_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_and_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_and_max_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_and_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_and_max_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_and_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_and_max(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_and_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_and_max_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_and_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_and_max_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_and_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_and_max_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X == MIN) && (X <= Y) --> X == MIN
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @sle_and_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_and_min(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_and_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_and_min_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_and_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_and_min_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_and_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_and_min_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_and_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_and_min(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_and_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_and_min_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_and_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_and_min_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_and_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_and_min_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_and_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_and_min(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_and_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_and_min_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_and_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_and_min_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_and_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_and_min_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_and_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_and_min(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_and_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_and_min_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_and_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_and_min_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_and_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_and_min_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X == MAX) || (X >= Y) --> X >= Y
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @sge_or_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_or_max(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_or_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_or_max_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_or_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_or_max_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_or_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_or_max_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X]], 127
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]]
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp sge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_or_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_or_max(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_or_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_or_max_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_or_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_or_max_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sge_swap_or_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sge_swap_or_max_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X]], 127
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]]
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp sle i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_or_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_or_max(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_or_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_or_max_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_or_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_or_max_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_or_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_or_max_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X]], -1
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]]
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp uge i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_or_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_or_max(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_or_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_or_max_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_or_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_or_max_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @uge_swap_or_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @uge_swap_or_max_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X]], -1
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]]
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp ule i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X == MIN) || (X <= Y) --> X <= Y
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @sle_or_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_or_min(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_or_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_or_min_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_or_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_or_min_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_or_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_or_min_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X]], -128
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]]
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp sle i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_or_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_or_min(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_or_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_or_min_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_or_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_or_min_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sle_swap_or_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sle_swap_or_min_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X]], -128
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]]
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp sge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_or_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_or_min(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_or_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_or_min_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_or_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_or_min_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_or_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_or_min_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X]], 0
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]]
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp ule i8 %x, %y
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_or_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_or_min(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_or_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_or_min_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_or_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_or_min_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ule_swap_or_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ule_swap_or_min_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp uge i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq i8 [[X]], 0
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 true, i1 [[CMP]]
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp uge i8 %y, %x
|
|
%cmpeq = icmp eq i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X != MAX) && (X < Y) --> X < Y
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @slt_and_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_and_not_max(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_and_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_and_not_max_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_and_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_and_not_max_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_and_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_and_not_max_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X]], 127
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_and_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_and_not_max(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_and_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_and_not_max_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_and_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_and_not_max_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_and_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_and_not_max_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X]], 127
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_and_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_and_not_max(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_and_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_and_not_max_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_and_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_and_not_max_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_and_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_and_not_max_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X]], -1
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_and_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_and_not_max(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_and_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_and_not_max_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_and_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_and_not_max_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_and_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_and_not_max_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X]], -1
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X != MIN) && (X > Y) --> X > Y
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @sgt_and_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_and_not_min(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_and_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_and_not_min_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_and_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_and_not_min_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_and_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_and_not_min_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X]], -128
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_and_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_and_not_min(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_and_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_and_not_min_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_and_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_and_not_min_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_and_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_and_not_min_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X]], -128
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_and_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_and_not_min(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_and_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_and_not_min_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_and_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_and_not_min_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_and_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_and_not_min_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X]], 0
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_and_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_and_not_min(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = and i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_and_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_and_not_min_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmp, i1 %cmpeq, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_and_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_and_not_min_commute(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = and i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_and_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_and_not_min_commute_logical(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X]], 0
|
|
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMPEQ]], i1 [[CMP]], i1 false
|
|
; CHECK-NEXT: ret i1 [[R]]
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 %cmp, i1 false
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X != MAX) || (X < Y) --> X != MAX
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @slt_or_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_or_not_max(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_or_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_or_not_max_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_or_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_or_not_max_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_or_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_or_not_max_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp slt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_or_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_or_not_max(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_or_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_or_not_max_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_or_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_or_not_max_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @slt_swap_or_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @slt_swap_or_not_max_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 127
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sgt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 127
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_or_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_or_not_max(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_or_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_or_not_max_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_or_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_or_not_max_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_or_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_or_not_max_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ult i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_or_not_max(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_or_not_max(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_or_not_max_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_or_not_max_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_or_not_max_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_or_not_max_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ult_swap_or_not_max_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ult_swap_or_not_max_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -1
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ugt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 255
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;
|
|
; (X != MIN) || (X > Y) --> X != MIN
|
|
;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
define i1 @sgt_or_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_or_not_min(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_or_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_or_not_min_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_or_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_or_not_min_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_or_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_or_not_min_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp sgt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_or_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_or_not_min(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_or_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_or_not_min_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_or_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_or_not_min_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @sgt_swap_or_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @sgt_swap_or_not_min_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], -128
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp slt i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 128
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_or_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_or_not_min(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_or_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_or_not_min_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_or_not_min_commute(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_or_not_min_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_or_not_min_commute_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_or_not_min_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ugt i8 %x, %y
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_or_not_min(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_or_not_min(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = or i1 %cmp, %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_or_not_min_logical(i8 %x, i8 %y) {
|
|
; CHECK-LABEL: @ugt_swap_or_not_min_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i8 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ult i8 %y, %x
|
|
%cmpeq = icmp ne i8 %x, 0
|
|
%r = select i1 %cmp, i1 true, i1 %cmpeq
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_or_not_min_commute(i823 %x, i823 %y) {
|
|
; CHECK-LABEL: @ugt_swap_or_not_min_commute(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i823 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ult i823 %y, %x
|
|
%cmpeq = icmp ne i823 %x, 0
|
|
%r = or i1 %cmpeq, %cmp
|
|
ret i1 %r
|
|
}
|
|
|
|
define i1 @ugt_swap_or_not_min_commute_logical(i823 %x, i823 %y) {
|
|
; CHECK-LABEL: @ugt_swap_or_not_min_commute_logical(
|
|
; CHECK-NEXT: [[CMPEQ:%.*]] = icmp ne i823 [[X:%.*]], 0
|
|
; CHECK-NEXT: ret i1 [[CMPEQ]]
|
|
;
|
|
%cmp = icmp ult i823 %y, %x
|
|
%cmpeq = icmp ne i823 %x, 0
|
|
%r = select i1 %cmpeq, i1 true, i1 %cmp
|
|
ret i1 %r
|
|
}
|