diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2021-05-30 21:27:29 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2021-07-08 14:55:58 -0700 |
| commit | 039a3bafecb42b51c2cc5f1bc1e0b0109873b729 (patch) | |
| tree | 7878730af788f30dae1bcab0959a86636fef6d04 | |
| parent | 12163534a94b24a8a754fffe6e601904c2c6f31f (diff) | |
| download | rust-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.rs | 9 |
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] +} |
