diff options
| author | sayantn <sayantn05@gmail.com> | 2025-05-28 02:08:46 +0530 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2025-05-30 18:02:17 +0000 |
| commit | 3de76d47a23eda3fe6a79155bca1f16bfd16f928 (patch) | |
| tree | 2e4c28d81768fcce090f36bf1210c7c42fb6ca73 | |
| parent | 28960ece722bf84e4c84a93b0855d588f7109667 (diff) | |
| download | rust-3de76d47a23eda3fe6a79155bca1f16bfd16f928.tar.gz rust-3de76d47a23eda3fe6a79155bca1f16bfd16f928.zip | |
Use the new definition of `rdtscp` intrinsic
- add `-Zverify-llvm-ir` in testsuite
| -rwxr-xr-x | library/stdarch/ci/run.sh | 2 | ||||
| -rw-r--r-- | library/stdarch/crates/core_arch/src/x86/rdtsc.rs | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/library/stdarch/ci/run.sh b/library/stdarch/ci/run.sh index fd7ec81d505..8eadb9285c9 100755 --- a/library/stdarch/ci/run.sh +++ b/library/stdarch/ci/run.sh @@ -10,7 +10,7 @@ set -ex #export RUST_TEST_NOCAPTURE=1 #export RUST_TEST_THREADS=1 -export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled " +export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir" export HOST_RUSTFLAGS="${RUSTFLAGS}" export PROFILE="${PROFILE:="--profile=release"}" diff --git a/library/stdarch/crates/core_arch/src/x86/rdtsc.rs b/library/stdarch/crates/core_arch/src/x86/rdtsc.rs index e714aa863b9..3b348153d60 100644 --- a/library/stdarch/crates/core_arch/src/x86/rdtsc.rs +++ b/library/stdarch/crates/core_arch/src/x86/rdtsc.rs @@ -46,15 +46,17 @@ pub unsafe fn _rdtsc() -> u64 { #[cfg_attr(test, assert_instr(rdtscp))] #[stable(feature = "simd_x86", since = "1.27.0")] pub unsafe fn __rdtscp(aux: *mut u32) -> u64 { - rdtscp(aux as *mut _) + let (tsc, auxval) = rdtscp(); + *aux = auxval; + tsc } #[allow(improper_ctypes)] -unsafe extern "C" { +unsafe extern "unadjusted" { #[link_name = "llvm.x86.rdtsc"] fn rdtsc() -> u64; #[link_name = "llvm.x86.rdtscp"] - fn rdtscp(aux: *mut u8) -> u64; + fn rdtscp() -> (u64, u32); } #[cfg(test)] |
