summaryrefslogtreecommitdiffstats
path: root/tests/codegen/array-equality.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/codegen/array-equality.rs30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/codegen/array-equality.rs b/tests/codegen/array-equality.rs
index cd5e82a92..abfe295f8 100644
--- a/tests/codegen/array-equality.rs
+++ b/tests/codegen/array-equality.rs
@@ -1,4 +1,4 @@
-// compile-flags: -O
+// compile-flags: -O -Z merge-functions=disabled
// only-x86_64
#![crate_type = "lib"]
@@ -43,6 +43,15 @@ pub fn array_eq_long(a: &[u16; 1234], b: &[u16; 1234]) -> bool {
a == b
}
+// CHECK-LABEL: @array_char_eq
+#[no_mangle]
+pub fn array_char_eq(a: [char; 2], b: [char; 2]) -> bool {
+ // CHECK-NEXT: start:
+ // CHECK-NEXT: %[[EQ:.+]] = icmp eq i64 %0, %1
+ // CHECK-NEXT: ret i1 %[[EQ]]
+ a == b
+}
+
// CHECK-LABEL: @array_eq_zero_short(i48
#[no_mangle]
pub fn array_eq_zero_short(x: [u16; 3]) -> bool {
@@ -52,6 +61,25 @@ pub fn array_eq_zero_short(x: [u16; 3]) -> bool {
x == [0; 3]
}
+// CHECK-LABEL: @array_eq_none_short(i40
+#[no_mangle]
+pub fn array_eq_none_short(x: [Option<std::num::NonZeroU8>; 5]) -> bool {
+ // CHECK-NEXT: start:
+ // CHECK-NEXT: %[[EQ:.+]] = icmp eq i40 %0, 0
+ // CHECK-NEXT: ret i1 %[[EQ]]
+ x == [None; 5]
+}
+
+// CHECK-LABEL: @array_eq_zero_nested(
+#[no_mangle]
+pub fn array_eq_zero_nested(x: [[u8; 3]; 3]) -> bool {
+ // CHECK: %[[VAL:.+]] = load i72
+ // CHECK-SAME: align 1
+ // CHECK: %[[EQ:.+]] = icmp eq i72 %[[VAL]], 0
+ // CHECK: ret i1 %[[EQ]]
+ x == [[0; 3]; 3]
+}
+
// CHECK-LABEL: @array_eq_zero_mid(
#[no_mangle]
pub fn array_eq_zero_mid(x: [u16; 8]) -> bool {