diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-07-21 14:34:12 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-07-22 14:28:48 +0200 |
| commit | a27f3e3fd1e4d16160f8885b6b06665b5319f56c (patch) | |
| tree | b033935392cbadf6f85d2dbddf433a88e323aeeb /tests/codegen/hint/unlikely.rs | |
| parent | ed93c1783b404d728d4809973a0550eb33cd293f (diff) | |
| download | rust-a27f3e3fd1e4d16160f8885b6b06665b5319f56c.tar.gz rust-a27f3e3fd1e4d16160f8885b6b06665b5319f56c.zip | |
Rename `tests/codegen` into `tests/codegen-llvm`
Diffstat (limited to 'tests/codegen/hint/unlikely.rs')
| -rw-r--r-- | tests/codegen/hint/unlikely.rs | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/tests/codegen/hint/unlikely.rs b/tests/codegen/hint/unlikely.rs deleted file mode 100644 index 248b1e2537e..00000000000 --- a/tests/codegen/hint/unlikely.rs +++ /dev/null @@ -1,80 +0,0 @@ -//@ compile-flags: -Copt-level=3 -#![crate_type = "lib"] -#![feature(likely_unlikely)] - -use std::hint::unlikely; - -#[inline(never)] -#[no_mangle] -pub fn path_a() { - println!("path a"); -} - -#[inline(never)] -#[no_mangle] -pub fn path_b() { - println!("path b"); -} - -#[no_mangle] -pub fn test1(x: bool) { - if unlikely(x) { - path_a(); - } else { - path_b(); - } - - // CHECK-LABEL: @test1( - // CHECK: br i1 %x, label %bb2, label %bb4, !prof ![[NUM:[0-9]+]] - // CHECK: bb4: - // CHECK: path_b - // CHECK: bb2: - // CHECK: path_a -} - -#[no_mangle] -pub fn test2(x: i32) { - match unlikely(x > 0) { - true => path_a(), - false => path_b(), - } - - // CHECK-LABEL: @test2( - // CHECK: br i1 %_2, label %bb2, label %bb4, !prof ![[NUM]] - // CHECK: bb4: - // CHECK: path_b - // CHECK: bb2: - // CHECK: path_a -} - -#[no_mangle] -pub fn test3(x: i8) { - match unlikely(x < 7) { - true => path_a(), - _ => path_b(), - } - - // CHECK-LABEL: @test3( - // CHECK: br i1 %_2, label %bb2, label %bb4, !prof ![[NUM]] - // CHECK: bb4: - // CHECK: path_b - // CHECK: bb2: - // CHECK: path_a -} - -#[no_mangle] -pub fn test4(x: u64) { - match unlikely(x != 33) { - false => path_a(), - _ => path_b(), - } - - // CHECK-LABEL: @test4( - // CHECK: br i1 %0, label %bb4, label %bb2, !prof ![[NUM2:[0-9]+]] - // CHECK: bb4: - // CHECK: path_a - // CHECK: bb2: - // CHECK: path_b -} - -// CHECK: ![[NUM]] = !{!"branch_weights", {{(!"expected", )?}}i32 1, i32 2000} |
