]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/patches/patch-r262261-llvm-r200141-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-r262261-llvm-r200141-sparc.diff
1 Pull in r200141 from upstream llvm trunk (by Jakob Stoklund Olesen):
2
3   Clean up the Legal/Expand logic for SPARC popc.
4
5 Introduced here: http://svnweb.freebsd.org/changeset/base/262261
6
7 Index: lib/Target/Sparc/SparcSubtarget.cpp
8 ===================================================================
9 --- lib/Target/Sparc/SparcSubtarget.cpp
10 +++ lib/Target/Sparc/SparcSubtarget.cpp
11 @@ -41,6 +41,10 @@ SparcSubtarget::SparcSubtarget(const std::string &
12  
13    // Parse features string.
14    ParseSubtargetFeatures(CPUName, FS);
15 +
16 +  // Popc is a v9-only instruction.
17 +  if (!IsV9)
18 +    UsePopc = false;
19  }
20  
21  
22 Index: lib/Target/Sparc/SparcISelLowering.cpp
23 ===================================================================
24 --- lib/Target/Sparc/SparcISelLowering.cpp
25 +++ lib/Target/Sparc/SparcISelLowering.cpp
26 @@ -1461,8 +1461,8 @@ SparcTargetLowering::SparcTargetLowering(TargetMac
27      setOperationAction(ISD::BR_CC, MVT::i64, Custom);
28      setOperationAction(ISD::SELECT_CC, MVT::i64, Custom);
29  
30 -    if (Subtarget->usePopc())
31 -      setOperationAction(ISD::CTPOP, MVT::i64, Legal);
32 +    setOperationAction(ISD::CTPOP, MVT::i64,
33 +                       Subtarget->usePopc() ? Legal : Expand);
34      setOperationAction(ISD::CTTZ , MVT::i64, Expand);
35      setOperationAction(ISD::CTTZ_ZERO_UNDEF, MVT::i64, Expand);
36      setOperationAction(ISD::CTLZ , MVT::i64, Expand);
37 @@ -1518,7 +1518,6 @@ SparcTargetLowering::SparcTargetLowering(TargetMac
38    setOperationAction(ISD::FSINCOS, MVT::f32, Expand);
39    setOperationAction(ISD::FREM , MVT::f32, Expand);
40    setOperationAction(ISD::FMA  , MVT::f32, Expand);
41 -  setOperationAction(ISD::CTPOP, MVT::i32, Expand);
42    setOperationAction(ISD::CTTZ , MVT::i32, Expand);
43    setOperationAction(ISD::CTTZ_ZERO_UNDEF, MVT::i32, Expand);
44    setOperationAction(ISD::CTLZ , MVT::i32, Expand);
45 @@ -1568,8 +1567,8 @@ SparcTargetLowering::SparcTargetLowering(TargetMac
46  
47    setStackPointerRegisterToSaveRestore(SP::O6);
48  
49 -  if (Subtarget->isV9() && Subtarget->usePopc())
50 -    setOperationAction(ISD::CTPOP, MVT::i32, Legal);
51 +  setOperationAction(ISD::CTPOP, MVT::i32,
52 +                     Subtarget->usePopc() ? Legal : Expand);
53  
54    if (Subtarget->isV9() && Subtarget->hasHardQuad()) {
55      setOperationAction(ISD::LOAD, MVT::f128, Legal);
56 Index: test/CodeGen/SPARC/64bit.ll
57 ===================================================================
58 --- test/CodeGen/SPARC/64bit.ll
59 +++ test/CodeGen/SPARC/64bit.ll
60 @@ -1,5 +1,5 @@
61 -; RUN: llc < %s -march=sparcv9 -disable-sparc-delay-filler -disable-sparc-leaf-proc | FileCheck %s
62 -; RUN: llc < %s -march=sparcv9  | FileCheck %s -check-prefix=OPT
63 +; RUN: llc < %s -march=sparcv9 -mattr=+popc -disable-sparc-delay-filler -disable-sparc-leaf-proc | FileCheck %s
64 +; RUN: llc < %s -march=sparcv9 -mattr=+popc | FileCheck %s -check-prefix=OPT
65  
66  ; CHECK-LABEL: ret2:
67  ; CHECK: or %g0, %i1, %i0