]> granicus.if.org Git - llvm/commitdiff
[PowerPC][HTM]Fix $zero is not a GPRC register for builtin_ttest
authorJinsong Ji <jji@us.ibm.com>
Mon, 10 Jun 2019 19:04:14 +0000 (19:04 +0000)
committerJinsong Ji <jji@us.ibm.com>
Mon, 10 Jun 2019 19:04:14 +0000 (19:04 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362974 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCInstrHTM.td
test/CodeGen/PowerPC/htm.ll

index 7a07b4259150b1e464e6cafe97883889f12d72ac..f35f37d127ff4676871e6e1bbc07d1e1d506b5df 100644 (file)
@@ -166,6 +166,6 @@ def : Pat<(int_ppc_tsuspend),
           (TSR 0)>;
 
 def : Pat<(i64 (int_ppc_ttest)),
-          (RLDICL (i64 (COPY (TABORTWCI 0, ZERO, 0))), 36, 28)>;
+          (RLDICL (i64 (COPY (TABORTWCI 0, (LI 0), 0))), 36, 28)>;
 
 } // [HasHTM]
index 1f3be614bab0961aefddcd61bcb811715fbb85c9..cd91720d4d25045834f52536f6eea4262f07e257 100644 (file)
@@ -57,16 +57,19 @@ entry:
   %0 = tail call i32 @llvm.ppc.tendall()
   %1 = tail call i32 @llvm.ppc.tresume()
   %2 = tail call i32 @llvm.ppc.tsuspend()
+  %3 = tail call i64 @llvm.ppc.ttest()
   ret void
 ; CHECK-LABEL: @test4
 ; CHECK: tend. 1
 ; CHECK: tsr.  1
 ; CHECK: tsr.  0
+; CHECK: tabortwci. 0, {{[0-9]+}}, 0
 }
 
 declare i32 @llvm.ppc.tendall()
 declare i32 @llvm.ppc.tresume()
 declare i32 @llvm.ppc.tsuspend()
+declare i64 @llvm.ppc.ttest()
 
 
 define void @test5(i64 %v) {