diff options
| author | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-05 09:13:28 +0100 |
|---|---|---|
| committer | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 09:32:08 +0000 |
| commit | cf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch) | |
| tree | 40a88d9a46aaf3e8870676eb2538378b75a263eb /src/test/codegen/slice-ref-equality.rs | |
| parent | ca855e6e42787ecd062d81d53336fe6788ef51a9 (diff) | |
| download | rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip | |
Move /src/test to /tests
Diffstat (limited to 'src/test/codegen/slice-ref-equality.rs')
| -rw-r--r-- | src/test/codegen/slice-ref-equality.rs | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/test/codegen/slice-ref-equality.rs b/src/test/codegen/slice-ref-equality.rs deleted file mode 100644 index 47fde12bf30..00000000000 --- a/src/test/codegen/slice-ref-equality.rs +++ /dev/null @@ -1,38 +0,0 @@ -// compile-flags: -C opt-level=3 -Zmerge-functions=disabled - -#![crate_type = "lib"] - -// #71602 reported a simple array comparison just generating a loop. -// This was originally fixed by ensuring it generates a single bcmp, -// but we now generate it as a load+icmp instead. `is_zero_slice` was -// tweaked to still test the case of comparison against a slice, -// and `is_zero_array` tests the new array-specific behaviour. -// The optimization was then extended to short slice-to-array comparisons, -// so the first test here now has a long slice to still get the bcmp. - -// CHECK-LABEL: @is_zero_slice_long -#[no_mangle] -pub fn is_zero_slice_long(data: &[u8; 456]) -> bool { - // CHECK: %[[BCMP:.+]] = tail call i32 @{{bcmp|memcmp}}({{.+}}) - // CHECK-NEXT: %[[EQ:.+]] = icmp eq i32 %[[BCMP]], 0 - // CHECK-NEXT: ret i1 %[[EQ]] - &data[..] == [0; 456] -} - -// CHECK-LABEL: @is_zero_slice_short -#[no_mangle] -pub fn is_zero_slice_short(data: &[u8; 4]) -> bool { - // CHECK: %[[LOAD:.+]] = load i32, {{i32\*|ptr}} %{{.+}}, align 1 - // CHECK-NEXT: %[[EQ:.+]] = icmp eq i32 %[[LOAD]], 0 - // CHECK-NEXT: ret i1 %[[EQ]] - &data[..] == [0; 4] -} - -// CHECK-LABEL: @is_zero_array -#[no_mangle] -pub fn is_zero_array(data: &[u8; 4]) -> bool { - // CHECK: %[[LOAD:.+]] = load i32, {{i32\*|ptr}} %{{.+}}, align 1 - // CHECK-NEXT: %[[EQ:.+]] = icmp eq i32 %[[LOAD]], 0 - // CHECK-NEXT: ret i1 %[[EQ]] - *data == [0; 4] -} |
