Skip to content

Commit

Permalink
Add another codegen test, array_eq_zero
Browse files Browse the repository at this point in the history
Showing that this avoids an alloca and private constant.
  • Loading branch information
scottmcm committed Jul 8, 2021
1 parent 1216353 commit 039a3ba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/codegen/array-equality.rs
Expand Up @@ -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]
}

0 comments on commit 039a3ba

Please sign in to comment.