1 ; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mattr=+htm < %s | FileCheck %s
2 target datalayout = "E-m:e-i64:64-n32:64"
3 target triple = "powerpc64-unknown-linux-gnu"
5 define zeroext i32 @test1() {
7 %0 = tail call i32 @llvm.ppc.tbegin(i32 0)
12 ; CHECK: mfocrf [[REGISTER1:[0-9]+]], 128
13 ; CHECK: rlwinm [[REGISTER2:[0-9]+]], [[REGISTER1]], 3, 31, 31
14 ; CHECK: xori {{[0-9]+}}, [[REGISTER2]], 1
17 declare i32 @llvm.ppc.tbegin(i32) #1
20 define zeroext i32 @test2() {
22 %0 = tail call i32 @llvm.ppc.tend(i32 0)
26 ; CHECK: mfocrf {{[0-9]+}}, 128
29 declare i32 @llvm.ppc.tend(i32)
32 define void @test3() {
34 %0 = tail call i32 @llvm.ppc.tabort(i32 0)
35 %1 = tail call i32 @llvm.ppc.tabortdc(i32 0, i32 1, i32 2)
36 %2 = tail call i32 @llvm.ppc.tabortdci(i32 0, i32 1, i32 2)
37 %3 = tail call i32 @llvm.ppc.tabortwc(i32 0, i32 1, i32 2)
38 %4 = tail call i32 @llvm.ppc.tabortwci(i32 0, i32 1, i32 2)
41 ; CHECK: tabort. {{[0-9]+}}
42 ; CHECK: tabortdc. 0, {{[0-9]+}}, {{[0-9]+}}
43 ; CHECK: tabortdci. 0, {{[0-9]+}}, 2
44 ; CHECK: tabortwc. 0, {{[0-9]+}}, {{[0-9]+}}
45 ; CHECK: tabortwci. 0, {{[0-9]+}}, 2
48 declare i32 @llvm.ppc.tabort(i32)
49 declare i32 @llvm.ppc.tabortdc(i32, i32, i32)
50 declare i32 @llvm.ppc.tabortdci(i32, i32, i32)
51 declare i32 @llvm.ppc.tabortwc(i32, i32, i32)
52 declare i32 @llvm.ppc.tabortwci(i32, i32, i32)
55 define void @test4() {
57 %0 = tail call i32 @llvm.ppc.tendall()
58 %1 = tail call i32 @llvm.ppc.tresume()
59 %2 = tail call i32 @llvm.ppc.tsuspend()
60 %3 = tail call i64 @llvm.ppc.ttest()
66 ; CHECK: tabortwci. 0, {{[0-9]+}}, 0
69 declare i32 @llvm.ppc.tendall()
70 declare i32 @llvm.ppc.tresume()
71 declare i32 @llvm.ppc.tsuspend()
72 declare i64 @llvm.ppc.ttest()
75 define void @test5(i64 %v) {
77 tail call void @llvm.ppc.set.texasr(i64 %v)
78 tail call void @llvm.ppc.set.texasru(i64 %v)
79 tail call void @llvm.ppc.set.tfhar(i64 %v)
80 tail call void @llvm.ppc.set.tfiar(i64 %v)
83 ; CHECK: mtspr 130, [[REG1:[0-9]+]]
84 ; CHECK: mtspr 131, [[REG2:[0-9]+]]
85 ; CHECK: mtspr 128, [[REG3:[0-9]+]]
86 ; CHECK: mtspr 129, [[REG4:[0-9]+]]
91 %0 = tail call i64 @llvm.ppc.get.texasr()
94 ; CHECK: mfspr [[REG1:[0-9]+]], 130
99 %0 = tail call i64 @llvm.ppc.get.texasru()
101 ; CHECK-LABEL: @test7
102 ; CHECK: mfspr [[REG1:[0-9]+]], 131
105 define i64 @test8() {
107 %0 = tail call i64 @llvm.ppc.get.tfhar()
109 ; CHECK-LABEL: @test8
110 ; CHECK: mfspr [[REG1:[0-9]+]], 128
113 define i64 @test9() {
115 %0 = tail call i64 @llvm.ppc.get.tfiar()
117 ; CHECK-LABEL: @test9
118 ; CHECK: mfspr [[REG1:[0-9]+]], 129
121 declare void @llvm.ppc.set.texasr(i64)
122 declare void @llvm.ppc.set.texasru(i64)
123 declare void @llvm.ppc.set.tfhar(i64)
124 declare void @llvm.ppc.set.tfiar(i64)
125 declare i64 @llvm.ppc.get.texasr()
126 declare i64 @llvm.ppc.get.texasru()
127 declare i64 @llvm.ppc.get.tfhar()
128 declare i64 @llvm.ppc.get.tfiar()
130 define void @test10() {
132 %0 = tail call i32 @llvm.ppc.tcheck()
133 %1 = tail call i32 @llvm.ppc.treclaim(i32 5)
134 %2 = tail call i32 @llvm.ppc.trechkpt()
135 %3 = tail call i32 @llvm.ppc.tsr(i32 1)
137 ; CHECK-LABEL: @test10
138 ; CHECK: tcheck [[REG1:[0-9]+]]
139 ; CHECK: treclaim. [[REG2:[0-9]+]]
144 declare i32 @llvm.ppc.tcheck()
145 declare i32 @llvm.ppc.treclaim(i32)
146 declare i32 @llvm.ppc.trechkpt()
147 declare i32 @llvm.ppc.tsr(i32)