PPCInstrAltivec.td revision 280031
1234353Sdim//===-- PPCInstrAltivec.td - The PowerPC Altivec Extension -*- tablegen -*-===// 2234353Sdim// 3193323Sed// The LLVM Compiler Infrastructure 4193323Sed// 5193323Sed// This file is distributed under the University of Illinois Open Source 6193323Sed// License. See LICENSE.TXT for details. 7234353Sdim// 8193323Sed//===----------------------------------------------------------------------===// 9193323Sed// 10193323Sed// This file describes the Altivec extension to the PowerPC instruction set. 11193323Sed// 12193323Sed//===----------------------------------------------------------------------===// 13193323Sed 14193323Sed//===----------------------------------------------------------------------===// 15193323Sed// Altivec transformation functions and pattern fragments. 16193323Sed// 17193323Sed 18206083Srdivacky// Since we canonicalize buildvectors to v16i8, all vnots "-1" operands will be 19206083Srdivacky// of that type. 20206083Srdivackydef vnot_ppc : PatFrag<(ops node:$in), 21206083Srdivacky (xor node:$in, (bitconvert (v16i8 immAllOnesV)))>; 22193323Sed 23193323Seddef vpkuhum_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 24193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 25276479Sdim return PPC::isVPKUHUMShuffleMask(cast<ShuffleVectorSDNode>(N), 0, *CurDAG); 26193323Sed}]>; 27193323Seddef vpkuwum_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 28193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 29276479Sdim return PPC::isVPKUWUMShuffleMask(cast<ShuffleVectorSDNode>(N), 0, *CurDAG); 30193323Sed}]>; 31193323Seddef vpkuhum_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 32193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 33276479Sdim return PPC::isVPKUHUMShuffleMask(cast<ShuffleVectorSDNode>(N), 1, *CurDAG); 34193323Sed}]>; 35193323Seddef vpkuwum_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 36193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 37276479Sdim return PPC::isVPKUWUMShuffleMask(cast<ShuffleVectorSDNode>(N), 1, *CurDAG); 38193323Sed}]>; 39193323Sed 40276479Sdim// These fragments are provided for little-endian, where the inputs must be 41276479Sdim// swapped for correct semantics. 42276479Sdimdef vpkuhum_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 43276479Sdim (vector_shuffle node:$lhs, node:$rhs), [{ 44276479Sdim return PPC::isVPKUHUMShuffleMask(cast<ShuffleVectorSDNode>(N), 2, *CurDAG); 45276479Sdim}]>; 46276479Sdimdef vpkuwum_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 47276479Sdim (vector_shuffle node:$lhs, node:$rhs), [{ 48276479Sdim return PPC::isVPKUWUMShuffleMask(cast<ShuffleVectorSDNode>(N), 2, *CurDAG); 49276479Sdim}]>; 50193323Sed 51193323Seddef vmrglb_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 52204961Srdivacky (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{ 53276479Sdim return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 0, *CurDAG); 54193323Sed}]>; 55193323Seddef vmrglh_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 56204961Srdivacky (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{ 57276479Sdim return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 0, *CurDAG); 58193323Sed}]>; 59193323Seddef vmrglw_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 60204961Srdivacky (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{ 61276479Sdim return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 0, *CurDAG); 62193323Sed}]>; 63193323Seddef vmrghb_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 64204961Srdivacky (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{ 65276479Sdim return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 0, *CurDAG); 66193323Sed}]>; 67193323Seddef vmrghh_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 68204961Srdivacky (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{ 69276479Sdim return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 0, *CurDAG); 70193323Sed}]>; 71193323Seddef vmrghw_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 72204961Srdivacky (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{ 73276479Sdim return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 0, *CurDAG); 74193323Sed}]>; 75193323Sed 76193323Sed 77193323Seddef vmrglb_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 78204961Srdivacky (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{ 79276479Sdim return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 1, *CurDAG); 80193323Sed}]>; 81193323Seddef vmrglh_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 82193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 83276479Sdim return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 1, *CurDAG); 84193323Sed}]>; 85193323Seddef vmrglw_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 86193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 87276479Sdim return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 1, *CurDAG); 88193323Sed}]>; 89193323Seddef vmrghb_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 90193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 91276479Sdim return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 1, *CurDAG); 92193323Sed}]>; 93193323Seddef vmrghh_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 94193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 95276479Sdim return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 1, *CurDAG); 96193323Sed}]>; 97193323Seddef vmrghw_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 98193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 99276479Sdim return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 1, *CurDAG); 100193323Sed}]>; 101193323Sed 102193323Sed 103276479Sdim// These fragments are provided for little-endian, where the inputs must be 104276479Sdim// swapped for correct semantics. 105276479Sdimdef vmrglb_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 106276479Sdim (vector_shuffle (v16i8 node:$lhs), node:$rhs), [{ 107276479Sdim return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 2, *CurDAG); 108276479Sdim}]>; 109276479Sdimdef vmrglh_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 110276479Sdim (vector_shuffle node:$lhs, node:$rhs), [{ 111276479Sdim return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 2, *CurDAG); 112276479Sdim}]>; 113276479Sdimdef vmrglw_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 114276479Sdim (vector_shuffle node:$lhs, node:$rhs), [{ 115276479Sdim return PPC::isVMRGLShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 2, *CurDAG); 116276479Sdim}]>; 117276479Sdimdef vmrghb_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 118276479Sdim (vector_shuffle node:$lhs, node:$rhs), [{ 119276479Sdim return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 1, 2, *CurDAG); 120276479Sdim}]>; 121276479Sdimdef vmrghh_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 122276479Sdim (vector_shuffle node:$lhs, node:$rhs), [{ 123276479Sdim return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 2, 2, *CurDAG); 124276479Sdim}]>; 125276479Sdimdef vmrghw_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 126276479Sdim (vector_shuffle node:$lhs, node:$rhs), [{ 127276479Sdim return PPC::isVMRGHShuffleMask(cast<ShuffleVectorSDNode>(N), 4, 2, *CurDAG); 128276479Sdim}]>; 129276479Sdim 130276479Sdim 131193323Seddef VSLDOI_get_imm : SDNodeXForm<vector_shuffle, [{ 132276479Sdim return getI32Imm(PPC::isVSLDOIShuffleMask(N, 0, *CurDAG)); 133193323Sed}]>; 134193323Seddef vsldoi_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 135193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 136276479Sdim return PPC::isVSLDOIShuffleMask(N, 0, *CurDAG) != -1; 137193323Sed}], VSLDOI_get_imm>; 138193323Sed 139193323Sed 140193323Sed/// VSLDOI_unary* - These are used to match vsldoi(X,X), which is turned into 141193323Sed/// vector_shuffle(X,undef,mask) by the dag combiner. 142193323Seddef VSLDOI_unary_get_imm : SDNodeXForm<vector_shuffle, [{ 143276479Sdim return getI32Imm(PPC::isVSLDOIShuffleMask(N, 1, *CurDAG)); 144193323Sed}]>; 145193323Seddef vsldoi_unary_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 146193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 147276479Sdim return PPC::isVSLDOIShuffleMask(N, 1, *CurDAG) != -1; 148193323Sed}], VSLDOI_unary_get_imm>; 149193323Sed 150193323Sed 151276479Sdim/// VSLDOI_swapped* - These fragments are provided for little-endian, where 152276479Sdim/// the inputs must be swapped for correct semantics. 153276479Sdimdef VSLDOI_swapped_get_imm : SDNodeXForm<vector_shuffle, [{ 154276479Sdim return getI32Imm(PPC::isVSLDOIShuffleMask(N, 2, *CurDAG)); 155276479Sdim}]>; 156276479Sdimdef vsldoi_swapped_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 157276479Sdim (vector_shuffle node:$lhs, node:$rhs), [{ 158276479Sdim return PPC::isVSLDOIShuffleMask(N, 2, *CurDAG) != -1; 159276479Sdim}], VSLDOI_get_imm>; 160276479Sdim 161276479Sdim 162193323Sed// VSPLT*_get_imm xform function: convert vector_shuffle mask to VSPLT* imm. 163193323Seddef VSPLTB_get_imm : SDNodeXForm<vector_shuffle, [{ 164276479Sdim return getI32Imm(PPC::getVSPLTImmediate(N, 1, *CurDAG)); 165193323Sed}]>; 166193323Seddef vspltb_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 167193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 168193323Sed return PPC::isSplatShuffleMask(cast<ShuffleVectorSDNode>(N), 1); 169193323Sed}], VSPLTB_get_imm>; 170193323Seddef VSPLTH_get_imm : SDNodeXForm<vector_shuffle, [{ 171276479Sdim return getI32Imm(PPC::getVSPLTImmediate(N, 2, *CurDAG)); 172193323Sed}]>; 173193323Seddef vsplth_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 174193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 175193323Sed return PPC::isSplatShuffleMask(cast<ShuffleVectorSDNode>(N), 2); 176193323Sed}], VSPLTH_get_imm>; 177193323Seddef VSPLTW_get_imm : SDNodeXForm<vector_shuffle, [{ 178276479Sdim return getI32Imm(PPC::getVSPLTImmediate(N, 4, *CurDAG)); 179193323Sed}]>; 180193323Seddef vspltw_shuffle : PatFrag<(ops node:$lhs, node:$rhs), 181193323Sed (vector_shuffle node:$lhs, node:$rhs), [{ 182193323Sed return PPC::isSplatShuffleMask(cast<ShuffleVectorSDNode>(N), 4); 183193323Sed}], VSPLTW_get_imm>; 184193323Sed 185193323Sed 186193323Sed// VSPLTISB_get_imm xform function: convert build_vector to VSPLTISB imm. 187193323Seddef VSPLTISB_get_imm : SDNodeXForm<build_vector, [{ 188193323Sed return PPC::get_VSPLTI_elt(N, 1, *CurDAG); 189193323Sed}]>; 190193323Seddef vecspltisb : PatLeaf<(build_vector), [{ 191193323Sed return PPC::get_VSPLTI_elt(N, 1, *CurDAG).getNode() != 0; 192193323Sed}], VSPLTISB_get_imm>; 193193323Sed 194193323Sed// VSPLTISH_get_imm xform function: convert build_vector to VSPLTISH imm. 195193323Seddef VSPLTISH_get_imm : SDNodeXForm<build_vector, [{ 196193323Sed return PPC::get_VSPLTI_elt(N, 2, *CurDAG); 197193323Sed}]>; 198193323Seddef vecspltish : PatLeaf<(build_vector), [{ 199193323Sed return PPC::get_VSPLTI_elt(N, 2, *CurDAG).getNode() != 0; 200193323Sed}], VSPLTISH_get_imm>; 201193323Sed 202193323Sed// VSPLTISW_get_imm xform function: convert build_vector to VSPLTISW imm. 203193323Seddef VSPLTISW_get_imm : SDNodeXForm<build_vector, [{ 204193323Sed return PPC::get_VSPLTI_elt(N, 4, *CurDAG); 205193323Sed}]>; 206193323Seddef vecspltisw : PatLeaf<(build_vector), [{ 207193323Sed return PPC::get_VSPLTI_elt(N, 4, *CurDAG).getNode() != 0; 208193323Sed}], VSPLTISW_get_imm>; 209193323Sed 210193323Sed//===----------------------------------------------------------------------===// 211193323Sed// Helpers for defining instructions that directly correspond to intrinsics. 212193323Sed 213249423Sdim// VA1a_Int_Ty - A VAForm_1a intrinsic definition of specific type. 214249423Sdimclass VA1a_Int_Ty<bits<6> xo, string opc, Intrinsic IntID, ValueType Ty> 215251662Sdim : VAForm_1a<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB, vrrc:$vC), 216276479Sdim !strconcat(opc, " $vD, $vA, $vB, $vC"), IIC_VecFP, 217249423Sdim [(set Ty:$vD, (IntID Ty:$vA, Ty:$vB, Ty:$vC))]>; 218193323Sed 219249423Sdim// VA1a_Int_Ty2 - A VAForm_1a intrinsic definition where the type of the 220249423Sdim// inputs doesn't match the type of the output. 221249423Sdimclass VA1a_Int_Ty2<bits<6> xo, string opc, Intrinsic IntID, ValueType OutTy, 222249423Sdim ValueType InTy> 223251662Sdim : VAForm_1a<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB, vrrc:$vC), 224276479Sdim !strconcat(opc, " $vD, $vA, $vB, $vC"), IIC_VecFP, 225249423Sdim [(set OutTy:$vD, (IntID InTy:$vA, InTy:$vB, InTy:$vC))]>; 226249423Sdim 227249423Sdim// VA1a_Int_Ty3 - A VAForm_1a intrinsic definition where there are two 228249423Sdim// input types and an output type. 229249423Sdimclass VA1a_Int_Ty3<bits<6> xo, string opc, Intrinsic IntID, ValueType OutTy, 230249423Sdim ValueType In1Ty, ValueType In2Ty> 231251662Sdim : VAForm_1a<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB, vrrc:$vC), 232276479Sdim !strconcat(opc, " $vD, $vA, $vB, $vC"), IIC_VecFP, 233249423Sdim [(set OutTy:$vD, 234249423Sdim (IntID In1Ty:$vA, In1Ty:$vB, In2Ty:$vC))]>; 235249423Sdim 236249423Sdim// VX1_Int_Ty - A VXForm_1 intrinsic definition of specific type. 237249423Sdimclass VX1_Int_Ty<bits<11> xo, string opc, Intrinsic IntID, ValueType Ty> 238251662Sdim : VXForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 239276479Sdim !strconcat(opc, " $vD, $vA, $vB"), IIC_VecFP, 240249423Sdim [(set Ty:$vD, (IntID Ty:$vA, Ty:$vB))]>; 241193323Sed 242249423Sdim// VX1_Int_Ty2 - A VXForm_1 intrinsic definition where the type of the 243249423Sdim// inputs doesn't match the type of the output. 244249423Sdimclass VX1_Int_Ty2<bits<11> xo, string opc, Intrinsic IntID, ValueType OutTy, 245249423Sdim ValueType InTy> 246251662Sdim : VXForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 247276479Sdim !strconcat(opc, " $vD, $vA, $vB"), IIC_VecFP, 248249423Sdim [(set OutTy:$vD, (IntID InTy:$vA, InTy:$vB))]>; 249249423Sdim 250249423Sdim// VX1_Int_Ty3 - A VXForm_1 intrinsic definition where there are two 251249423Sdim// input types and an output type. 252249423Sdimclass VX1_Int_Ty3<bits<11> xo, string opc, Intrinsic IntID, ValueType OutTy, 253249423Sdim ValueType In1Ty, ValueType In2Ty> 254251662Sdim : VXForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 255276479Sdim !strconcat(opc, " $vD, $vA, $vB"), IIC_VecFP, 256249423Sdim [(set OutTy:$vD, (IntID In1Ty:$vA, In2Ty:$vB))]>; 257249423Sdim 258249423Sdim// VX2_Int_SP - A VXForm_2 intrinsic definition of vector single-precision type. 259249423Sdimclass VX2_Int_SP<bits<11> xo, string opc, Intrinsic IntID> 260251662Sdim : VXForm_2<xo, (outs vrrc:$vD), (ins vrrc:$vB), 261276479Sdim !strconcat(opc, " $vD, $vB"), IIC_VecFP, 262249423Sdim [(set v4f32:$vD, (IntID v4f32:$vB))]>; 263193323Sed 264249423Sdim// VX2_Int_Ty2 - A VXForm_2 intrinsic definition where the type of the 265249423Sdim// inputs doesn't match the type of the output. 266249423Sdimclass VX2_Int_Ty2<bits<11> xo, string opc, Intrinsic IntID, ValueType OutTy, 267249423Sdim ValueType InTy> 268251662Sdim : VXForm_2<xo, (outs vrrc:$vD), (ins vrrc:$vB), 269276479Sdim !strconcat(opc, " $vD, $vB"), IIC_VecFP, 270249423Sdim [(set OutTy:$vD, (IntID InTy:$vB))]>; 271249423Sdim 272193323Sed//===----------------------------------------------------------------------===// 273193323Sed// Instruction Definitions. 274193323Sed 275276479Sdimdef HasAltivec : Predicate<"PPCSubTarget->hasAltivec()">; 276249423Sdimlet Predicates = [HasAltivec] in { 277249423Sdim 278280031Sdimdef DSS : DSS_Form<0, 822, (outs), (ins u5imm:$STRM), 279280031Sdim "dss $STRM", IIC_LdStLoad /*FIXME*/, [(int_ppc_altivec_dss imm:$STRM)]>, 280280031Sdim Deprecated<DeprecatedDST> { 281280031Sdim let A = 0; 282280031Sdim let B = 0; 283280031Sdim} 284280031Sdim 285280031Sdimdef DSSALL : DSS_Form<1, 822, (outs), (ins), 286280031Sdim "dssall", IIC_LdStLoad /*FIXME*/, [(int_ppc_altivec_dssall)]>, 287280031Sdim Deprecated<DeprecatedDST> { 288280031Sdim let STRM = 0; 289280031Sdim let A = 0; 290280031Sdim let B = 0; 291280031Sdim} 292280031Sdim 293280031Sdimdef DST : DSS_Form<0, 342, (outs), (ins u5imm:$STRM, gprc:$rA, gprc:$rB), 294280031Sdim "dst $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/, 295280031Sdim [(int_ppc_altivec_dst i32:$rA, i32:$rB, imm:$STRM)]>, 296261991Sdim Deprecated<DeprecatedDST>; 297280031Sdim 298280031Sdimdef DSTT : DSS_Form<1, 342, (outs), (ins u5imm:$STRM, gprc:$rA, gprc:$rB), 299280031Sdim "dstt $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/, 300280031Sdim [(int_ppc_altivec_dstt i32:$rA, i32:$rB, imm:$STRM)]>, 301261991Sdim Deprecated<DeprecatedDST>; 302280031Sdim 303280031Sdimdef DSTST : DSS_Form<0, 374, (outs), (ins u5imm:$STRM, gprc:$rA, gprc:$rB), 304280031Sdim "dstst $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/, 305280031Sdim [(int_ppc_altivec_dstst i32:$rA, i32:$rB, imm:$STRM)]>, 306261991Sdim Deprecated<DeprecatedDST>; 307280031Sdim 308280031Sdimdef DSTSTT : DSS_Form<1, 374, (outs), (ins u5imm:$STRM, gprc:$rA, gprc:$rB), 309280031Sdim "dststt $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/, 310280031Sdim [(int_ppc_altivec_dststt i32:$rA, i32:$rB, imm:$STRM)]>, 311261991Sdim Deprecated<DeprecatedDST>; 312193323Sed 313280031Sdimlet isCodeGenOnly = 1 in { 314280031Sdim // The very same instructions as above, but formally matching 64bit registers. 315280031Sdim def DST64 : DSS_Form<0, 342, (outs), (ins u5imm:$STRM, g8rc:$rA, gprc:$rB), 316280031Sdim "dst $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/, 317280031Sdim [(int_ppc_altivec_dst i64:$rA, i32:$rB, imm:$STRM)]>, 318280031Sdim Deprecated<DeprecatedDST>; 319280031Sdim 320280031Sdim def DSTT64 : DSS_Form<1, 342, (outs), (ins u5imm:$STRM, g8rc:$rA, gprc:$rB), 321280031Sdim "dstt $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/, 322280031Sdim [(int_ppc_altivec_dstt i64:$rA, i32:$rB, imm:$STRM)]>, 323280031Sdim Deprecated<DeprecatedDST>; 324280031Sdim 325280031Sdim def DSTST64 : DSS_Form<0, 374, (outs), (ins u5imm:$STRM, g8rc:$rA, gprc:$rB), 326280031Sdim "dstst $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/, 327280031Sdim [(int_ppc_altivec_dstst i64:$rA, i32:$rB, 328280031Sdim imm:$STRM)]>, 329280031Sdim Deprecated<DeprecatedDST>; 330280031Sdim 331280031Sdim def DSTSTT64 : DSS_Form<1, 374, (outs), (ins u5imm:$STRM, g8rc:$rA, gprc:$rB), 332280031Sdim "dststt $rA, $rB, $STRM", IIC_LdStLoad /*FIXME*/, 333280031Sdim [(int_ppc_altivec_dststt i64:$rA, i32:$rB, 334280031Sdim imm:$STRM)]>, 335280031Sdim Deprecated<DeprecatedDST>; 336249423Sdim} 337193323Sed 338251662Sdimdef MFVSCR : VXForm_4<1540, (outs vrrc:$vD), (ins), 339276479Sdim "mfvscr $vD", IIC_LdStStore, 340249423Sdim [(set v8i16:$vD, (int_ppc_altivec_mfvscr))]>; 341251662Sdimdef MTVSCR : VXForm_5<1604, (outs), (ins vrrc:$vB), 342276479Sdim "mtvscr $vB", IIC_LdStLoad, 343249423Sdim [(int_ppc_altivec_mtvscr v4i32:$vB)]>; 344193323Sed 345193323Sedlet canFoldAsLoad = 1, PPC970_Unit = 2 in { // Loads. 346251662Sdimdef LVEBX: XForm_1<31, 7, (outs vrrc:$vD), (ins memrr:$src), 347276479Sdim "lvebx $vD, $src", IIC_LdStLoad, 348249423Sdim [(set v16i8:$vD, (int_ppc_altivec_lvebx xoaddr:$src))]>; 349251662Sdimdef LVEHX: XForm_1<31, 39, (outs vrrc:$vD), (ins memrr:$src), 350276479Sdim "lvehx $vD, $src", IIC_LdStLoad, 351249423Sdim [(set v8i16:$vD, (int_ppc_altivec_lvehx xoaddr:$src))]>; 352251662Sdimdef LVEWX: XForm_1<31, 71, (outs vrrc:$vD), (ins memrr:$src), 353276479Sdim "lvewx $vD, $src", IIC_LdStLoad, 354249423Sdim [(set v4i32:$vD, (int_ppc_altivec_lvewx xoaddr:$src))]>; 355251662Sdimdef LVX : XForm_1<31, 103, (outs vrrc:$vD), (ins memrr:$src), 356276479Sdim "lvx $vD, $src", IIC_LdStLoad, 357249423Sdim [(set v4i32:$vD, (int_ppc_altivec_lvx xoaddr:$src))]>; 358251662Sdimdef LVXL : XForm_1<31, 359, (outs vrrc:$vD), (ins memrr:$src), 359276479Sdim "lvxl $vD, $src", IIC_LdStLoad, 360249423Sdim [(set v4i32:$vD, (int_ppc_altivec_lvxl xoaddr:$src))]>; 361193323Sed} 362193323Sed 363251662Sdimdef LVSL : XForm_1<31, 6, (outs vrrc:$vD), (ins memrr:$src), 364276479Sdim "lvsl $vD, $src", IIC_LdStLoad, 365249423Sdim [(set v16i8:$vD, (int_ppc_altivec_lvsl xoaddr:$src))]>, 366193323Sed PPC970_Unit_LSU; 367251662Sdimdef LVSR : XForm_1<31, 38, (outs vrrc:$vD), (ins memrr:$src), 368276479Sdim "lvsr $vD, $src", IIC_LdStLoad, 369249423Sdim [(set v16i8:$vD, (int_ppc_altivec_lvsr xoaddr:$src))]>, 370193323Sed PPC970_Unit_LSU; 371193323Sed 372193323Sedlet PPC970_Unit = 2 in { // Stores. 373251662Sdimdef STVEBX: XForm_8<31, 135, (outs), (ins vrrc:$rS, memrr:$dst), 374276479Sdim "stvebx $rS, $dst", IIC_LdStStore, 375249423Sdim [(int_ppc_altivec_stvebx v16i8:$rS, xoaddr:$dst)]>; 376251662Sdimdef STVEHX: XForm_8<31, 167, (outs), (ins vrrc:$rS, memrr:$dst), 377276479Sdim "stvehx $rS, $dst", IIC_LdStStore, 378249423Sdim [(int_ppc_altivec_stvehx v8i16:$rS, xoaddr:$dst)]>; 379251662Sdimdef STVEWX: XForm_8<31, 199, (outs), (ins vrrc:$rS, memrr:$dst), 380276479Sdim "stvewx $rS, $dst", IIC_LdStStore, 381249423Sdim [(int_ppc_altivec_stvewx v4i32:$rS, xoaddr:$dst)]>; 382251662Sdimdef STVX : XForm_8<31, 231, (outs), (ins vrrc:$rS, memrr:$dst), 383276479Sdim "stvx $rS, $dst", IIC_LdStStore, 384249423Sdim [(int_ppc_altivec_stvx v4i32:$rS, xoaddr:$dst)]>; 385251662Sdimdef STVXL : XForm_8<31, 487, (outs), (ins vrrc:$rS, memrr:$dst), 386276479Sdim "stvxl $rS, $dst", IIC_LdStStore, 387249423Sdim [(int_ppc_altivec_stvxl v4i32:$rS, xoaddr:$dst)]>; 388193323Sed} 389193323Sed 390193323Sedlet PPC970_Unit = 5 in { // VALU Operations. 391193323Sed// VA-Form instructions. 3-input AltiVec ops. 392276479Sdimlet isCommutable = 1 in { 393251662Sdimdef VMADDFP : VAForm_1<46, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vC, vrrc:$vB), 394276479Sdim "vmaddfp $vD, $vA, $vC, $vB", IIC_VecFP, 395249423Sdim [(set v4f32:$vD, 396249423Sdim (fma v4f32:$vA, v4f32:$vC, v4f32:$vB))]>; 397249423Sdim 398249423Sdim// FIXME: The fma+fneg pattern won't match because fneg is not legal. 399251662Sdimdef VNMSUBFP: VAForm_1<47, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vC, vrrc:$vB), 400276479Sdim "vnmsubfp $vD, $vA, $vC, $vB", IIC_VecFP, 401249423Sdim [(set v4f32:$vD, (fneg (fma v4f32:$vA, v4f32:$vC, 402276479Sdim (fneg v4f32:$vB))))]>; 403193323Sed 404249423Sdimdef VMHADDSHS : VA1a_Int_Ty<32, "vmhaddshs", int_ppc_altivec_vmhaddshs, v8i16>; 405249423Sdimdef VMHRADDSHS : VA1a_Int_Ty<33, "vmhraddshs", int_ppc_altivec_vmhraddshs, 406249423Sdim v8i16>; 407249423Sdimdef VMLADDUHM : VA1a_Int_Ty<34, "vmladduhm", int_ppc_altivec_vmladduhm, v8i16>; 408276479Sdim} // isCommutable 409193323Sed 410249423Sdimdef VPERM : VA1a_Int_Ty3<43, "vperm", int_ppc_altivec_vperm, 411249423Sdim v4i32, v4i32, v16i8>; 412249423Sdimdef VSEL : VA1a_Int_Ty<42, "vsel", int_ppc_altivec_vsel, v4i32>; 413249423Sdim 414193323Sed// Shuffles. 415251662Sdimdef VSLDOI : VAForm_2<44, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB, u5imm:$SH), 416276479Sdim "vsldoi $vD, $vA, $vB, $SH", IIC_VecFP, 417249423Sdim [(set v16i8:$vD, 418249423Sdim (vsldoi_shuffle:$SH v16i8:$vA, v16i8:$vB))]>; 419193323Sed 420193323Sed// VX-Form instructions. AltiVec arithmetic ops. 421276479Sdimlet isCommutable = 1 in { 422251662Sdimdef VADDFP : VXForm_1<10, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 423276479Sdim "vaddfp $vD, $vA, $vB", IIC_VecFP, 424249423Sdim [(set v4f32:$vD, (fadd v4f32:$vA, v4f32:$vB))]>; 425193323Sed 426251662Sdimdef VADDUBM : VXForm_1<0, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 427276479Sdim "vaddubm $vD, $vA, $vB", IIC_VecGeneral, 428249423Sdim [(set v16i8:$vD, (add v16i8:$vA, v16i8:$vB))]>; 429251662Sdimdef VADDUHM : VXForm_1<64, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 430276479Sdim "vadduhm $vD, $vA, $vB", IIC_VecGeneral, 431249423Sdim [(set v8i16:$vD, (add v8i16:$vA, v8i16:$vB))]>; 432251662Sdimdef VADDUWM : VXForm_1<128, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 433276479Sdim "vadduwm $vD, $vA, $vB", IIC_VecGeneral, 434249423Sdim [(set v4i32:$vD, (add v4i32:$vA, v4i32:$vB))]>; 435193323Sed 436249423Sdimdef VADDCUW : VX1_Int_Ty<384, "vaddcuw", int_ppc_altivec_vaddcuw, v4i32>; 437249423Sdimdef VADDSBS : VX1_Int_Ty<768, "vaddsbs", int_ppc_altivec_vaddsbs, v16i8>; 438249423Sdimdef VADDSHS : VX1_Int_Ty<832, "vaddshs", int_ppc_altivec_vaddshs, v8i16>; 439249423Sdimdef VADDSWS : VX1_Int_Ty<896, "vaddsws", int_ppc_altivec_vaddsws, v4i32>; 440249423Sdimdef VADDUBS : VX1_Int_Ty<512, "vaddubs", int_ppc_altivec_vaddubs, v16i8>; 441249423Sdimdef VADDUHS : VX1_Int_Ty<576, "vadduhs", int_ppc_altivec_vadduhs, v8i16>; 442249423Sdimdef VADDUWS : VX1_Int_Ty<640, "vadduws", int_ppc_altivec_vadduws, v4i32>; 443276479Sdim} // isCommutable 444276479Sdim 445276479Sdimlet isCommutable = 1 in 446251662Sdimdef VAND : VXForm_1<1028, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 447276479Sdim "vand $vD, $vA, $vB", IIC_VecFP, 448249423Sdim [(set v4i32:$vD, (and v4i32:$vA, v4i32:$vB))]>; 449251662Sdimdef VANDC : VXForm_1<1092, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 450276479Sdim "vandc $vD, $vA, $vB", IIC_VecFP, 451249423Sdim [(set v4i32:$vD, (and v4i32:$vA, 452249423Sdim (vnot_ppc v4i32:$vB)))]>; 453193323Sed 454251662Sdimdef VCFSX : VXForm_1<842, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB), 455276479Sdim "vcfsx $vD, $vB, $UIMM", IIC_VecFP, 456249423Sdim [(set v4f32:$vD, 457249423Sdim (int_ppc_altivec_vcfsx v4i32:$vB, imm:$UIMM))]>; 458251662Sdimdef VCFUX : VXForm_1<778, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB), 459276479Sdim "vcfux $vD, $vB, $UIMM", IIC_VecFP, 460249423Sdim [(set v4f32:$vD, 461249423Sdim (int_ppc_altivec_vcfux v4i32:$vB, imm:$UIMM))]>; 462251662Sdimdef VCTSXS : VXForm_1<970, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB), 463276479Sdim "vctsxs $vD, $vB, $UIMM", IIC_VecFP, 464249423Sdim [(set v4i32:$vD, 465249423Sdim (int_ppc_altivec_vctsxs v4f32:$vB, imm:$UIMM))]>; 466251662Sdimdef VCTUXS : VXForm_1<906, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB), 467276479Sdim "vctuxs $vD, $vB, $UIMM", IIC_VecFP, 468249423Sdim [(set v4i32:$vD, 469249423Sdim (int_ppc_altivec_vctuxs v4f32:$vB, imm:$UIMM))]>; 470243830Sdim 471243830Sdim// Defines with the UIM field set to 0 for floating-point 472243830Sdim// to integer (fp_to_sint/fp_to_uint) conversions and integer 473243830Sdim// to floating-point (sint_to_fp/uint_to_fp) conversions. 474261991Sdimlet isCodeGenOnly = 1, VA = 0 in { 475251662Sdimdef VCFSX_0 : VXForm_1<842, (outs vrrc:$vD), (ins vrrc:$vB), 476276479Sdim "vcfsx $vD, $vB, 0", IIC_VecFP, 477249423Sdim [(set v4f32:$vD, 478249423Sdim (int_ppc_altivec_vcfsx v4i32:$vB, 0))]>; 479251662Sdimdef VCTUXS_0 : VXForm_1<906, (outs vrrc:$vD), (ins vrrc:$vB), 480276479Sdim "vctuxs $vD, $vB, 0", IIC_VecFP, 481249423Sdim [(set v4i32:$vD, 482249423Sdim (int_ppc_altivec_vctuxs v4f32:$vB, 0))]>; 483251662Sdimdef VCFUX_0 : VXForm_1<778, (outs vrrc:$vD), (ins vrrc:$vB), 484276479Sdim "vcfux $vD, $vB, 0", IIC_VecFP, 485249423Sdim [(set v4f32:$vD, 486249423Sdim (int_ppc_altivec_vcfux v4i32:$vB, 0))]>; 487251662Sdimdef VCTSXS_0 : VXForm_1<970, (outs vrrc:$vD), (ins vrrc:$vB), 488276479Sdim "vctsxs $vD, $vB, 0", IIC_VecFP, 489249423Sdim [(set v4i32:$vD, 490249423Sdim (int_ppc_altivec_vctsxs v4f32:$vB, 0))]>; 491243830Sdim} 492249423Sdimdef VEXPTEFP : VX2_Int_SP<394, "vexptefp", int_ppc_altivec_vexptefp>; 493249423Sdimdef VLOGEFP : VX2_Int_SP<458, "vlogefp", int_ppc_altivec_vlogefp>; 494193323Sed 495276479Sdimlet isCommutable = 1 in { 496249423Sdimdef VAVGSB : VX1_Int_Ty<1282, "vavgsb", int_ppc_altivec_vavgsb, v16i8>; 497249423Sdimdef VAVGSH : VX1_Int_Ty<1346, "vavgsh", int_ppc_altivec_vavgsh, v8i16>; 498249423Sdimdef VAVGSW : VX1_Int_Ty<1410, "vavgsw", int_ppc_altivec_vavgsw, v4i32>; 499249423Sdimdef VAVGUB : VX1_Int_Ty<1026, "vavgub", int_ppc_altivec_vavgub, v16i8>; 500249423Sdimdef VAVGUH : VX1_Int_Ty<1090, "vavguh", int_ppc_altivec_vavguh, v8i16>; 501249423Sdimdef VAVGUW : VX1_Int_Ty<1154, "vavguw", int_ppc_altivec_vavguw, v4i32>; 502193323Sed 503249423Sdimdef VMAXFP : VX1_Int_Ty<1034, "vmaxfp", int_ppc_altivec_vmaxfp, v4f32>; 504249423Sdimdef VMAXSB : VX1_Int_Ty< 258, "vmaxsb", int_ppc_altivec_vmaxsb, v16i8>; 505249423Sdimdef VMAXSH : VX1_Int_Ty< 322, "vmaxsh", int_ppc_altivec_vmaxsh, v8i16>; 506249423Sdimdef VMAXSW : VX1_Int_Ty< 386, "vmaxsw", int_ppc_altivec_vmaxsw, v4i32>; 507249423Sdimdef VMAXUB : VX1_Int_Ty< 2, "vmaxub", int_ppc_altivec_vmaxub, v16i8>; 508249423Sdimdef VMAXUH : VX1_Int_Ty< 66, "vmaxuh", int_ppc_altivec_vmaxuh, v8i16>; 509249423Sdimdef VMAXUW : VX1_Int_Ty< 130, "vmaxuw", int_ppc_altivec_vmaxuw, v4i32>; 510249423Sdimdef VMINFP : VX1_Int_Ty<1098, "vminfp", int_ppc_altivec_vminfp, v4f32>; 511249423Sdimdef VMINSB : VX1_Int_Ty< 770, "vminsb", int_ppc_altivec_vminsb, v16i8>; 512249423Sdimdef VMINSH : VX1_Int_Ty< 834, "vminsh", int_ppc_altivec_vminsh, v8i16>; 513249423Sdimdef VMINSW : VX1_Int_Ty< 898, "vminsw", int_ppc_altivec_vminsw, v4i32>; 514249423Sdimdef VMINUB : VX1_Int_Ty< 514, "vminub", int_ppc_altivec_vminub, v16i8>; 515249423Sdimdef VMINUH : VX1_Int_Ty< 578, "vminuh", int_ppc_altivec_vminuh, v8i16>; 516249423Sdimdef VMINUW : VX1_Int_Ty< 642, "vminuw", int_ppc_altivec_vminuw, v4i32>; 517276479Sdim} // isCommutable 518193323Sed 519251662Sdimdef VMRGHB : VXForm_1< 12, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 520276479Sdim "vmrghb $vD, $vA, $vB", IIC_VecFP, 521249423Sdim [(set v16i8:$vD, (vmrghb_shuffle v16i8:$vA, v16i8:$vB))]>; 522251662Sdimdef VMRGHH : VXForm_1< 76, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 523276479Sdim "vmrghh $vD, $vA, $vB", IIC_VecFP, 524249423Sdim [(set v16i8:$vD, (vmrghh_shuffle v16i8:$vA, v16i8:$vB))]>; 525251662Sdimdef VMRGHW : VXForm_1<140, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 526276479Sdim "vmrghw $vD, $vA, $vB", IIC_VecFP, 527249423Sdim [(set v16i8:$vD, (vmrghw_shuffle v16i8:$vA, v16i8:$vB))]>; 528251662Sdimdef VMRGLB : VXForm_1<268, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 529276479Sdim "vmrglb $vD, $vA, $vB", IIC_VecFP, 530249423Sdim [(set v16i8:$vD, (vmrglb_shuffle v16i8:$vA, v16i8:$vB))]>; 531251662Sdimdef VMRGLH : VXForm_1<332, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 532276479Sdim "vmrglh $vD, $vA, $vB", IIC_VecFP, 533249423Sdim [(set v16i8:$vD, (vmrglh_shuffle v16i8:$vA, v16i8:$vB))]>; 534251662Sdimdef VMRGLW : VXForm_1<396, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 535276479Sdim "vmrglw $vD, $vA, $vB", IIC_VecFP, 536249423Sdim [(set v16i8:$vD, (vmrglw_shuffle v16i8:$vA, v16i8:$vB))]>; 537193323Sed 538249423Sdimdef VMSUMMBM : VA1a_Int_Ty3<37, "vmsummbm", int_ppc_altivec_vmsummbm, 539249423Sdim v4i32, v16i8, v4i32>; 540249423Sdimdef VMSUMSHM : VA1a_Int_Ty3<40, "vmsumshm", int_ppc_altivec_vmsumshm, 541249423Sdim v4i32, v8i16, v4i32>; 542249423Sdimdef VMSUMSHS : VA1a_Int_Ty3<41, "vmsumshs", int_ppc_altivec_vmsumshs, 543249423Sdim v4i32, v8i16, v4i32>; 544249423Sdimdef VMSUMUBM : VA1a_Int_Ty3<36, "vmsumubm", int_ppc_altivec_vmsumubm, 545249423Sdim v4i32, v16i8, v4i32>; 546249423Sdimdef VMSUMUHM : VA1a_Int_Ty3<38, "vmsumuhm", int_ppc_altivec_vmsumuhm, 547249423Sdim v4i32, v8i16, v4i32>; 548249423Sdimdef VMSUMUHS : VA1a_Int_Ty3<39, "vmsumuhs", int_ppc_altivec_vmsumuhs, 549249423Sdim v4i32, v8i16, v4i32>; 550193323Sed 551276479Sdimlet isCommutable = 1 in { 552249423Sdimdef VMULESB : VX1_Int_Ty2<776, "vmulesb", int_ppc_altivec_vmulesb, 553249423Sdim v8i16, v16i8>; 554249423Sdimdef VMULESH : VX1_Int_Ty2<840, "vmulesh", int_ppc_altivec_vmulesh, 555249423Sdim v4i32, v8i16>; 556249423Sdimdef VMULEUB : VX1_Int_Ty2<520, "vmuleub", int_ppc_altivec_vmuleub, 557249423Sdim v8i16, v16i8>; 558249423Sdimdef VMULEUH : VX1_Int_Ty2<584, "vmuleuh", int_ppc_altivec_vmuleuh, 559249423Sdim v4i32, v8i16>; 560249423Sdimdef VMULOSB : VX1_Int_Ty2<264, "vmulosb", int_ppc_altivec_vmulosb, 561249423Sdim v8i16, v16i8>; 562249423Sdimdef VMULOSH : VX1_Int_Ty2<328, "vmulosh", int_ppc_altivec_vmulosh, 563249423Sdim v4i32, v8i16>; 564249423Sdimdef VMULOUB : VX1_Int_Ty2< 8, "vmuloub", int_ppc_altivec_vmuloub, 565249423Sdim v8i16, v16i8>; 566249423Sdimdef VMULOUH : VX1_Int_Ty2< 72, "vmulouh", int_ppc_altivec_vmulouh, 567249423Sdim v4i32, v8i16>; 568276479Sdim} // isCommutable 569193323Sed 570249423Sdimdef VREFP : VX2_Int_SP<266, "vrefp", int_ppc_altivec_vrefp>; 571249423Sdimdef VRFIM : VX2_Int_SP<714, "vrfim", int_ppc_altivec_vrfim>; 572249423Sdimdef VRFIN : VX2_Int_SP<522, "vrfin", int_ppc_altivec_vrfin>; 573249423Sdimdef VRFIP : VX2_Int_SP<650, "vrfip", int_ppc_altivec_vrfip>; 574249423Sdimdef VRFIZ : VX2_Int_SP<586, "vrfiz", int_ppc_altivec_vrfiz>; 575249423Sdimdef VRSQRTEFP : VX2_Int_SP<330, "vrsqrtefp", int_ppc_altivec_vrsqrtefp>; 576193323Sed 577251662Sdimdef VSUBCUW : VX1_Int_Ty<1408, "vsubcuw", int_ppc_altivec_vsubcuw, v4i32>; 578193323Sed 579251662Sdimdef VSUBFP : VXForm_1<74, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 580276479Sdim "vsubfp $vD, $vA, $vB", IIC_VecGeneral, 581249423Sdim [(set v4f32:$vD, (fsub v4f32:$vA, v4f32:$vB))]>; 582251662Sdimdef VSUBUBM : VXForm_1<1024, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 583276479Sdim "vsububm $vD, $vA, $vB", IIC_VecGeneral, 584249423Sdim [(set v16i8:$vD, (sub v16i8:$vA, v16i8:$vB))]>; 585251662Sdimdef VSUBUHM : VXForm_1<1088, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 586276479Sdim "vsubuhm $vD, $vA, $vB", IIC_VecGeneral, 587249423Sdim [(set v8i16:$vD, (sub v8i16:$vA, v8i16:$vB))]>; 588251662Sdimdef VSUBUWM : VXForm_1<1152, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 589276479Sdim "vsubuwm $vD, $vA, $vB", IIC_VecGeneral, 590249423Sdim [(set v4i32:$vD, (sub v4i32:$vA, v4i32:$vB))]>; 591193323Sed 592249423Sdimdef VSUBSBS : VX1_Int_Ty<1792, "vsubsbs" , int_ppc_altivec_vsubsbs, v16i8>; 593249423Sdimdef VSUBSHS : VX1_Int_Ty<1856, "vsubshs" , int_ppc_altivec_vsubshs, v8i16>; 594249423Sdimdef VSUBSWS : VX1_Int_Ty<1920, "vsubsws" , int_ppc_altivec_vsubsws, v4i32>; 595249423Sdimdef VSUBUBS : VX1_Int_Ty<1536, "vsububs" , int_ppc_altivec_vsububs, v16i8>; 596249423Sdimdef VSUBUHS : VX1_Int_Ty<1600, "vsubuhs" , int_ppc_altivec_vsubuhs, v8i16>; 597249423Sdimdef VSUBUWS : VX1_Int_Ty<1664, "vsubuws" , int_ppc_altivec_vsubuws, v4i32>; 598193323Sed 599249423Sdimdef VSUMSWS : VX1_Int_Ty<1928, "vsumsws" , int_ppc_altivec_vsumsws, v4i32>; 600249423Sdimdef VSUM2SWS: VX1_Int_Ty<1672, "vsum2sws", int_ppc_altivec_vsum2sws, v4i32>; 601249423Sdim 602251662Sdimdef VSUM4SBS: VX1_Int_Ty3<1800, "vsum4sbs", int_ppc_altivec_vsum4sbs, 603249423Sdim v4i32, v16i8, v4i32>; 604249423Sdimdef VSUM4SHS: VX1_Int_Ty3<1608, "vsum4shs", int_ppc_altivec_vsum4shs, 605249423Sdim v4i32, v8i16, v4i32>; 606249423Sdimdef VSUM4UBS: VX1_Int_Ty3<1544, "vsum4ubs", int_ppc_altivec_vsum4ubs, 607249423Sdim v4i32, v16i8, v4i32>; 608249423Sdim 609251662Sdimdef VNOR : VXForm_1<1284, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 610276479Sdim "vnor $vD, $vA, $vB", IIC_VecFP, 611249423Sdim [(set v4i32:$vD, (vnot_ppc (or v4i32:$vA, 612249423Sdim v4i32:$vB)))]>; 613276479Sdimlet isCommutable = 1 in { 614251662Sdimdef VOR : VXForm_1<1156, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 615276479Sdim "vor $vD, $vA, $vB", IIC_VecFP, 616249423Sdim [(set v4i32:$vD, (or v4i32:$vA, v4i32:$vB))]>; 617251662Sdimdef VXOR : VXForm_1<1220, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 618276479Sdim "vxor $vD, $vA, $vB", IIC_VecFP, 619249423Sdim [(set v4i32:$vD, (xor v4i32:$vA, v4i32:$vB))]>; 620276479Sdim} // isCommutable 621193323Sed 622249423Sdimdef VRLB : VX1_Int_Ty< 4, "vrlb", int_ppc_altivec_vrlb, v16i8>; 623249423Sdimdef VRLH : VX1_Int_Ty< 68, "vrlh", int_ppc_altivec_vrlh, v8i16>; 624249423Sdimdef VRLW : VX1_Int_Ty< 132, "vrlw", int_ppc_altivec_vrlw, v4i32>; 625193323Sed 626249423Sdimdef VSL : VX1_Int_Ty< 452, "vsl" , int_ppc_altivec_vsl, v4i32 >; 627249423Sdimdef VSLO : VX1_Int_Ty<1036, "vslo", int_ppc_altivec_vslo, v4i32>; 628193323Sed 629249423Sdimdef VSLB : VX1_Int_Ty< 260, "vslb", int_ppc_altivec_vslb, v16i8>; 630249423Sdimdef VSLH : VX1_Int_Ty< 324, "vslh", int_ppc_altivec_vslh, v8i16>; 631249423Sdimdef VSLW : VX1_Int_Ty< 388, "vslw", int_ppc_altivec_vslw, v4i32>; 632249423Sdim 633251662Sdimdef VSPLTB : VXForm_1<524, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB), 634276479Sdim "vspltb $vD, $vB, $UIMM", IIC_VecPerm, 635249423Sdim [(set v16i8:$vD, 636249423Sdim (vspltb_shuffle:$UIMM v16i8:$vB, (undef)))]>; 637251662Sdimdef VSPLTH : VXForm_1<588, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB), 638276479Sdim "vsplth $vD, $vB, $UIMM", IIC_VecPerm, 639249423Sdim [(set v16i8:$vD, 640249423Sdim (vsplth_shuffle:$UIMM v16i8:$vB, (undef)))]>; 641251662Sdimdef VSPLTW : VXForm_1<652, (outs vrrc:$vD), (ins u5imm:$UIMM, vrrc:$vB), 642276479Sdim "vspltw $vD, $vB, $UIMM", IIC_VecPerm, 643249423Sdim [(set v16i8:$vD, 644249423Sdim (vspltw_shuffle:$UIMM v16i8:$vB, (undef)))]>; 645193323Sed 646249423Sdimdef VSR : VX1_Int_Ty< 708, "vsr" , int_ppc_altivec_vsr, v4i32>; 647249423Sdimdef VSRO : VX1_Int_Ty<1100, "vsro" , int_ppc_altivec_vsro, v4i32>; 648193323Sed 649249423Sdimdef VSRAB : VX1_Int_Ty< 772, "vsrab", int_ppc_altivec_vsrab, v16i8>; 650249423Sdimdef VSRAH : VX1_Int_Ty< 836, "vsrah", int_ppc_altivec_vsrah, v8i16>; 651249423Sdimdef VSRAW : VX1_Int_Ty< 900, "vsraw", int_ppc_altivec_vsraw, v4i32>; 652249423Sdimdef VSRB : VX1_Int_Ty< 516, "vsrb" , int_ppc_altivec_vsrb , v16i8>; 653249423Sdimdef VSRH : VX1_Int_Ty< 580, "vsrh" , int_ppc_altivec_vsrh , v8i16>; 654249423Sdimdef VSRW : VX1_Int_Ty< 644, "vsrw" , int_ppc_altivec_vsrw , v4i32>; 655193323Sed 656249423Sdim 657251662Sdimdef VSPLTISB : VXForm_3<780, (outs vrrc:$vD), (ins s5imm:$SIMM), 658276479Sdim "vspltisb $vD, $SIMM", IIC_VecPerm, 659249423Sdim [(set v16i8:$vD, (v16i8 vecspltisb:$SIMM))]>; 660251662Sdimdef VSPLTISH : VXForm_3<844, (outs vrrc:$vD), (ins s5imm:$SIMM), 661276479Sdim "vspltish $vD, $SIMM", IIC_VecPerm, 662249423Sdim [(set v8i16:$vD, (v8i16 vecspltish:$SIMM))]>; 663251662Sdimdef VSPLTISW : VXForm_3<908, (outs vrrc:$vD), (ins s5imm:$SIMM), 664276479Sdim "vspltisw $vD, $SIMM", IIC_VecPerm, 665249423Sdim [(set v4i32:$vD, (v4i32 vecspltisw:$SIMM))]>; 666193323Sed 667193323Sed// Vector Pack. 668249423Sdimdef VPKPX : VX1_Int_Ty2<782, "vpkpx", int_ppc_altivec_vpkpx, 669249423Sdim v8i16, v4i32>; 670249423Sdimdef VPKSHSS : VX1_Int_Ty2<398, "vpkshss", int_ppc_altivec_vpkshss, 671249423Sdim v16i8, v8i16>; 672249423Sdimdef VPKSHUS : VX1_Int_Ty2<270, "vpkshus", int_ppc_altivec_vpkshus, 673249423Sdim v16i8, v8i16>; 674249423Sdimdef VPKSWSS : VX1_Int_Ty2<462, "vpkswss", int_ppc_altivec_vpkswss, 675249423Sdim v16i8, v4i32>; 676249423Sdimdef VPKSWUS : VX1_Int_Ty2<334, "vpkswus", int_ppc_altivec_vpkswus, 677249423Sdim v8i16, v4i32>; 678251662Sdimdef VPKUHUM : VXForm_1<14, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 679276479Sdim "vpkuhum $vD, $vA, $vB", IIC_VecFP, 680249423Sdim [(set v16i8:$vD, 681249423Sdim (vpkuhum_shuffle v16i8:$vA, v16i8:$vB))]>; 682249423Sdimdef VPKUHUS : VX1_Int_Ty2<142, "vpkuhus", int_ppc_altivec_vpkuhus, 683249423Sdim v16i8, v8i16>; 684251662Sdimdef VPKUWUM : VXForm_1<78, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), 685276479Sdim "vpkuwum $vD, $vA, $vB", IIC_VecFP, 686249423Sdim [(set v16i8:$vD, 687249423Sdim (vpkuwum_shuffle v16i8:$vA, v16i8:$vB))]>; 688249423Sdimdef VPKUWUS : VX1_Int_Ty2<206, "vpkuwus", int_ppc_altivec_vpkuwus, 689249423Sdim v8i16, v4i32>; 690193323Sed 691193323Sed// Vector Unpack. 692249423Sdimdef VUPKHPX : VX2_Int_Ty2<846, "vupkhpx", int_ppc_altivec_vupkhpx, 693249423Sdim v4i32, v8i16>; 694249423Sdimdef VUPKHSB : VX2_Int_Ty2<526, "vupkhsb", int_ppc_altivec_vupkhsb, 695249423Sdim v8i16, v16i8>; 696249423Sdimdef VUPKHSH : VX2_Int_Ty2<590, "vupkhsh", int_ppc_altivec_vupkhsh, 697249423Sdim v4i32, v8i16>; 698249423Sdimdef VUPKLPX : VX2_Int_Ty2<974, "vupklpx", int_ppc_altivec_vupklpx, 699249423Sdim v4i32, v8i16>; 700249423Sdimdef VUPKLSB : VX2_Int_Ty2<654, "vupklsb", int_ppc_altivec_vupklsb, 701249423Sdim v8i16, v16i8>; 702249423Sdimdef VUPKLSH : VX2_Int_Ty2<718, "vupklsh", int_ppc_altivec_vupklsh, 703249423Sdim v4i32, v8i16>; 704193323Sed 705193323Sed 706193323Sed// Altivec Comparisons. 707193323Sed 708193323Sedclass VCMP<bits<10> xo, string asmstr, ValueType Ty> 709276479Sdim : VXRForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), asmstr, 710276479Sdim IIC_VecFPCompare, 711249423Sdim [(set Ty:$vD, (Ty (PPCvcmp Ty:$vA, Ty:$vB, xo)))]>; 712193323Sedclass VCMPo<bits<10> xo, string asmstr, ValueType Ty> 713276479Sdim : VXRForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB), asmstr, 714276479Sdim IIC_VecFPCompare, 715249423Sdim [(set Ty:$vD, (Ty (PPCvcmp_o Ty:$vA, Ty:$vB, xo)))]> { 716193323Sed let Defs = [CR6]; 717193323Sed let RC = 1; 718193323Sed} 719193323Sed 720193323Sed// f32 element comparisons.0 721193323Seddef VCMPBFP : VCMP <966, "vcmpbfp $vD, $vA, $vB" , v4f32>; 722193323Seddef VCMPBFPo : VCMPo<966, "vcmpbfp. $vD, $vA, $vB" , v4f32>; 723193323Seddef VCMPEQFP : VCMP <198, "vcmpeqfp $vD, $vA, $vB" , v4f32>; 724193323Seddef VCMPEQFPo : VCMPo<198, "vcmpeqfp. $vD, $vA, $vB", v4f32>; 725193323Seddef VCMPGEFP : VCMP <454, "vcmpgefp $vD, $vA, $vB" , v4f32>; 726193323Seddef VCMPGEFPo : VCMPo<454, "vcmpgefp. $vD, $vA, $vB", v4f32>; 727193323Seddef VCMPGTFP : VCMP <710, "vcmpgtfp $vD, $vA, $vB" , v4f32>; 728193323Seddef VCMPGTFPo : VCMPo<710, "vcmpgtfp. $vD, $vA, $vB", v4f32>; 729193323Sed 730193323Sed// i8 element comparisons. 731193323Seddef VCMPEQUB : VCMP < 6, "vcmpequb $vD, $vA, $vB" , v16i8>; 732193323Seddef VCMPEQUBo : VCMPo< 6, "vcmpequb. $vD, $vA, $vB", v16i8>; 733193323Seddef VCMPGTSB : VCMP <774, "vcmpgtsb $vD, $vA, $vB" , v16i8>; 734193323Seddef VCMPGTSBo : VCMPo<774, "vcmpgtsb. $vD, $vA, $vB", v16i8>; 735193323Seddef VCMPGTUB : VCMP <518, "vcmpgtub $vD, $vA, $vB" , v16i8>; 736193323Seddef VCMPGTUBo : VCMPo<518, "vcmpgtub. $vD, $vA, $vB", v16i8>; 737193323Sed 738193323Sed// i16 element comparisons. 739193323Seddef VCMPEQUH : VCMP < 70, "vcmpequh $vD, $vA, $vB" , v8i16>; 740193323Seddef VCMPEQUHo : VCMPo< 70, "vcmpequh. $vD, $vA, $vB", v8i16>; 741193323Seddef VCMPGTSH : VCMP <838, "vcmpgtsh $vD, $vA, $vB" , v8i16>; 742193323Seddef VCMPGTSHo : VCMPo<838, "vcmpgtsh. $vD, $vA, $vB", v8i16>; 743193323Seddef VCMPGTUH : VCMP <582, "vcmpgtuh $vD, $vA, $vB" , v8i16>; 744193323Seddef VCMPGTUHo : VCMPo<582, "vcmpgtuh. $vD, $vA, $vB", v8i16>; 745193323Sed 746193323Sed// i32 element comparisons. 747193323Seddef VCMPEQUW : VCMP <134, "vcmpequw $vD, $vA, $vB" , v4i32>; 748193323Seddef VCMPEQUWo : VCMPo<134, "vcmpequw. $vD, $vA, $vB", v4i32>; 749193323Seddef VCMPGTSW : VCMP <902, "vcmpgtsw $vD, $vA, $vB" , v4i32>; 750193323Seddef VCMPGTSWo : VCMPo<902, "vcmpgtsw. $vD, $vA, $vB", v4i32>; 751193323Seddef VCMPGTUW : VCMP <646, "vcmpgtuw $vD, $vA, $vB" , v4i32>; 752193323Seddef VCMPGTUWo : VCMPo<646, "vcmpgtuw. $vD, $vA, $vB", v4i32>; 753193323Sed 754261991Sdimlet isCodeGenOnly = 1 in { 755261991Sdimdef V_SET0B : VXForm_setzero<1220, (outs vrrc:$vD), (ins), 756276479Sdim "vxor $vD, $vD, $vD", IIC_VecFP, 757261991Sdim [(set v16i8:$vD, (v16i8 immAllZerosV))]>; 758261991Sdimdef V_SET0H : VXForm_setzero<1220, (outs vrrc:$vD), (ins), 759276479Sdim "vxor $vD, $vD, $vD", IIC_VecFP, 760261991Sdim [(set v8i16:$vD, (v8i16 immAllZerosV))]>; 761261991Sdimdef V_SET0 : VXForm_setzero<1220, (outs vrrc:$vD), (ins), 762276479Sdim "vxor $vD, $vD, $vD", IIC_VecFP, 763249423Sdim [(set v4i32:$vD, (v4i32 immAllZerosV))]>; 764261991Sdim 765249423Sdimlet IMM=-1 in { 766261991Sdimdef V_SETALLONESB : VXForm_3<908, (outs vrrc:$vD), (ins), 767276479Sdim "vspltisw $vD, -1", IIC_VecFP, 768261991Sdim [(set v16i8:$vD, (v16i8 immAllOnesV))]>; 769261991Sdimdef V_SETALLONESH : VXForm_3<908, (outs vrrc:$vD), (ins), 770276479Sdim "vspltisw $vD, -1", IIC_VecFP, 771261991Sdim [(set v8i16:$vD, (v8i16 immAllOnesV))]>; 772261991Sdimdef V_SETALLONES : VXForm_3<908, (outs vrrc:$vD), (ins), 773276479Sdim "vspltisw $vD, -1", IIC_VecFP, 774249423Sdim [(set v4i32:$vD, (v4i32 immAllOnesV))]>; 775193323Sed} 776261991Sdim} 777249423Sdim} // VALU Operations. 778193323Sed 779193323Sed//===----------------------------------------------------------------------===// 780193323Sed// Additional Altivec Patterns 781193323Sed// 782193323Sed 783193323Sed// Loads. 784193323Seddef : Pat<(v4i32 (load xoaddr:$src)), (LVX xoaddr:$src)>; 785193323Sed 786193323Sed// Stores. 787249423Sdimdef : Pat<(store v4i32:$rS, xoaddr:$dst), 788249423Sdim (STVX $rS, xoaddr:$dst)>; 789193323Sed 790193323Sed// Bit conversions. 791193323Seddef : Pat<(v16i8 (bitconvert (v8i16 VRRC:$src))), (v16i8 VRRC:$src)>; 792193323Seddef : Pat<(v16i8 (bitconvert (v4i32 VRRC:$src))), (v16i8 VRRC:$src)>; 793193323Seddef : Pat<(v16i8 (bitconvert (v4f32 VRRC:$src))), (v16i8 VRRC:$src)>; 794193323Sed 795193323Seddef : Pat<(v8i16 (bitconvert (v16i8 VRRC:$src))), (v8i16 VRRC:$src)>; 796193323Seddef : Pat<(v8i16 (bitconvert (v4i32 VRRC:$src))), (v8i16 VRRC:$src)>; 797193323Seddef : Pat<(v8i16 (bitconvert (v4f32 VRRC:$src))), (v8i16 VRRC:$src)>; 798193323Sed 799193323Seddef : Pat<(v4i32 (bitconvert (v16i8 VRRC:$src))), (v4i32 VRRC:$src)>; 800193323Seddef : Pat<(v4i32 (bitconvert (v8i16 VRRC:$src))), (v4i32 VRRC:$src)>; 801193323Seddef : Pat<(v4i32 (bitconvert (v4f32 VRRC:$src))), (v4i32 VRRC:$src)>; 802193323Sed 803193323Seddef : Pat<(v4f32 (bitconvert (v16i8 VRRC:$src))), (v4f32 VRRC:$src)>; 804193323Seddef : Pat<(v4f32 (bitconvert (v8i16 VRRC:$src))), (v4f32 VRRC:$src)>; 805193323Seddef : Pat<(v4f32 (bitconvert (v4i32 VRRC:$src))), (v4f32 VRRC:$src)>; 806193323Sed 807193323Sed// Shuffles. 808193323Sed 809193323Sed// Match vsldoi(x,x), vpkuwum(x,x), vpkuhum(x,x) 810249423Sdimdef:Pat<(vsldoi_unary_shuffle:$in v16i8:$vA, undef), 811249423Sdim (VSLDOI $vA, $vA, (VSLDOI_unary_get_imm $in))>; 812249423Sdimdef:Pat<(vpkuwum_unary_shuffle v16i8:$vA, undef), 813249423Sdim (VPKUWUM $vA, $vA)>; 814249423Sdimdef:Pat<(vpkuhum_unary_shuffle v16i8:$vA, undef), 815249423Sdim (VPKUHUM $vA, $vA)>; 816193323Sed 817276479Sdim// Match vsldoi(y,x), vpkuwum(y,x), vpkuhum(y,x), i.e., swapped operands. 818276479Sdim// These fragments are matched for little-endian, where the inputs must 819276479Sdim// be swapped for correct semantics. 820276479Sdimdef:Pat<(vsldoi_swapped_shuffle:$in v16i8:$vA, v16i8:$vB), 821276479Sdim (VSLDOI $vB, $vA, (VSLDOI_swapped_get_imm $in))>; 822276479Sdimdef:Pat<(vpkuwum_swapped_shuffle v16i8:$vA, v16i8:$vB), 823276479Sdim (VPKUWUM $vB, $vA)>; 824276479Sdimdef:Pat<(vpkuhum_swapped_shuffle v16i8:$vA, v16i8:$vB), 825276479Sdim (VPKUHUM $vB, $vA)>; 826276479Sdim 827193323Sed// Match vmrg*(x,x) 828249423Sdimdef:Pat<(vmrglb_unary_shuffle v16i8:$vA, undef), 829249423Sdim (VMRGLB $vA, $vA)>; 830249423Sdimdef:Pat<(vmrglh_unary_shuffle v16i8:$vA, undef), 831249423Sdim (VMRGLH $vA, $vA)>; 832249423Sdimdef:Pat<(vmrglw_unary_shuffle v16i8:$vA, undef), 833249423Sdim (VMRGLW $vA, $vA)>; 834249423Sdimdef:Pat<(vmrghb_unary_shuffle v16i8:$vA, undef), 835249423Sdim (VMRGHB $vA, $vA)>; 836249423Sdimdef:Pat<(vmrghh_unary_shuffle v16i8:$vA, undef), 837249423Sdim (VMRGHH $vA, $vA)>; 838249423Sdimdef:Pat<(vmrghw_unary_shuffle v16i8:$vA, undef), 839249423Sdim (VMRGHW $vA, $vA)>; 840193323Sed 841276479Sdim// Match vmrg*(y,x), i.e., swapped operands. These fragments 842276479Sdim// are matched for little-endian, where the inputs must be 843276479Sdim// swapped for correct semantics. 844276479Sdimdef:Pat<(vmrglb_swapped_shuffle v16i8:$vA, v16i8:$vB), 845276479Sdim (VMRGLB $vB, $vA)>; 846276479Sdimdef:Pat<(vmrglh_swapped_shuffle v16i8:$vA, v16i8:$vB), 847276479Sdim (VMRGLH $vB, $vA)>; 848276479Sdimdef:Pat<(vmrglw_swapped_shuffle v16i8:$vA, v16i8:$vB), 849276479Sdim (VMRGLW $vB, $vA)>; 850276479Sdimdef:Pat<(vmrghb_swapped_shuffle v16i8:$vA, v16i8:$vB), 851276479Sdim (VMRGHB $vB, $vA)>; 852276479Sdimdef:Pat<(vmrghh_swapped_shuffle v16i8:$vA, v16i8:$vB), 853276479Sdim (VMRGHH $vB, $vA)>; 854276479Sdimdef:Pat<(vmrghw_swapped_shuffle v16i8:$vA, v16i8:$vB), 855276479Sdim (VMRGHW $vB, $vA)>; 856276479Sdim 857193323Sed// Logical Operations 858249423Sdimdef : Pat<(vnot_ppc v4i32:$vA), (VNOR $vA, $vA)>; 859193323Sed 860249423Sdimdef : Pat<(vnot_ppc (or v4i32:$A, v4i32:$B)), 861249423Sdim (VNOR $A, $B)>; 862249423Sdimdef : Pat<(and v4i32:$A, (vnot_ppc v4i32:$B)), 863249423Sdim (VANDC $A, $B)>; 864193323Sed 865249423Sdimdef : Pat<(fmul v4f32:$vA, v4f32:$vB), 866249423Sdim (VMADDFP $vA, $vB, 867249423Sdim (v4i32 (VSLW (V_SETALLONES), (V_SETALLONES))))>; 868193323Sed 869193323Sed// Fused multiply add and multiply sub for packed float. These are represented 870193323Sed// separately from the real instructions above, for operations that must have 871193323Sed// the additional precision, such as Newton-Rhapson (used by divide, sqrt) 872249423Sdimdef : Pat<(PPCvmaddfp v4f32:$A, v4f32:$B, v4f32:$C), 873249423Sdim (VMADDFP $A, $B, $C)>; 874249423Sdimdef : Pat<(PPCvnmsubfp v4f32:$A, v4f32:$B, v4f32:$C), 875249423Sdim (VNMSUBFP $A, $B, $C)>; 876193323Sed 877249423Sdimdef : Pat<(int_ppc_altivec_vmaddfp v4f32:$A, v4f32:$B, v4f32:$C), 878249423Sdim (VMADDFP $A, $B, $C)>; 879249423Sdimdef : Pat<(int_ppc_altivec_vnmsubfp v4f32:$A, v4f32:$B, v4f32:$C), 880249423Sdim (VNMSUBFP $A, $B, $C)>; 881193323Sed 882249423Sdimdef : Pat<(PPCvperm v16i8:$vA, v16i8:$vB, v16i8:$vC), 883249423Sdim (VPERM $vA, $vB, $vC)>; 884193630Sed 885249423Sdimdef : Pat<(PPCfre v4f32:$A), (VREFP $A)>; 886249423Sdimdef : Pat<(PPCfrsqrte v4f32:$A), (VRSQRTEFP $A)>; 887249423Sdim 888193630Sed// Vector shifts 889249423Sdimdef : Pat<(v16i8 (shl v16i8:$vA, v16i8:$vB)), 890249423Sdim (v16i8 (VSLB $vA, $vB))>; 891249423Sdimdef : Pat<(v8i16 (shl v8i16:$vA, v8i16:$vB)), 892249423Sdim (v8i16 (VSLH $vA, $vB))>; 893249423Sdimdef : Pat<(v4i32 (shl v4i32:$vA, v4i32:$vB)), 894249423Sdim (v4i32 (VSLW $vA, $vB))>; 895193630Sed 896249423Sdimdef : Pat<(v16i8 (srl v16i8:$vA, v16i8:$vB)), 897249423Sdim (v16i8 (VSRB $vA, $vB))>; 898249423Sdimdef : Pat<(v8i16 (srl v8i16:$vA, v8i16:$vB)), 899249423Sdim (v8i16 (VSRH $vA, $vB))>; 900249423Sdimdef : Pat<(v4i32 (srl v4i32:$vA, v4i32:$vB)), 901249423Sdim (v4i32 (VSRW $vA, $vB))>; 902193630Sed 903249423Sdimdef : Pat<(v16i8 (sra v16i8:$vA, v16i8:$vB)), 904249423Sdim (v16i8 (VSRAB $vA, $vB))>; 905249423Sdimdef : Pat<(v8i16 (sra v8i16:$vA, v8i16:$vB)), 906249423Sdim (v8i16 (VSRAH $vA, $vB))>; 907249423Sdimdef : Pat<(v4i32 (sra v4i32:$vA, v4i32:$vB)), 908249423Sdim (v4i32 (VSRAW $vA, $vB))>; 909243830Sdim 910243830Sdim// Float to integer and integer to float conversions 911249423Sdimdef : Pat<(v4i32 (fp_to_sint v4f32:$vA)), 912249423Sdim (VCTSXS_0 $vA)>; 913249423Sdimdef : Pat<(v4i32 (fp_to_uint v4f32:$vA)), 914249423Sdim (VCTUXS_0 $vA)>; 915249423Sdimdef : Pat<(v4f32 (sint_to_fp v4i32:$vA)), 916249423Sdim (VCFSX_0 $vA)>; 917249423Sdimdef : Pat<(v4f32 (uint_to_fp v4i32:$vA)), 918249423Sdim (VCFUX_0 $vA)>; 919249423Sdim 920249423Sdim// Floating-point rounding 921249423Sdimdef : Pat<(v4f32 (ffloor v4f32:$vA)), 922249423Sdim (VRFIM $vA)>; 923249423Sdimdef : Pat<(v4f32 (fceil v4f32:$vA)), 924249423Sdim (VRFIP $vA)>; 925249423Sdimdef : Pat<(v4f32 (ftrunc v4f32:$vA)), 926249423Sdim (VRFIZ $vA)>; 927249423Sdimdef : Pat<(v4f32 (fnearbyint v4f32:$vA)), 928249423Sdim (VRFIN $vA)>; 929249423Sdim 930249423Sdim} // end HasAltivec 931249423Sdim 932