about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorMarkus Reiter <me@reitermark.us>2024-05-17 21:45:30 +0200
committerMarkus Reiter <me@reitermark.us>2024-07-21 18:21:33 +0200
commit45b87fb401fe8a4bdbd97f1c5f47ba4ad8e23923 (patch)
tree73537ce61c7460f4e12245da1021d2237dc585ab /tests/codegen
parent64fb903c95f11dbab910a64316d1fcf478342bb6 (diff)
downloadrust-45b87fb401fe8a4bdbd97f1c5f47ba4ad8e23923.tar.gz
rust-45b87fb401fe8a4bdbd97f1c5f47ba4ad8e23923.zip
Simplify test.
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/cast-optimized.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/codegen/cast-optimized.rs b/tests/codegen/cast-optimized.rs
index aa89b12f87f..1c8687923d0 100644
--- a/tests/codegen/cast-optimized.rs
+++ b/tests/codegen/cast-optimized.rs
@@ -6,10 +6,10 @@
 
 // CHECK-LABEL: @u32_index
 #[no_mangle]
-pub fn u32_index(c: u32) -> [bool; 10] {
-    let mut array = [false; 10];
+pub fn u32_index(c: u32) -> [bool; 21] {
+    let mut array = [false; 21];
 
-    let index = (c | 1).leading_zeros() as usize / 4 - 2;
+    let index = c.ilog2();
 
     // CHECK: call core::panicking::panic
     array[index as usize] = true;
@@ -19,12 +19,14 @@ pub fn u32_index(c: u32) -> [bool; 10] {
 
 // CHECK-LABEL: @char_as_u32_index
 #[no_mangle]
-pub fn char_as_u32_index(c: char) -> [bool; 10] {
+pub fn char_as_u32_index(c: char) -> [bool; 21] {
+    // CHECK: %[[B:.+]] = icmp ult i32 %c, 1114112
+    // CHECK: call void @llvm.assume(i1 %[[B]])
     let c = c as u32;
 
-    let mut array = [false; 10];
+    let mut array = [false; 21];
 
-    let index = (c | 1).leading_zeros() as usize / 4 - 2;
+    let index = c.ilog2();
 
     // CHECK-NOT: call core::panicking::panic
     array[index as usize] = true;