Skip to content

Commit 1b201ce

Browse files
sayantnAmanieu
authored andcommitted
Use the new definition of rdtscp intrinsic
- add `-Zverify-llvm-ir` in testsuite
1 parent 0035d22 commit 1b201ce

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ci/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -ex
1010
#export RUST_TEST_NOCAPTURE=1
1111
#export RUST_TEST_THREADS=1
1212

13-
export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled "
13+
export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir"
1414
export HOST_RUSTFLAGS="${RUSTFLAGS}"
1515
export PROFILE="${PROFILE:="--profile=release"}"
1616

crates/core_arch/src/x86/rdtsc.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ pub unsafe fn _rdtsc() -> u64 {
4646
#[cfg_attr(test, assert_instr(rdtscp))]
4747
#[stable(feature = "simd_x86", since = "1.27.0")]
4848
pub unsafe fn __rdtscp(aux: *mut u32) -> u64 {
49-
rdtscp(aux as *mut _)
49+
let (tsc, auxval) = rdtscp();
50+
*aux = auxval;
51+
tsc
5052
}
5153

5254
#[allow(improper_ctypes)]
53-
unsafe extern "C" {
55+
unsafe extern "unadjusted" {
5456
#[link_name = "llvm.x86.rdtsc"]
5557
fn rdtsc() -> u64;
5658
#[link_name = "llvm.x86.rdtscp"]
57-
fn rdtscp(aux: *mut u8) -> u64;
59+
fn rdtscp() -> (u64, u32);
5860
}
5961

6062
#[cfg(test)]

0 commit comments

Comments
 (0)