Skip to content

Instantly share code, notes, and snippets.

@auroranockert
Created September 23, 2013 02:22
Show Gist options
  • Save auroranockert/6665784 to your computer and use it in GitHub Desktop.
Save auroranockert/6665784 to your computer and use it in GitHub Desktop.
llvm!(extern {
ir "declare i64 @llvm.readcyclecounter()";
fn readcyclecounter() -> i64 {
"%result = call i64 @llvm.readcyclecounter()
ret i64 %result"
}
})
#[fixed_stack_segment]
fn main() {
printfln!("readcyclecounter() is: %?", unsafe { readcyclecounter() });
}
@auroranockert
Copy link
Author

Printed "readcyclecounter() is: 45517937890680i64" on my computer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment