]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/patches/patch-r262415-llvm-r201994-sparc.diff
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / patches / patch-r262415-llvm-r201994-sparc.diff
1 Pull in r201994 from upstream llvm trunk (by Benjamin Kramer):
2
3   SPARC: Implement TRAP lowering. Matches what GCC emits.
4
5 Introduced here: http://svnweb.freebsd.org/changeset/base/262415
6
7 Index: lib/Target/Sparc/SparcInstrInfo.td
8 ===================================================================
9 --- lib/Target/Sparc/SparcInstrInfo.td
10 +++ lib/Target/Sparc/SparcInstrInfo.td
11 @@ -312,6 +312,9 @@ let hasSideEffects = 1, mayStore = 1 in {
12                     [(flushw)]>;
13  }
14  
15 +let isBarrier = 1, isTerminator = 1, rd = 0b1000, rs1 = 0, simm13 = 5 in
16 +  def TA5 : F3_2<0b10, 0b111010, (outs), (ins), "ta 5", [(trap)]>;
17 +
18  let rd = 0 in
19    def UNIMP : F2_1<0b000, (outs), (ins i32imm:$val),
20                    "unimp $val", []>;
21 Index: lib/Target/Sparc/SparcISelLowering.cpp
22 ===================================================================
23 --- lib/Target/Sparc/SparcISelLowering.cpp
24 +++ lib/Target/Sparc/SparcISelLowering.cpp
25 @@ -1565,6 +1565,8 @@ SparcTargetLowering::SparcTargetLowering(TargetMac
26    // VAARG needs to be lowered to not do unaligned accesses for doubles.
27    setOperationAction(ISD::VAARG             , MVT::Other, Custom);
28  
29 +  setOperationAction(ISD::TRAP              , MVT::Other, Legal);
30 +
31    // Use the default implementation.
32    setOperationAction(ISD::VACOPY            , MVT::Other, Expand);
33    setOperationAction(ISD::VAEND             , MVT::Other, Expand);
34 Index: test/CodeGen/SPARC/trap.ll
35 ===================================================================
36 --- test/CodeGen/SPARC/trap.ll
37 +++ test/CodeGen/SPARC/trap.ll
38 @@ -0,0 +1,11 @@
39 +; RUN: llc -mtriple=sparc-linux-gnu < %s -show-mc-encoding | FileCheck %s
40 +
41 +define void @test1() {
42 +  tail call void @llvm.trap()
43 +  unreachable
44 +
45 +; CHECK-LABEL: test1:
46 +; CHECK: ta 5 ! encoding: [0x91,0xd0,0x20,0x05]
47 +}
48 +
49 +declare void @llvm.trap()