This patch adds Hardware Transaction Memory (HTM) support supported by
ISA 2.07 (POWER8). The intrinsic support is based on GCC one [1], with
both 'PowerPC HTM Low Level Built-in Functions' and 'PowerPC HTM High
Level Inline Functions' implemented.
Along with builtins a new driver switch is added to enable/disable HTM
instruction support (-mhtm) and a header with common definitions (mostly
to parse the TFHAR register value). The HTM switch also sets a
preprocessor builtin HTM.
The HTM usage requires a recently newer kernel with PPC HTM enabled.
Tested on powerpc64 and powerpc64le.
This is send along a llvm patch to enabled the builtins and option
switch.
[1] https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html
From previous interactions, there is no need to check for negative values for
some builtins because ConstantInt::getZExtValue() returns an unsigned value.
Changes from previous version (v2):
- Fixed the error message for tsr builtin
Changes from previous version (v1):
- 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.
- The return value for builtin_tend, builtin_tabort* has changed to return the full 4-bit CR value as its return value (similar to the built_ttest). The builtin_tbegin continue to return 0 or 1 as previous patch.
This error message is still wrong for BI__builtin_tsr.