This is an archive of the discontinued LLVM Phabricator instance.

[PATCH v4] [PowerPC] Add Hardware Transaction Memory builtins support
ClosedPublic

Authored by zatrazz on Mar 11 2015, 4:56 AM.

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], but
currently only the 'PowerPC HTM Low Level Built-in Function' are
implemented.

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 (v3):

  • Transaction -> Transactional on HTM description.

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 21686.Mar 11 2015, 4:56 AM
zatrazz retitled this revision from to [PATCH v4] [PowerPC] Add Hardware Transaction Memory builtins support.
zatrazz updated this object.
zatrazz edited the test plan for this revision. (Show Details)
zatrazz added reviewers: hfinkel, kbarton, nemanjai, wschmidt.
zatrazz added a subscriber: Unknown Object (MLST).
wschmidt accepted this revision.Mar 19 2015, 1:14 PM
wschmidt edited edge metadata.

LGTM, with one minor nit that you can "take under advisement." Hal, any concerns?

test/CodeGen/PowerPC/htm.ll
80

From here to the end, all of these could be {{[0-9]+}} since the named value is not reused. Not a big deal, but a good habit to be in. Changing this is optional, patch looks fine otherwise.

This revision is now accepted and ready to land.Mar 19 2015, 1:14 PM
kbarton closed this revision.Mar 25 2015, 12:39 PM
kbarton edited edge metadata.

Committed revision 233204.