[llvm] r337236 - [Sparc] Do not depend on icc for ta 1

Daniel Cederman via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 16 22:49:33 PDT 2018


Author: dcederman
Date: Mon Jul 16 22:49:33 2018
New Revision: 337236

URL: http://llvm.org/viewvc/llvm-project?rev=337236&view=rev
Log:
[Sparc] Do not depend on icc for ta 1

The ta instruction will always trap, regardless of the value
of the integer condition codes. TRAPri is marked as using icc,
so we cannot use a pattern for TRAPri to implement ta 1, as
verify-machineinstrs can complain that icc is not defined.
Instead we implement ta 1 the same way as ta 5.

Modified:
    llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
    llvm/trunk/test/CodeGen/SPARC/trap.ll

Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td?rev=337236&r1=337235&r2=337236&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td Mon Jul 16 22:49:33 2018
@@ -1009,8 +1009,8 @@ let DecoderNamespace = "SparcV9", Decode
 let isBarrier = 1, isTerminator = 1, rd = 0b01000, rs1 = 0, simm13 = 5 in
   def TA5 : F3_2<0b10, 0b111010, (outs), (ins), "ta 5", [(trap)]>;
 
-def : Pat<(debugtrap),
-  (TRAPri (i32 G0), (i32 1), (i32 8))>;
+let hasSideEffects = 1, rd = 0b01000, rs1 = 0, simm13 = 1 in
+  def TA1 : F3_2<0b10, 0b111010, (outs), (ins), "ta 1", [(debugtrap)]>;
 
 // Section B.28 - Read State Register Instructions
 let rs2 = 0 in

Modified: llvm/trunk/test/CodeGen/SPARC/trap.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/trap.ll?rev=337236&r1=337235&r2=337236&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SPARC/trap.ll (original)
+++ llvm/trunk/test/CodeGen/SPARC/trap.ll Mon Jul 16 22:49:33 2018
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=sparc-linux-gnu < %s -show-mc-encoding | FileCheck %s
+; RUN: llc -mtriple=sparc-linux-gnu < %s -show-mc-encoding -verify-machineinstrs | FileCheck %s
 
 define void @test1() {
   tail call void @llvm.trap()




More information about the llvm-commits mailing list