From 5f254d8b66f995eaeb5316b2e26ca507ebd5d0c4 Mon Sep 17 00:00:00 2001 From: clubby789 Date: Tue, 5 Mar 2024 13:26:47 +0000 Subject: Remove `SpecOptionPartialEq` --- tests/codegen/option-niche-eq.rs | 75 ++++++++++++++++++++++++++++++++++++++ tests/codegen/option-nonzero-eq.rs | 38 ------------------- 2 files changed, 75 insertions(+), 38 deletions(-) create mode 100644 tests/codegen/option-niche-eq.rs delete mode 100644 tests/codegen/option-nonzero-eq.rs (limited to 'tests/codegen') diff --git a/tests/codegen/option-niche-eq.rs b/tests/codegen/option-niche-eq.rs new file mode 100644 index 00000000000..8b8044e9b75 --- /dev/null +++ b/tests/codegen/option-niche-eq.rs @@ -0,0 +1,75 @@ +//@ compile-flags: -O -Zmerge-functions=disabled +//@ min-llvm-version: 18 +#![crate_type = "lib"] +#![feature(generic_nonzero)] + +extern crate core; +use core::cmp::Ordering; +use core::ptr::NonNull; +use core::num::NonZero; + +// CHECK-lABEL: @non_zero_eq +#[no_mangle] +pub fn non_zero_eq(l: Option>, r: Option>) -> bool { + // CHECK: start: + // CHECK-NEXT: icmp eq i32 + // CHECK-NEXT: ret i1 + l == r +} + +// CHECK-lABEL: @non_zero_signed_eq +#[no_mangle] +pub fn non_zero_signed_eq(l: Option>, r: Option>) -> bool { + // CHECK: start: + // CHECK-NEXT: icmp eq i64 + // CHECK-NEXT: ret i1 + l == r +} + +// CHECK-lABEL: @non_null_eq +#[no_mangle] +pub fn non_null_eq(l: Option>, r: Option>) -> bool { + // CHECK: start: + // CHECK-NEXT: icmp eq ptr + // CHECK-NEXT: ret i1 + l == r +} + +// CHECK-lABEL: @ordering_eq +#[no_mangle] +pub fn ordering_eq(l: Option, r: Option) -> bool { + // CHECK: start: + // CHECK-NEXT: icmp eq i8 + // CHECK-NEXT: ret i1 + l == r +} + +#[derive(PartialEq)] +pub enum EnumWithNiche { + A, + B, + C, + D, + E, + F, + G, +} + +// CHECK-lABEL: @niche_eq +#[no_mangle] +pub fn niche_eq(l: Option, r: Option) -> bool { + // CHECK: start: + // CHECK-NEXT: icmp eq i8 + // CHECK-NEXT: ret i1 + l == r +} + +// FIXME: This should work too +// // FIXME-CHECK-lABEL: @bool_eq +// #[no_mangle] +// pub fn bool_eq(l: Option, r: Option) -> bool { +// // FIXME-CHECK: start: +// // FIXME-CHECK-NEXT: icmp eq i8 +// // FIXME-CHECK-NEXT: ret i1 +// l == r +// } diff --git a/tests/codegen/option-nonzero-eq.rs b/tests/codegen/option-nonzero-eq.rs deleted file mode 100644 index f637b1aef97..00000000000 --- a/tests/codegen/option-nonzero-eq.rs +++ /dev/null @@ -1,38 +0,0 @@ -//@ compile-flags: -O -Zmerge-functions=disabled -#![crate_type = "lib"] -#![feature(generic_nonzero)] - -extern crate core; -use core::cmp::Ordering; -use core::ptr::NonNull; -use core::num::NonZero; - -// See also tests/assembly/option-nonzero-eq.rs, for cases with `assume`s in the -// LLVM and thus don't optimize down clearly here, but do in assembly. - -// CHECK-lABEL: @non_zero_eq -#[no_mangle] -pub fn non_zero_eq(l: Option>, r: Option>) -> bool { - // CHECK: start: - // CHECK-NEXT: icmp eq i32 - // CHECK-NEXT: ret i1 - l == r -} - -// CHECK-lABEL: @non_zero_signed_eq -#[no_mangle] -pub fn non_zero_signed_eq(l: Option>, r: Option>) -> bool { - // CHECK: start: - // CHECK-NEXT: icmp eq i64 - // CHECK-NEXT: ret i1 - l == r -} - -// CHECK-lABEL: @non_null_eq -#[no_mangle] -pub fn non_null_eq(l: Option>, r: Option>) -> bool { - // CHECK: start: - // CHECK-NEXT: icmp eq ptr - // CHECK-NEXT: ret i1 - l == r -} -- cgit 1.4.1-3-g733a5