Skip to content

Commit 039a3ba

Browse files
committed
Add another codegen test, array_eq_zero
Showing that this avoids an alloca and private constant.
1 parent 1216353 commit 039a3ba

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/test/codegen/array-equality.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ pub fn array_eq_long(a: &[u16; 1234], b: &[u16; 1234]) -> bool {
3434
// CHECK-NEXT: ret i1 %[[EQ]]
3535
a == b
3636
}
37+
38+
// CHECK-LABEL: @array_eq_zero(i128 %0)
39+
#[no_mangle]
40+
pub fn array_eq_zero(x: [u16; 8]) -> bool {
41+
// CHECK-NEXT: start:
42+
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i128 %0, 0
43+
// CHECK-NEXT: ret i1 %[[EQ]]
44+
x == [0; 8]
45+
}

0 commit comments

Comments
 (0)