snmalloc icon indicating copy to clipboard operation
snmalloc copied to clipboard

__builtin_readcyclecounter broken on mac arm64

Open devnexen opened this issue 2 years ago • 2 comments

image disabling this particular builtin rather than disabling all seems enough to fix the tests.

devnexen avatar Feb 28 '23 21:02 devnexen

https://reviews.llvm.org/D136999 probably fixes this (and avoids getting nonsense deltas when bouncing between cores)

jrtc27 avatar Sep 06 '23 06:09 jrtc27

Thanks @jrtc27. It looks as if that hasn't yet been merged into Apple's version of LLVM (Apple Clang 14.0.3 is based on upstream clang 15.0.0 and still emits mrs x0, PMCCNTR_EL0 for this builtin). It's a bit annoying that clang doesn't provide pre-defined macros for bug fixes, because the conditional for version matching between Apple and upstream clang versions here would be quite complex.

@mjp41, it looks as if the builtin is inlined but the method with the inline assembly isn't, so we probably want to slap an ALWAYSINLINE on it (inlining a single-instruction method is always the right choice, but I think LLVM's cost function doesn't count the size of assembly blocks).

davidchisnall avatar Sep 06 '23 07:09 davidchisnall