llvm-6502/test/MC/PowerPC/htm.s
Kit Barton bd9a548881 Add Hardware Transactional Memory (HTM) Support
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

Phabricator Review: http://reviews.llvm.org/D8247


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 19:36:23 +00:00

54 lines
2.8 KiB
ArmAsm

# RUN: llvm-mc -triple powerpc64-unknown-linux-gnu --show-encoding %s | FileCheck -check-prefix=CHECK-BE %s
# RUN: llvm-mc -triple powerpc64le-unknown-linux-gnu --show-encoding %s | FileCheck -check-prefix=CHECK-LE %s
# CHECK-BE: tbegin. 0 # encoding: [0x7c,0x00,0x05,0x1d]
# CHECK-LE: tbegin. 0 # encoding: [0x1d,0x05,0x00,0x7c]
tbegin. 0
# CHECK-BE: tbegin. 1 # encoding: [0x7c,0x20,0x05,0x1d]
# CHECK-LE: tbegin. 1 # encoding: [0x1d,0x05,0x20,0x7c]
tbegin. 1
# CHECK-BE: tend. 0 # encoding: [0x7c,0x00,0x05,0x5d]
# CHECK-LE: tend. 0 # encoding: [0x5d,0x05,0x00,0x7c]
tend. 0
# CHECK-BE: tend. 1 # encoding: [0x7e,0x00,0x05,0x5d]
# CHECK-LE: tend. 1 # encoding: [0x5d,0x05,0x00,0x7e]
tend. 1
# CHECK-BE: tabort. 9 # encoding: [0x7c,0x09,0x07,0x1d]
# CHECK-LE: tabort. 9 # encoding: [0x1d,0x07,0x09,0x7c]
tabort. 9
# CHECK-BE: tabortdc. 0, 9, 9 # encoding: [0x7c,0x09,0x4e,0x5d]
# CHECK-LE: tabortdc. 0, 9, 9 # encoding: [0x5d,0x4e,0x09,0x7c]
tabortdc. 0, 9, 9
# CHECK-BE: tabortdci. 0, 9, 0 # encoding: [0x7c,0x09,0x06,0xdd]
# CHECK-LE: tabortdci. 0, 9, 0 # encoding: [0xdd,0x06,0x09,0x7c]
tabortdci. 0, 9, 0
# CHECK-BE: tabortwc. 0, 9, 9 # encoding: [0x7c,0x09,0x4e,0x1d]
# CHECK-LE: tabortwc. 0, 9, 9 # encoding: [0x1d,0x4e,0x09,0x7c]
tabortwc. 0, 9, 9
# CHECK-BE: tabortwci. 0, 9, 0 # encoding: [0x7c,0x09,0x06,0x9d]
# CHECK-LE: tabortwci. 0, 9, 0 # encoding: [0x9d,0x06,0x09,0x7c]
tabortwci. 0, 9, 0
# CHECK-BE: tsr. 0 # encoding: [0x7c,0x00,0x05,0xdd]
# CHECK-LE: tsr. 0 # encoding: [0xdd,0x05,0x00,0x7c]
tsr. 0
# CHECK-BE: tsr. 1 # encoding: [0x7c,0x20,0x05,0xdd]
# CHECK-LE: tsr. 1 # encoding: [0xdd,0x05,0x20,0x7c]
tsr. 1
# CHECK-BE: tcheck 0 # encoding: [0x7c,0x00,0x05,0x9c]
# CHECK-LE: tcheck 0 # encoding: [0x9c,0x05,0x00,0x7c]
tcheck 0
# CHECK-BE: tcheck 3 # encoding: [0x7d,0x80,0x05,0x9c]
# CHECK-LE: tcheck 3 # encoding: [0x9c,0x05,0x80,0x7d]
tcheck 3
# CHECK-BE: treclaim. 9 # encoding: [0x7c,0x09,0x07,0x5d]
# CHECK-LE: treclaim. 9 # encoding: [0x5d,0x07,0x09,0x7c]
treclaim. 9
# CHECK-BE: trechkpt. # encoding: [0x7c,0x00,0x07,0xdd]
# CHECK-LE: trechkpt. # encoding: [0xdd,0x07,0x00,0x7c]
trechkpt.