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:06 PM.

Details

Summary

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
switch.

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

Changes from previous version (v2):

  • Fixed testcase register checks.

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.
  • Added PowerPC HTM High Level Inline Functions header (htmxlintrin.h).

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 21619.Mar 10 2015, 1:06 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:13 PM

I have just one nit inline for this one.

lib/Target/PowerPC/PPC.td
122

"Transactional", please.

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:49 AM
zatrazz edited edge metadata.

I will update with a full context and lib/Target/PowerPC/PPC.td changes.