Add another codegen test, array_eq_zero

Showing that this avoids an alloca and private constant.
This commit is contained in:
Scott McMurray 2021-05-30 21:27:29 -07:00
parent 12163534a9
commit 039a3bafec

View File

@ -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]
}