From 5b7f8afbe6f4a72533e2d9396d01da8b3eedcd7b Mon Sep 17 00:00:00 2001 From: Karl Meakin Date: Thu, 23 Mar 2023 19:14:39 +0000 Subject: [PATCH] ISLE: rewrite `and`/`or` of `icmp` --- cranelift/codegen/src/ir/condcodes.rs | 48 + cranelift/codegen/src/isle_prelude.rs | 33 +- cranelift/codegen/src/opts/algebraic.isle | 174 +++ cranelift/codegen/src/prelude.isle | 12 + .../filetests/egraph/algebraic-icmp.clif | 1132 +++++++++++++++++ 5 files changed, 1388 insertions(+), 11 deletions(-) create mode 100644 cranelift/filetests/filetests/egraph/algebraic-icmp.clif diff --git a/cranelift/codegen/src/ir/condcodes.rs b/cranelift/codegen/src/ir/condcodes.rs index 7059ce6c92b4..b01ee0289557 100644 --- a/cranelift/codegen/src/ir/condcodes.rs +++ b/cranelift/codegen/src/ir/condcodes.rs @@ -150,6 +150,54 @@ impl IntCC { UnsignedLessThanOrEqual => "ule", } } + + /// Return true if self interprets arguments as unsigned integers + pub fn is_unsigned(self) -> bool { + match self { + IntCC::Equal + | IntCC::NotEqual + | IntCC::UnsignedLessThan + | IntCC::UnsignedGreaterThanOrEqual + | IntCC::UnsignedGreaterThan + | IntCC::UnsignedLessThanOrEqual => true, + _ => false, + } + } + + /// Return true if self interprets arguments as signed integers + pub fn is_signed(self) -> bool { + match self { + IntCC::SignedLessThan + | IntCC::SignedGreaterThanOrEqual + | IntCC::SignedGreaterThan + | IntCC::SignedLessThanOrEqual => true, + _ => false, + } + } + + /// Return true if self tests for integer equality + pub fn is_equality(self) -> bool { + match self { + IntCC::Equal + | IntCC::SignedGreaterThanOrEqual + | IntCC::SignedLessThanOrEqual + | IntCC::UnsignedGreaterThanOrEqual + | IntCC::UnsignedLessThanOrEqual => true, + _ => false, + } + } + + /// Return true if self tests for strict integer inequality + pub fn is_inequality(self) -> bool { + match self { + IntCC::NotEqual + | IntCC::SignedLessThan + | IntCC::SignedGreaterThan + | IntCC::UnsignedLessThan + | IntCC::UnsignedGreaterThan => true, + _ => false, + } + } } impl Display for IntCC { diff --git a/cranelift/codegen/src/isle_prelude.rs b/cranelift/codegen/src/isle_prelude.rs index 3de34e436664..b95d8b89be40 100644 --- a/cranelift/codegen/src/isle_prelude.rs +++ b/cranelift/codegen/src/isle_prelude.rs @@ -720,17 +720,10 @@ macro_rules! isle_common_prelude_methods { #[inline] fn signed_cond_code(&mut self, cc: &condcodes::IntCC) -> Option { - match cc { - IntCC::Equal - | IntCC::UnsignedGreaterThanOrEqual - | IntCC::UnsignedGreaterThan - | IntCC::UnsignedLessThanOrEqual - | IntCC::UnsignedLessThan - | IntCC::NotEqual => None, - IntCC::SignedGreaterThanOrEqual - | IntCC::SignedGreaterThan - | IntCC::SignedLessThanOrEqual - | IntCC::SignedLessThan => Some(*cc), + if cc.is_signed() { + Some(*cc) + } else { + None } } @@ -744,6 +737,24 @@ macro_rules! isle_common_prelude_methods { cc.inverse() } + #[inline] + fn intcc_equality(&mut self, cc: &IntCC) -> Option { + if cc.is_equality() { + Some(*cc) + } else { + None + } + } + + #[inline] + fn intcc_inequality(&mut self, cc: &IntCC) -> Option { + if cc.is_inequality() { + Some(*cc) + } else { + None + } + } + #[inline] fn floatcc_reverse(&mut self, cc: &FloatCC) -> FloatCC { cc.reverse() diff --git a/cranelift/codegen/src/opts/algebraic.isle b/cranelift/codegen/src/opts/algebraic.isle index 8cab77bd448b..3c4b248a28cb 100644 --- a/cranelift/codegen/src/opts/algebraic.isle +++ b/cranelift/codegen/src/opts/algebraic.isle @@ -479,6 +479,180 @@ (iconst _ (u64_from_imm64 0)))) (iconst ty (imm64 1))) +;; eq(x, y) && ne(x, y) == ne(x, y) && eq(x, y) == false. +;; eq(x, y) && ult(x, y) == ult(x, y) && eq(x, y) == false. +;; eq(x, y) && ugt(x, y) == ugt(x, y) && eq(x, y) == false. +;; eq(x, y) && slt(x, y) == slt(x, y) && eq(x, y) == false. +;; eq(x, y) && sgt(x, y) == sgt(x, y) && eq(x, y) == false. +(rule (simplify (band ty (eq ty x y) (icmp_inequality ty x y))) (subsume (iconst ty (imm64 0)))) +(rule (simplify (band ty (icmp_inequality ty x y) (eq ty x y))) (subsume (iconst ty (imm64 0)))) + +;; eq(x, y) && ule(x, y) == ule(x, y) && eq(x, y) == eq(x, y). +;; eq(x, y) && uge(x, y) == uge(x, y) && eq(x, y) == eq(x, y). +;; eq(x, y) && sle(x, y) == sle(x, y) && eq(x, y) == eq(x, y). +;; eq(x, y) && sge(x, y) == sge(x, y) && eq(x, y) == eq(x, y). +(rule (simplify (band ty eq @ (eq ty x y) (icmp_equality ty x y))) (subsume eq)) +(rule (simplify (band ty (icmp_equality ty x y) eq @ (eq ty x y))) (subsume eq)) + +;; ne(x, y) && ult(x, y) == ult(x, y) && ne(x, y) == ult(x, y). +;; ne(x, y) && ugt(x, y) == ugt(x, y) && ne(x, y) == ugt(x, y). +;; ne(x, y) && slt(x, y) == slt(x, y) && ne(x, y) == slt(x, y). +;; ne(x, y) && sgt(x, y) == sgt(x, y) && ne(x, y) == sgt(x, y). +(rule (simplify (band ty (ne ty x y) icmp @ (icmp_inequality ty x y))) (subsume icmp)) +(rule (simplify (band ty icmp @ (icmp_inequality ty x y) (ne ty x y))) (subsume icmp)) + +;; ne(x, y) && ule(x, y) == ule(x, y) && ne(x, y) == ult(x, y). +(rule (simplify (band ty (ne ty x y) (ule ty x y))) (subsume (ult ty x y))) +(rule (simplify (band ty (ule ty x y) (ne ty x y))) (subsume (ult ty x y))) + +;; ne(x, y) && uge(x, y) == uge(x, y) && ne(x, y) == ugt(x, y). +(rule (simplify (band ty (ne ty x y) (uge ty x y))) (subsume (ugt ty x y))) +(rule (simplify (band ty (uge ty x y) (ne ty x y))) (subsume (ugt ty x y))) + +;; ne(x, y) && sle(x, y) == sle(x, y) && ne(x, y) == slt(x, y). +(rule (simplify (band ty (ne ty x y) (sle ty x y))) (subsume (slt ty x y))) +(rule (simplify (band ty (sle ty x y) (ne ty x y))) (subsume (slt ty x y))) + +;; ne(x, y) && sge(x, y) == sge(x, y) && ne(x, y) == sgt(x, y). +(rule (simplify (band ty (ne ty x y) (sge ty x y))) (subsume (sgt ty x y))) +(rule (simplify (band ty (sge ty x y) (ne ty x y))) (subsume (sgt ty x y))) + +;; ult(x, y) && ule(x, y) == ule(x, y) && ult(x, y) == ult(x, y). +(rule (simplify (band ty (ult ty x y) (ule ty x y))) (subsume (ult ty x y))) +(rule (simplify (band ty (ule ty x y) (ult ty x y))) (subsume (ult ty x y))) + +;; ult(x, y) && ugt(x, y) == ugt(x, y) && ult(x, y) == false. +(rule (simplify (band ty (ult ty x y) (ugt ty x y))) (subsume (iconst ty (imm64 0)))) +(rule (simplify (band ty (ugt ty x y) (ult ty x y))) (subsume (iconst ty (imm64 0)))) + +;; ult(x, y) && uge(x, y) == uge(x, y) && ult(x, y) == false. +(rule (simplify (band ty (ult ty x y) (uge ty x y))) (subsume (iconst ty (imm64 0)))) +(rule (simplify (band ty (uge ty x y) (ult ty x y))) (subsume (iconst ty (imm64 0)))) + +;; ule(x, y) && ugt(x, y) == ugt(x, y) && ule(x, y) == false. +(rule (simplify (band ty (ule ty x y) (ugt ty x y))) (subsume (iconst ty (imm64 0)))) +(rule (simplify (band ty (ugt ty x y) (ule ty x y))) (subsume (iconst ty (imm64 0)))) + +;; ule(x, y) && uge(x, y) == uge(x, y) && ule(x, y) == eq(x, y). +(rule (simplify (band ty (ule ty x y) (uge ty x y))) (subsume (eq ty x y))) +(rule (simplify (band ty (uge ty x y) (ule ty x y))) (subsume (eq ty x y))) + +;; ugt(x, y) && uge(x, y) == uge(x, y) && ugt(x, y) == ugt(x, y). +(rule (simplify (band ty (ugt ty x y) (uge ty x y))) (subsume (ugt ty x y))) +(rule (simplify (band ty (uge ty x y) (ugt ty x y))) (subsume (ugt ty x y))) + +;; slt(x, y) && sle(x, y) == sle(x, y) && slt(x, y) == slt(x, y). +(rule (simplify (band ty (slt ty x y) (sle ty x y))) (subsume (slt ty x y))) +(rule (simplify (band ty (sle ty x y) (slt ty x y))) (subsume (slt ty x y))) + +;; slt(x, y) && sgt(x, y) == sgt(x, y) && slt(x, y) == false. +(rule (simplify (band ty (slt ty x y) (sgt ty x y))) (subsume (iconst ty (imm64 0)))) +(rule (simplify (band ty (sgt ty x y) (slt ty x y))) (subsume (iconst ty (imm64 0)))) + +;; slt(x, y) && sge(x, y) == sge(x, y) && slt(x, y) == false. +(rule (simplify (band ty (slt ty x y) (sge ty x y))) (subsume (iconst ty (imm64 0)))) +(rule (simplify (band ty (sge ty x y) (slt ty x y))) (subsume (iconst ty (imm64 0)))) + +;; sle(x, y) && sgt(x, y) == sgt(x, y) && sle(x, y) == false. +(rule (simplify (band ty (sle ty x y) (sgt ty x y))) (subsume (iconst ty (imm64 0)))) +(rule (simplify (band ty (sgt ty x y) (sle ty x y))) (subsume (iconst ty (imm64 0)))) + +;; sle(x, y) && sge(x, y) == sge(x, y) && sle(x, y) == eq(x, y). +(rule (simplify (band ty (sle ty x y) (sge ty x y))) (subsume (eq ty x y))) +(rule (simplify (band ty (sge ty x y) (sle ty x y))) (subsume (eq ty x y))) + +;; sgt(x, y) && sge(x, y) == sge(x, y) && sgt(x, y) == sgt(x, y). +(rule (simplify (band ty (sgt ty x y) (sge ty x y))) (subsume (sgt ty x y))) +(rule (simplify (band ty (sge ty x y) (sgt ty x y))) (subsume (sgt ty x y))) + +;; eq(x, y) || ne(x, y) == ne(x, y) || eq(x, y) == true. +(rule (simplify (bor ty (eq ty x y) (ne ty x y))) (subsume (iconst ty (imm64 1)))) +(rule (simplify (bor ty (ne ty x y) (eq ty x y))) (subsume (iconst ty (imm64 1)))) + +;; eq(x, y) || ule(x, y) == ule(x, y) || eq(x, y) == ule(x, y). +;; eq(x, y) || uge(x, y) == uge(x, y) || eq(x, y) == uge(x, y). +;; eq(x, y) || sle(x, y) == sle(x, y) || eq(x, y) == sle(x, y). +;; eq(x, y) || sge(x, y) == sge(x, y) || eq(x, y) == sge(x, y). +(rule (simplify (bor ty (eq ty x y) icmp @ (icmp_equality ty x y))) (subsume icmp)) +(rule (simplify (bor ty icmp @ (icmp_equality ty x y) (eq ty x y))) (subsume icmp)) + +;; eq(x, y) || ult(x, y) == ult(x, y) || eq(x, y) == ule(x, y). +(rule (simplify (bor ty (eq ty x y) (ult ty x y))) (subsume (ule ty x y))) +(rule (simplify (bor ty (ult ty x y) (eq ty x y))) (subsume (ule ty x y))) + +;; eq(x, y) || ugt(x, y) == ugt(x, y) || eq(x, y) == uge(x, y). +(rule (simplify (bor ty (eq ty x y) (ugt ty x y))) (subsume (uge ty x y))) +(rule (simplify (bor ty (ugt ty x y) (eq ty x y))) (subsume (uge ty x y))) + +;; eq(x, y) || slt(x, y) == slt(x, y) || eq(x, y) == sle(x, y). +(rule (simplify (bor ty (eq ty x y) (slt ty x y))) (subsume (sle ty x y))) +(rule (simplify (bor ty (slt ty x y) (eq ty x y))) (subsume (sle ty x y))) + +;; eq(x, y) || sgt(x, y) == sgt(x, y) || eq(x, y) == sge(x, y). +(rule (simplify (bor ty (eq ty x y) (sgt ty x y))) (subsume (sge ty x y))) +(rule (simplify (bor ty (sgt ty x y) (eq ty x y))) (subsume (sge ty x y))) + +;; ne(x, y) || ult(x, y) == ult(x, y) || ne(x, y) == ne(x, y). +;; ne(x, y) || ugt(x, y) == ugt(x, y) || ne(x, y) == ne(x, y). +;; ne(x, y) || slt(x, y) == slt(x, y) || ne(x, y) == ne(x, y). +;; ne(x, y) || sgt(x, y) == sgt(x, y) || ne(x, y) == ne(x, y). +(rule (simplify (bor ty ne @ (ne ty x y) (icmp_inequality ty x y))) (subsume ne)) +(rule (simplify (bor ty (icmp_inequality ty x y) ne @ (ne ty x y))) (subsume ne)) + +;; ne(x, y) || ule(x, y) == ule(x, y) || ne(x, y) == true. +;; ne(x, y) || uge(x, y) == uge(x, y) || ne(x, y) == true. +;; ne(x, y) || sle(x, y) == sle(x, y) || ne(x, y) == true. +;; ne(x, y) || sge(x, y) == sge(x, y) || ne(x, y) == true. +(rule (simplify (bor ty (ne ty x y) (icmp_equality ty x y))) (subsume (iconst ty (imm64 1)))) +(rule (simplify (bor ty (icmp_equality ty x y) (ne ty x y))) (subsume (iconst ty (imm64 1)))) + +;; ult(x, y) || ule(x, y) == ule(x, y) || ult(x, y) == ule(x, y). +(rule (simplify (bor ty (ult ty x y) (ule ty x y))) (subsume (ule ty x y))) +(rule (simplify (bor ty (ule ty x y) (ult ty x y))) (subsume (ule ty x y))) + +;; ult(x, y) || ugt(x, y) == ugt(x, y) || ult(x, y) == ne(x, y). +(rule (simplify (bor ty (ult ty x y) (ugt ty x y))) (subsume (ne ty x y))) +(rule (simplify (bor ty (ugt ty x y) (ult ty x y))) (subsume (ne ty x y))) + +;; ult(x, y) || uge(x, y) == uge(x, y) || ult(x, y) == true. +(rule (simplify (bor ty (ult ty x y) (uge ty x y))) (subsume (iconst ty (imm64 1)))) +(rule (simplify (bor ty (uge ty x y) (ult ty x y))) (subsume (iconst ty (imm64 1)))) + +;; ule(x, y) || ugt(x, y) == ugt(x, y) || ule(x, y) == true. +(rule (simplify (bor ty (ule ty x y) (ugt ty x y))) (subsume (iconst ty (imm64 1)))) +(rule (simplify (bor ty (ugt ty x y) (ule ty x y))) (subsume (iconst ty (imm64 1)))) + +;; ule(x, y) || uge(x, y) == uge(x, y) || ule(x, y) == true. +(rule (simplify (bor ty (ule ty x y) (uge ty x y))) (subsume (iconst ty (imm64 1)))) +(rule (simplify (bor ty (uge ty x y) (ule ty x y))) (subsume (iconst ty (imm64 1)))) + +;; ugt(x, y) || uge(x, y) == uge(x, y) || ugt(x, y) == uge(x, y). +(rule (simplify (bor ty (ugt ty x y) (uge ty x y))) (subsume (uge ty x y))) +(rule (simplify (bor ty (uge ty x y) (ugt ty x y))) (subsume (uge ty x y))) + +;; slt(x, y) || sle(x, y) == sle(x, y) || slt(x, y) == sle(x, y). +(rule (simplify (bor ty (slt ty x y) (sle ty x y))) (subsume (sle ty x y))) +(rule (simplify (bor ty (sle ty x y) (slt ty x y))) (subsume (sle ty x y))) + +;; slt(x, y) || sgt(x, y) == sgt(x, y) || slt(x, y) == ne(x, y). +(rule (simplify (bor ty (slt ty x y) (sgt ty x y))) (subsume (ne ty x y))) +(rule (simplify (bor ty (sgt ty x y) (slt ty x y))) (subsume (ne ty x y))) + +;; slt(x, y) || sge(x, y) == sge(x, y) || slt(x, y) == true. +(rule (simplify (bor ty (slt ty x y) (sge ty x y))) (subsume (iconst ty (imm64 1)))) +(rule (simplify (bor ty (sge ty x y) (slt ty x y))) (subsume (iconst ty (imm64 1)))) + +;; sle(x, y) || sgt(x, y) == sgt(x, y) || sle(x, y) == true. +(rule (simplify (bor ty (sle ty x y) (sgt ty x y))) (subsume (iconst ty (imm64 1)))) +(rule (simplify (bor ty (sgt ty x y) (sle ty x y))) (subsume (iconst ty (imm64 1)))) + +;; sle(x, y) || sge(x, y) == sge(x, y) || sle(x, y) == true. +(rule (simplify (bor ty (sle ty x y) (sge ty x y))) (subsume (iconst ty (imm64 1)))) +(rule (simplify (bor ty (sge ty x y) (sle ty x y))) (subsume (iconst ty (imm64 1)))) + +;; sgt(x, y) || sge(x, y) == sge(x, y) || sgt(x, y) == sge. +(rule (simplify (bor ty (sgt ty x y) (sge ty x y))) (subsume (sge ty x y))) +(rule (simplify (bor ty (sge ty x y) (sgt ty x y))) (subsume (sge ty x y))) ;; Transform select-of-icmp into {u,s}{min,max} instructions where possible. (rule (simplify (select ty (sgt _ x y) x y)) (smax ty x y)) diff --git a/cranelift/codegen/src/prelude.isle b/cranelift/codegen/src/prelude.isle index 012d5e29af6d..2835333cc5a5 100644 --- a/cranelift/codegen/src/prelude.isle +++ b/cranelift/codegen/src/prelude.isle @@ -315,6 +315,18 @@ (decl sge (Type Value Value) Value) (extractor (sge ty x y) (icmp ty (IntCC.SignedGreaterThanOrEqual) x y)) +(decl intcc_equality (IntCC) IntCC) +(extern extractor intcc_equality intcc_equality) + +(decl intcc_inequality (IntCC) IntCC) +(extern extractor intcc_inequality intcc_inequality) + +(decl icmp_equality (Type Value Value) Value) +(extractor (icmp_equality ty x y) (icmp ty (intcc_equality _) x y)) + +(decl icmp_inequality (Type Value Value) Value) +(extractor (icmp_inequality ty x y) (icmp ty (intcc_inequality _) x y)) + ;; An extractor that only matches types that can fit in 16 bits. (decl fits_in_16 (Type) Type) (extern extractor fits_in_16 fits_in_16) diff --git a/cranelift/filetests/filetests/egraph/algebraic-icmp.clif b/cranelift/filetests/filetests/egraph/algebraic-icmp.clif new file mode 100644 index 000000000000..026df9db4a75 --- /dev/null +++ b/cranelift/filetests/filetests/egraph/algebraic-icmp.clif @@ -0,0 +1,1132 @@ +test optimize +set opt_level=speed +set use_egraphs=true +target x86_64 + +function %icmp_and_eq_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp ne v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_eq_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp ult v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_eq_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp ule v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_and_eq_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp ugt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_eq_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp uge v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_and_eq_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp slt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_eq_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp sle v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_and_eq_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp sgt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_eq_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp sge v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_and_ne_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp eq v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_ne_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp ult v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_and_ne_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp ule v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp ult v0, v1 + ; check: return v5 +} + +function %icmp_and_ne_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp ugt v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_and_ne_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp uge v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp ugt v0, v1 + ; check: return v5 +} + +function %icmp_and_ne_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp slt v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_and_ne_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp sle v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp slt v0, v1 + ; check: return v5 +} + +function %icmp_and_ne_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp sgt v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_and_ne_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp sge v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp sgt v0, v1 + ; check: return v5 +} + +function %icmp_and_ult_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp eq v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_ult_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp ne v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_and_ult_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp ule v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp ult v0, v1 + ; check: return v5 +} + +function %icmp_and_ult_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp ugt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_ult_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp uge v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_ule_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp eq v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_and_ule_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp ne v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp ult v0, v1 + ; check: return v5 +} + +function %icmp_and_ule_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp ult v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp ult v0, v1 + ; check: return v5 +} + +function %icmp_and_ule_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp ugt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_ule_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp uge v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp eq v0, v1 + ; check: return v5 +} + +function %icmp_and_ugt_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp eq v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_ugt_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp ne v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_and_ugt_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp ult v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_ugt_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp ule v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_ugt_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp uge v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp ugt v0, v1 + ; check: return v5 +} + +function %icmp_and_uge_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp eq v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_and_uge_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp ne v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp ugt v0, v1 + ; check: return v5 +} + +function %icmp_and_uge_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp ult v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_uge_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp ule v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp eq v0, v1 + ; check: return v5 +} + +function %icmp_and_uge_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp ugt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp ugt v0, v1 + ; check: return v5 +} + +function %icmp_and_slt_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp eq v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_slt_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp ne v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_and_slt_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp sle v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp slt v0, v1 + ; check: return v5 +} + +function %icmp_and_slt_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp sgt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_slt_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp sge v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_sle_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp eq v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_and_sle_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp ne v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp slt v0, v1 + ; check: return v5 +} + +function %icmp_and_sle_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp slt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp slt v0, v1 + ; check: return v5 +} + +function %icmp_and_sle_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp sgt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_sle_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp sge v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp eq v0, v1 + ; check: return v5 +} + +function %icmp_and_sgt_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp eq v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_sgt_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp ne v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_and_sgt_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp slt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_sgt_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp sle v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_sgt_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp sge v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp sgt v0, v1 + ; check: return v5 +} + +function %icmp_and_sge_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp eq v0, v1 + v4 = band v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_and_sge_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp ne v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp sgt v0, v1 + ; check: return v5 +} + +function %icmp_and_sge_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp slt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = iconst.i8 0 + ; check: return v5 +} + +function %icmp_and_sge_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp sle v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp eq v0, v1 + ; check: return v5 +} + +function %icmp_and_sge_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp sgt v0, v1 + v4 = band v2, v3 + return v4 + ; check: v5 = icmp sgt v0, v1 + ; check: return v5 +} + +function %icmp_or_eq_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp ne v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_eq_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp ult v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp ule v0, v1 + ; check: return v5 +} + +function %icmp_or_eq_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp ule v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_or_eq_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp ugt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp uge v0, v1 + ; check: return v5 +} + +function %icmp_or_eq_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp uge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_or_eq_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp slt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp sle v0, v1 + ; check: return v5 +} + +function %icmp_or_eq_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp sle v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_or_eq_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp sgt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp sge v0, v1 + ; check: return v5 +} + +function %icmp_or_eq_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp eq v0, v1 + v3 = icmp sge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_or_ne_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp eq v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ne_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp ult v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_or_ne_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp ule v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ne_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp ugt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_or_ne_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp uge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ne_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp slt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_or_ne_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp sle v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ne_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp sgt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_or_ne_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ne v0, v1 + v3 = icmp sge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ult_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp eq v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp ule v0, v1 + ; check: return v5 +} + +function %icmp_or_ult_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp ne v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_or_ult_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp ule v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp ule v0, v1 + ; check: return v5 +} + +function %icmp_or_ult_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp ugt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp ne v0, v1 + ; check: return v5 +} + +function %icmp_or_ult_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ult v0, v1 + v3 = icmp uge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ule_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp eq v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_or_ule_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp ne v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ule_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp ult v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp ule v0, v1 + ; check: return v5 +} + +function %icmp_or_ule_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp ugt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ule_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ule v0, v1 + v3 = icmp uge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ugt_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp eq v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp uge v0, v1 + ; check: return v5 +} + +function %icmp_or_ugt_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp ne v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_or_ugt_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp ult v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp ne v0, v1 + ; check: return v5 +} + +function %icmp_or_ugt_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp ule v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_ugt_uge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp ugt v0, v1 + v3 = icmp uge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp uge v0, v1 + ; check: return v5 +} + +function %icmp_or_uge_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp eq v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_or_uge_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp ne v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_uge_ult(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp ult v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_uge_ule(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp ule v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_uge_ugt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp uge v0, v1 + v3 = icmp ugt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp uge v0, v1 + ; check: return v5 +} + +function %icmp_or_slt_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp eq v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp sle v0, v1 + ; check: return v5 +} + +function %icmp_or_slt_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp ne v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_or_slt_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp sle v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp sle v0, v1 + ; check: return v5 +} + +function %icmp_or_slt_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp sgt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp ne v0, v1 + ; check: return v5 +} + +function %icmp_or_slt_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp slt v0, v1 + v3 = icmp sge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_sle_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp eq v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_or_sle_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp ne v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_sle_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp slt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp sle v0, v1 + ; check: return v5 +} + +function %icmp_or_sle_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp sgt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_sle_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sle v0, v1 + v3 = icmp sge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_sgt_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp eq v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp sge v0, v1 + ; check: return v5 +} + +function %icmp_or_sgt_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp ne v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v3 +} + +function %icmp_or_sgt_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp slt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp ne v0, v1 + ; check: return v5 +} + +function %icmp_or_sgt_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp sle v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_sgt_sge(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sgt v0, v1 + v3 = icmp sge v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp sge v0, v1 + ; check: return v5 +} + +function %icmp_or_sge_eq(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp eq v0, v1 + v4 = bor v2, v3 + return v4 + ; check: return v2 +} + +function %icmp_or_sge_ne(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp ne v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_sge_slt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp slt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_sge_sle(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp sle v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = iconst.i8 1 + ; check: return v5 +} + +function %icmp_or_sge_sgt(i32, i32) -> i8 { +block0(v0: i32, v1: i32): + v2 = icmp sge v0, v1 + v3 = icmp sgt v0, v1 + v4 = bor v2, v3 + return v4 + ; check: v5 = icmp sge v0, v1 + ; check: return v5 +}