SPARC: Implement TRAP lowering. Matches what GCC emits.

llvm-svn: 201994
This commit is contained in:
Benjamin Kramer 2014-02-23 21:43:52 +00:00
parent 686f45ad24
commit bb5b968592
3 changed files with 16 additions and 0 deletions

View File

@ -1567,6 +1567,8 @@ SparcTargetLowering::SparcTargetLowering(TargetMachine &TM)
// VAARG needs to be lowered to not do unaligned accesses for doubles.
setOperationAction(ISD::VAARG , MVT::Other, Custom);
setOperationAction(ISD::TRAP , MVT::Other, Legal);
// Use the default implementation.
setOperationAction(ISD::VACOPY , MVT::Other, Expand);
setOperationAction(ISD::VAEND , MVT::Other, Expand);

View File

@ -312,6 +312,9 @@ let hasSideEffects = 1, mayStore = 1 in {
[(flushw)]>;
}
let isBarrier = 1, isTerminator = 1, rd = 0b1000, rs1 = 0, simm13 = 5 in
def TA5 : F3_2<0b10, 0b111010, (outs), (ins), "ta 5", [(trap)]>;
let rd = 0 in
def UNIMP : F2_1<0b000, (outs), (ins i32imm:$val),
"unimp $val", []>;

View File

@ -0,0 +1,11 @@
; RUN: llc -mtriple=sparc-linux-gnu < %s -show-mc-encoding | FileCheck %s
define void @test1() {
tail call void @llvm.trap()
unreachable
; CHECK-LABEL: test1:
; CHECK: ta 5 ! encoding: [0x91,0xd0,0x20,0x05]
}
declare void @llvm.trap()