Skip to content

Commit 9c7f93e

Browse files
author
Jinsong Ji
committed
[PowerPC][HTM]Fix $zero is not a GPRC register for builtin_ttest
This was found during HTM cleanup. Adding a test for builtin_ttest would expose following issue. *** Bad machine code: Illegal physical register for instruction *** - function: test10 - basic block: %bb.0 entry (0xf0e57497b58) - instruction: %5:crrc0 = TABORTWCI 0, $zero, 0 - operand 2: $zero $zero is not a GPRC register. LLVM ERROR: Found 1 machine code errors. Differential Revision: https://reviews.llvm.org/D63079 llvm-svn: 362974
1 parent f8f9d65 commit 9c7f93e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

llvm/lib/Target/PowerPC/PPCInstrHTM.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,6 @@ def : Pat<(int_ppc_tsuspend),
166166
(TSR 0)>;
167167

168168
def : Pat<(i64 (int_ppc_ttest)),
169-
(RLDICL (i64 (COPY (TABORTWCI 0, ZERO, 0))), 36, 28)>;
169+
(RLDICL (i64 (COPY (TABORTWCI 0, (LI 0), 0))), 36, 28)>;
170170

171171
} // [HasHTM]

llvm/test/CodeGen/PowerPC/htm.ll

+3
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,19 @@ entry:
5757
%0 = tail call i32 @llvm.ppc.tendall()
5858
%1 = tail call i32 @llvm.ppc.tresume()
5959
%2 = tail call i32 @llvm.ppc.tsuspend()
60+
%3 = tail call i64 @llvm.ppc.ttest()
6061
ret void
6162
; CHECK-LABEL: @test4
6263
; CHECK: tend. 1
6364
; CHECK: tsr. 1
6465
; CHECK: tsr. 0
66+
; CHECK: tabortwci. 0, {{[0-9]+}}, 0
6567
}
6668

6769
declare i32 @llvm.ppc.tendall()
6870
declare i32 @llvm.ppc.tresume()
6971
declare i32 @llvm.ppc.tsuspend()
72+
declare i64 @llvm.ppc.ttest()
7073

7174

7275
define void @test5(i64 %v) {

0 commit comments

Comments
 (0)