This is an archive of the discontinued LLVM Phabricator instance.

[PATCH v3] [PowerPC] Add Hardware Transaction Memory builtins support
AbandonedPublic

Authored by zatrazz on Mar 10 2015, 1:09 PM.

Details

Summary

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.

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 21620.Mar 10 2015, 1:09 PM
zatrazz retitled this revision from to [PATCH v3] [PowerPC] Add Hardware Transaction Memory builtins support.
zatrazz updated this object.
zatrazz edited the test plan for this revision. (Show Details)
zatrazz added a subscriber: Unknown Object (MLST).
wschmidt edited edge metadata.Mar 10 2015, 2:08 PM

One inline comment. I have not checked the two header files in detail, but I assume you have worked with bergner on those.

lib/CodeGen/CGBuiltin.cpp
6406

This error message is still wrong for BI__builtin_tsr.

hfinkel edited edge metadata.Mar 11 2015, 12:34 AM

Please upload this patch with full context, see: http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface for instructions.

zatrazz abandoned this revision.Mar 11 2015, 4:53 AM

I will update with full context and with correct patch.