diff options
| author | Kit Barton <kbarton@ca.ibm.com> | 2015-03-05 16:24:38 +0000 | 
|---|---|---|
| committer | Kit Barton <kbarton@ca.ibm.com> | 2015-03-05 16:24:38 +0000 | 
| commit | e48b1e1c4fb0615cf8039151c72775f05c0504fe (patch) | |
| tree | a33e567fe9215dd2ec83d625ff3c142dc7d33963 /llvm/lib | |
| parent | 10b33a266258e1075a45df445f5b8f71b7ea514d (diff) | |
| download | bcm5719-llvm-e48b1e1c4fb0615cf8039151c72775f05c0504fe.tar.gz bcm5719-llvm-e48b1e1c4fb0615cf8039151c72775f05c0504fe.zip | |
While reviewing the changes to Clang to add builtin support for the vsld, vsrd, and vsrad instructions, it was pointed out that the builtins are generating the LLVM opcodes (shl, lshr, and ashr) not calls to the intrinsics. This patch changes the implementation of the vsld, vsrd, and vsrad instructions from from intrinsics to VXForm_1 instructions and makes them legal with P8 Altivec. It also removes the definition of the int_ppc_altivec_vsld, int_ppc_altivec_vsrd, and int_ppc_altivec_vsrad intrinsics.
llvm-svn: 231378
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 12 | ||||
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrAltivec.td | 14 | 
2 files changed, 18 insertions, 8 deletions
| diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 70770a902af..2251dd1dcbe 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -574,14 +574,18 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,        addRegisterClass(MVT::v4f32, &PPC::VSRCRegClass);        addRegisterClass(MVT::v2f64, &PPC::VSRCRegClass); -      setOperationAction(ISD::SHL, MVT::v2i64, Expand); -      setOperationAction(ISD::SRA, MVT::v2i64, Expand); -      setOperationAction(ISD::SRL, MVT::v2i64, Expand); -        if (Subtarget.hasP8Altivec()) { +        setOperationAction(ISD::SHL, MVT::v2i64, Legal); +        setOperationAction(ISD::SRA, MVT::v2i64, Legal); +        setOperationAction(ISD::SRL, MVT::v2i64, Legal); +          setOperationAction(ISD::SETCC, MVT::v2i64, Legal);        }        else { +        setOperationAction(ISD::SHL, MVT::v2i64, Expand); +        setOperationAction(ISD::SRA, MVT::v2i64, Expand); +        setOperationAction(ISD::SRL, MVT::v2i64, Expand); +          setOperationAction(ISD::SETCC, MVT::v2i64, Custom);          // VSX v2i64 only supports non-arithmetic operations. diff --git a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td index 2de852b4843..020c22ea770 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td +++ b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td @@ -969,11 +969,17 @@ def VMINSD : VX1_Int_Ty<962, "vminsd", int_ppc_altivec_vminsd, v2i64>;  def VMIDUD : VX1_Int_Ty<706, "vminud", int_ppc_altivec_vminud, v2i64>;  } // isCommutable +// Vector shifts  def VRLD : VX1_Int_Ty<196, "vrld", int_ppc_altivec_vrld, v2i64>; -def VSLD : VX1_Int_Ty<1476, "vsld", int_ppc_altivec_vsld, v2i64>; -def VSRD : VX1_Int_Ty<1732, "vsrd", int_ppc_altivec_vsrd, v2i64>; -def VSRAD : VX1_Int_Ty<964, "vsrad", int_ppc_altivec_vsrad, v2i64>; - +def VSLD : VXForm_1<1476, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), +                    "vsld $vD, $vA, $vB", IIC_VecGeneral, +                    [(set v2i64:$vD, (shl v2i64:$vA, v2i64:$vB))]>; +def VSRD : VXForm_1<1732, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), +                   "vsrd $vD, $vA, $vB", IIC_VecGeneral, +                   [(set v2i64:$vD, (srl v2i64:$vA, v2i64:$vB))]>; +def VSRAD : VXForm_1<964, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), +                    "vsrad $vD, $vA, $vB", IIC_VecGeneral, +                    [(set v2i64:$vD, (sra v2i64:$vA, v2i64:$vB))]>;  // Vector Integer Arithmetic Instructions  let isCommutable = 1 in { | 

