How to check at runtime whether the CPU supports RTM in gcc/clang(++) or inline assembly?

329 Views Asked by At

It seems I can annotate a function with __attribute__((target("rtm"))) (at least in clang), but I cannot check for RTM (Restricted Transactional Memory) presence at runtime:

useRTM_ = __builtin_cpu_supports("rtm");

gives a compiler error:

error: invalid cpu feature string for builtin useRTM_ = __builtin_cpu_supports("rtm");

I can't find anything here for TSX and for RTM there is only a flag to enable it in the whole codebase: -mrtm.

Can you please tell me how to check for the presence of RTM at runtime? Inline assembly is fine.

0

There are 0 best solutions below