about summary refs log tree commit diff
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2021-05-30 21:27:29 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2021-07-08 14:55:58 -0700
commit039a3bafecb42b51c2cc5f1bc1e0b0109873b729 (patch)
tree7878730af788f30dae1bcab0959a86636fef6d04
parent12163534a94b24a8a754fffe6e601904c2c6f31f (diff)
downloadrust-039a3bafecb42b51c2cc5f1bc1e0b0109873b729.tar.gz
rust-039a3bafecb42b51c2cc5f1bc1e0b0109873b729.zip
Add another codegen test, array_eq_zero
Showing that this avoids an alloca and private constant.
-rw-r--r--src/test/codegen/array-equality.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/codegen/array-equality.rs b/src/test/codegen/array-equality.rs
index 6a9fb5c8f86..aa56e32e26c 100644
--- a/src/test/codegen/array-equality.rs
+++ b/src/test/codegen/array-equality.rs
@@ -34,3 +34,12 @@ pub fn array_eq_long(a: &[u16; 1234], b: &[u16; 1234]) -> bool {
     // CHECK-NEXT: ret i1 %[[EQ]]
     a == b
 }
+
+// CHECK-LABEL: @array_eq_zero(i128 %0)
+#[no_mangle]
+pub fn array_eq_zero(x: [u16; 8]) -> bool {
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: %[[EQ:.+]] = icmp eq i128 %0, 0
+    // CHECK-NEXT: ret i1 %[[EQ]]
+    x == [0; 8]
+}