[PATCH v2] [PowerPC] Add Hardware Transaction Memory builtins support

Adhemerval Zanella azanella at linux.vnet.ibm.com
Thu Mar 5 10:17:31 PST 2015

This patch adds Hardware Transaction Memory (HTM) support supported by
ISA 2.07 (POWER8).

The HTM instructions follows the RC ones and the transaction initiation
result is set on RC0 (with exception of tcheck).  Currently approach is
to create a register copy from CR0 to GPR and comapring.  Although this
is suboptimal, since the branch could be taken directly by comparing
the CR0 value, it generates code correctly on both test and branch and
just return value.  A possible future optimization could be elimitate
the MFCR instruction to branch directly.

The HTM usage requires a recently newer kernel with PPC HTM enabled.
Tested on powerpc64 and powerpc64le.

This is send along a clang patch to enabled the builtins and option

[1] https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html


Changes from previous version:

- Fixed grammatical error raised by Will Schmidt
- Change __builtin_tcheck signature to no accept any arguments.  The CR fiels
  will be selected by the backend and the result will be adjusted accordingly.
- Added PowerPC HTM High Level Inline Functions header (htmxlintrin.h).


More information about the llvm-commits mailing list