Home | History | Annotate | Download | only in PowerPC
      1 //===- PPCInstrVSX.td - The PowerPC VSX Extension --*- tablegen -*-===//
      2 // 
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 // 
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file describes the VSX extension to the PowerPC instruction set.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 def PPCRegVSRCAsmOperand : AsmOperandClass {
     15   let Name = "RegVSRC"; let PredicateMethod = "isVSRegNumber";
     16 }
     17 def vsrc : RegisterOperand<VSRC> {
     18   let ParserMatchClass = PPCRegVSRCAsmOperand;
     19 }
     20 
     21 def PPCRegVSFRCAsmOperand : AsmOperandClass {
     22   let Name = "RegVSFRC"; let PredicateMethod = "isVSRegNumber";
     23 }
     24 def vsfrc : RegisterOperand<VSFRC> {
     25   let ParserMatchClass = PPCRegVSFRCAsmOperand;
     26 }
     27 
     28 multiclass XX3Form_Rcr<bits<6> opcode, bits<7> xo, dag OOL, dag IOL,
     29                     string asmbase, string asmstr, InstrItinClass itin,
     30                     list<dag> pattern> {
     31   let BaseName = asmbase in {
     32     def NAME : XX3Form_Rc<opcode, xo, OOL, IOL,
     33                        !strconcat(asmbase, !strconcat(" ", asmstr)), itin,
     34                        pattern>;
     35     let Defs = [CR6] in
     36     def o    : XX3Form_Rc<opcode, xo, OOL, IOL,
     37                        !strconcat(asmbase, !strconcat(". ", asmstr)), itin,
     38                        []>, isDOT;
     39   }
     40 }
     41 
     42 def HasVSX : Predicate<"PPCSubTarget->hasVSX()">;
     43 let Predicates = [HasVSX] in {
     44 let AddedComplexity = 400 in { // Prefer VSX patterns over non-VSX patterns.
     45 let neverHasSideEffects = 1 in { // VSX instructions don't have side effects.
     46 let Uses = [RM] in {
     47 
     48   // Load indexed instructions
     49   let mayLoad = 1, canFoldAsLoad = 1 in {
     50     def LXSDX : XForm_1<31, 588,
     51                         (outs vsfrc:$XT), (ins memrr:$src),
     52                         "lxsdx $XT, $src", IIC_LdStLFD,
     53                         [(set f64:$XT, (load xoaddr:$src))]>;
     54 
     55     def LXVD2X : XForm_1<31, 844,
     56                          (outs vsrc:$XT), (ins memrr:$src),
     57                          "lxvd2x $XT, $src", IIC_LdStLFD,
     58                          [(set v2f64:$XT, (load xoaddr:$src))]>;
     59 
     60     def LXVDSX : XForm_1<31, 332,
     61                          (outs vsrc:$XT), (ins memrr:$src),
     62                          "lxvdsx $XT, $src", IIC_LdStLFD, []>;
     63 
     64     def LXVW4X : XForm_1<31, 780,
     65                          (outs vsrc:$XT), (ins memrr:$src),
     66                          "lxvw4x $XT, $src", IIC_LdStLFD, []>;
     67   }
     68 
     69   // Store indexed instructions
     70   let mayStore = 1 in {
     71     def STXSDX : XX1Form<31, 716,
     72                         (outs), (ins vsfrc:$XT, memrr:$dst),
     73                         "stxsdx $XT, $dst", IIC_LdStSTFD,
     74                         [(store f64:$XT, xoaddr:$dst)]>;
     75 
     76     def STXVD2X : XX1Form<31, 972,
     77                          (outs), (ins vsrc:$XT, memrr:$dst),
     78                          "stxvd2x $XT, $dst", IIC_LdStSTFD,
     79                          [(store v2f64:$XT, xoaddr:$dst)]>;
     80 
     81     def STXVW4X : XX1Form<31, 908,
     82                          (outs), (ins vsrc:$XT, memrr:$dst),
     83                          "stxvw4x $XT, $dst", IIC_LdStSTFD, []>;
     84   }
     85 
     86   // Add/Mul Instructions
     87   let isCommutable = 1 in {
     88     def XSADDDP : XX3Form<60, 32,
     89                           (outs vsfrc:$XT), (ins vsfrc:$XA, vsfrc:$XB),
     90                           "xsadddp $XT, $XA, $XB", IIC_VecFP,
     91                           [(set f64:$XT, (fadd f64:$XA, f64:$XB))]>;
     92     def XSMULDP : XX3Form<60, 48,
     93                           (outs vsfrc:$XT), (ins vsfrc:$XA, vsfrc:$XB),
     94                           "xsmuldp $XT, $XA, $XB", IIC_VecFP,
     95                           [(set f64:$XT, (fmul f64:$XA, f64:$XB))]>;
     96 
     97     def XVADDDP : XX3Form<60, 96,
     98                           (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
     99                           "xvadddp $XT, $XA, $XB", IIC_VecFP,
    100                           [(set v2f64:$XT, (fadd v2f64:$XA, v2f64:$XB))]>;
    101 
    102     def XVADDSP : XX3Form<60, 64,
    103                           (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    104                           "xvaddsp $XT, $XA, $XB", IIC_VecFP,
    105                           [(set v4f32:$XT, (fadd v4f32:$XA, v4f32:$XB))]>;
    106 
    107     def XVMULDP : XX3Form<60, 112,
    108                           (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    109                           "xvmuldp $XT, $XA, $XB", IIC_VecFP,
    110                           [(set v2f64:$XT, (fmul v2f64:$XA, v2f64:$XB))]>;
    111 
    112     def XVMULSP : XX3Form<60, 80,
    113                           (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    114                           "xvmulsp $XT, $XA, $XB", IIC_VecFP,
    115                           [(set v4f32:$XT, (fmul v4f32:$XA, v4f32:$XB))]>;
    116   }
    117 
    118   // Subtract Instructions
    119   def XSSUBDP : XX3Form<60, 40,
    120                         (outs vsfrc:$XT), (ins vsfrc:$XA, vsfrc:$XB),
    121                         "xssubdp $XT, $XA, $XB", IIC_VecFP,
    122                         [(set f64:$XT, (fsub f64:$XA, f64:$XB))]>;
    123 
    124   def XVSUBDP : XX3Form<60, 104,
    125                         (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    126                         "xvsubdp $XT, $XA, $XB", IIC_VecFP,
    127                         [(set v2f64:$XT, (fsub v2f64:$XA, v2f64:$XB))]>;
    128   def XVSUBSP : XX3Form<60, 72,
    129                         (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    130                         "xvsubsp $XT, $XA, $XB", IIC_VecFP,
    131                         [(set v4f32:$XT, (fsub v4f32:$XA, v4f32:$XB))]>;
    132 
    133   // FMA Instructions
    134   let BaseName = "XSMADDADP" in {
    135   let isCommutable = 1 in
    136   def XSMADDADP : XX3Form<60, 33,
    137                           (outs vsfrc:$XT), (ins vsfrc:$XTi, vsfrc:$XA, vsfrc:$XB),
    138                           "xsmaddadp $XT, $XA, $XB", IIC_VecFP,
    139                           [(set f64:$XT, (fma f64:$XA, f64:$XB, f64:$XTi))]>,
    140                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    141                           AltVSXFMARel;
    142   let IsVSXFMAAlt = 1 in
    143   def XSMADDMDP : XX3Form<60, 41,
    144                           (outs vsfrc:$XT), (ins vsfrc:$XTi, vsfrc:$XA, vsfrc:$XB),
    145                           "xsmaddmdp $XT, $XA, $XB", IIC_VecFP, []>,
    146                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    147                           AltVSXFMARel;
    148   }
    149 
    150   let BaseName = "XSMSUBADP" in {
    151   let isCommutable = 1 in
    152   def XSMSUBADP : XX3Form<60, 49,
    153                           (outs vsfrc:$XT), (ins vsfrc:$XTi, vsfrc:$XA, vsfrc:$XB),
    154                           "xsmsubadp $XT, $XA, $XB", IIC_VecFP,
    155                           [(set f64:$XT, (fma f64:$XA, f64:$XB, (fneg f64:$XTi)))]>,
    156                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    157                           AltVSXFMARel;
    158   let IsVSXFMAAlt = 1 in
    159   def XSMSUBMDP : XX3Form<60, 57,
    160                           (outs vsfrc:$XT), (ins vsfrc:$XTi, vsfrc:$XA, vsfrc:$XB),
    161                           "xsmsubmdp $XT, $XA, $XB", IIC_VecFP, []>,
    162                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    163                           AltVSXFMARel;
    164   }
    165 
    166   let BaseName = "XSNMADDADP" in {
    167   let isCommutable = 1 in
    168   def XSNMADDADP : XX3Form<60, 161,
    169                           (outs vsfrc:$XT), (ins vsfrc:$XTi, vsfrc:$XA, vsfrc:$XB),
    170                           "xsnmaddadp $XT, $XA, $XB", IIC_VecFP,
    171                           [(set f64:$XT, (fneg (fma f64:$XA, f64:$XB, f64:$XTi)))]>,
    172                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    173                           AltVSXFMARel;
    174   let IsVSXFMAAlt = 1 in
    175   def XSNMADDMDP : XX3Form<60, 169,
    176                           (outs vsfrc:$XT), (ins vsfrc:$XTi, vsfrc:$XA, vsfrc:$XB),
    177                           "xsnmaddmdp $XT, $XA, $XB", IIC_VecFP, []>,
    178                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    179                           AltVSXFMARel;
    180   }
    181 
    182   let BaseName = "XSNMSUBADP" in {
    183   let isCommutable = 1 in
    184   def XSNMSUBADP : XX3Form<60, 177,
    185                           (outs vsfrc:$XT), (ins vsfrc:$XTi, vsfrc:$XA, vsfrc:$XB),
    186                           "xsnmsubadp $XT, $XA, $XB", IIC_VecFP,
    187                           [(set f64:$XT, (fneg (fma f64:$XA, f64:$XB, (fneg f64:$XTi))))]>,
    188                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    189                           AltVSXFMARel;
    190   let IsVSXFMAAlt = 1 in
    191   def XSNMSUBMDP : XX3Form<60, 185,
    192                           (outs vsfrc:$XT), (ins vsfrc:$XTi, vsfrc:$XA, vsfrc:$XB),
    193                           "xsnmsubmdp $XT, $XA, $XB", IIC_VecFP, []>,
    194                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    195                           AltVSXFMARel;
    196   }
    197 
    198   let BaseName = "XVMADDADP" in {
    199   let isCommutable = 1 in
    200   def XVMADDADP : XX3Form<60, 97,
    201                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    202                           "xvmaddadp $XT, $XA, $XB", IIC_VecFP,
    203                           [(set v2f64:$XT, (fma v2f64:$XA, v2f64:$XB, v2f64:$XTi))]>,
    204                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    205                           AltVSXFMARel;
    206   let IsVSXFMAAlt = 1 in
    207   def XVMADDMDP : XX3Form<60, 105,
    208                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    209                           "xvmaddmdp $XT, $XA, $XB", IIC_VecFP, []>,
    210                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    211                           AltVSXFMARel;
    212   }
    213 
    214   let BaseName = "XVMADDASP" in {
    215   let isCommutable = 1 in
    216   def XVMADDASP : XX3Form<60, 65,
    217                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    218                           "xvmaddasp $XT, $XA, $XB", IIC_VecFP,
    219                           [(set v4f32:$XT, (fma v4f32:$XA, v4f32:$XB, v4f32:$XTi))]>,
    220                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    221                           AltVSXFMARel;
    222   let IsVSXFMAAlt = 1 in
    223   def XVMADDMSP : XX3Form<60, 73,
    224                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    225                           "xvmaddmsp $XT, $XA, $XB", IIC_VecFP, []>,
    226                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    227                           AltVSXFMARel;
    228   }
    229 
    230   let BaseName = "XVMSUBADP" in {
    231   let isCommutable = 1 in
    232   def XVMSUBADP : XX3Form<60, 113,
    233                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    234                           "xvmsubadp $XT, $XA, $XB", IIC_VecFP,
    235                           [(set v2f64:$XT, (fma v2f64:$XA, v2f64:$XB, (fneg v2f64:$XTi)))]>,
    236                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    237                           AltVSXFMARel;
    238   let IsVSXFMAAlt = 1 in
    239   def XVMSUBMDP : XX3Form<60, 121,
    240                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    241                           "xvmsubmdp $XT, $XA, $XB", IIC_VecFP, []>,
    242                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    243                           AltVSXFMARel;
    244   }
    245 
    246   let BaseName = "XVMSUBASP" in {
    247   let isCommutable = 1 in
    248   def XVMSUBASP : XX3Form<60, 81,
    249                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    250                           "xvmsubasp $XT, $XA, $XB", IIC_VecFP,
    251                           [(set v4f32:$XT, (fma v4f32:$XA, v4f32:$XB, (fneg v4f32:$XTi)))]>,
    252                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    253                           AltVSXFMARel;
    254   let IsVSXFMAAlt = 1 in
    255   def XVMSUBMSP : XX3Form<60, 89,
    256                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    257                           "xvmsubmsp $XT, $XA, $XB", IIC_VecFP, []>,
    258                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    259                           AltVSXFMARel;
    260   }
    261 
    262   let BaseName = "XVNMADDADP" in {
    263   let isCommutable = 1 in
    264   def XVNMADDADP : XX3Form<60, 225,
    265                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    266                           "xvnmaddadp $XT, $XA, $XB", IIC_VecFP,
    267                           [(set v2f64:$XT, (fneg (fma v2f64:$XA, v2f64:$XB, v2f64:$XTi)))]>,
    268                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    269                           AltVSXFMARel;
    270   let IsVSXFMAAlt = 1 in
    271   def XVNMADDMDP : XX3Form<60, 233,
    272                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    273                           "xvnmaddmdp $XT, $XA, $XB", IIC_VecFP, []>,
    274                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    275                           AltVSXFMARel;
    276   }
    277 
    278   let BaseName = "XVNMADDASP" in {
    279   let isCommutable = 1 in
    280   def XVNMADDASP : XX3Form<60, 193,
    281                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    282                           "xvnmaddasp $XT, $XA, $XB", IIC_VecFP,
    283                           [(set v4f32:$XT, (fneg (fma v4f32:$XA, v4f32:$XB, v4f32:$XTi)))]>,
    284                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    285                           AltVSXFMARel;
    286   let IsVSXFMAAlt = 1 in
    287   def XVNMADDMSP : XX3Form<60, 201,
    288                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    289                           "xvnmaddmsp $XT, $XA, $XB", IIC_VecFP, []>,
    290                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    291                           AltVSXFMARel;
    292   }
    293 
    294   let BaseName = "XVNMSUBADP" in {
    295   let isCommutable = 1 in
    296   def XVNMSUBADP : XX3Form<60, 241,
    297                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    298                           "xvnmsubadp $XT, $XA, $XB", IIC_VecFP,
    299                           [(set v2f64:$XT, (fneg (fma v2f64:$XA, v2f64:$XB, (fneg v2f64:$XTi))))]>,
    300                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    301                           AltVSXFMARel;
    302   let IsVSXFMAAlt = 1 in
    303   def XVNMSUBMDP : XX3Form<60, 249,
    304                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    305                           "xvnmsubmdp $XT, $XA, $XB", IIC_VecFP, []>,
    306                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    307                           AltVSXFMARel;
    308   }
    309 
    310   let BaseName = "XVNMSUBASP" in {
    311   let isCommutable = 1 in
    312   def XVNMSUBASP : XX3Form<60, 209,
    313                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    314                           "xvnmsubasp $XT, $XA, $XB", IIC_VecFP,
    315                           [(set v4f32:$XT, (fneg (fma v4f32:$XA, v4f32:$XB, (fneg v4f32:$XTi))))]>,
    316                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    317                           AltVSXFMARel;
    318   let IsVSXFMAAlt = 1 in
    319   def XVNMSUBMSP : XX3Form<60, 217,
    320                           (outs vsrc:$XT), (ins vsrc:$XTi, vsrc:$XA, vsrc:$XB),
    321                           "xvnmsubmsp $XT, $XA, $XB", IIC_VecFP, []>,
    322                           RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
    323                           AltVSXFMARel;
    324   }
    325 
    326   // Division Instructions
    327   def XSDIVDP : XX3Form<60, 56,
    328                         (outs vsfrc:$XT), (ins vsfrc:$XA, vsfrc:$XB),
    329                         "xsdivdp $XT, $XA, $XB", IIC_FPDivD,
    330                         [(set f64:$XT, (fdiv f64:$XA, f64:$XB))]>;
    331   def XSSQRTDP : XX2Form<60, 75,
    332                         (outs vsfrc:$XT), (ins vsfrc:$XB),
    333                         "xssqrtdp $XT, $XB", IIC_FPSqrtD,
    334                         [(set f64:$XT, (fsqrt f64:$XB))]>;
    335 
    336   def XSREDP : XX2Form<60, 90,
    337                         (outs vsfrc:$XT), (ins vsfrc:$XB),
    338                         "xsredp $XT, $XB", IIC_VecFP,
    339                         [(set f64:$XT, (PPCfre f64:$XB))]>;
    340   def XSRSQRTEDP : XX2Form<60, 74,
    341                            (outs vsfrc:$XT), (ins vsfrc:$XB),
    342                            "xsrsqrtedp $XT, $XB", IIC_VecFP,
    343                            [(set f64:$XT, (PPCfrsqrte f64:$XB))]>;
    344 
    345   def XSTDIVDP : XX3Form_1<60, 61,
    346                          (outs crrc:$crD), (ins vsfrc:$XA, vsfrc:$XB),
    347                          "xstdivdp $crD, $XA, $XB", IIC_FPCompare, []>;
    348   def XSTSQRTDP : XX2Form_1<60, 106,
    349                           (outs crrc:$crD), (ins vsfrc:$XB),
    350                           "xstsqrtdp $crD, $XB", IIC_FPCompare, []>;
    351 
    352   def XVDIVDP : XX3Form<60, 120,
    353                         (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    354                         "xvdivdp $XT, $XA, $XB", IIC_FPDivD,
    355                         [(set v2f64:$XT, (fdiv v2f64:$XA, v2f64:$XB))]>;
    356   def XVDIVSP : XX3Form<60, 88,
    357                         (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    358                         "xvdivsp $XT, $XA, $XB", IIC_FPDivS,
    359                         [(set v4f32:$XT, (fdiv v4f32:$XA, v4f32:$XB))]>;
    360 
    361   def XVSQRTDP : XX2Form<60, 203,
    362                         (outs vsrc:$XT), (ins vsrc:$XB),
    363                         "xvsqrtdp $XT, $XB", IIC_FPSqrtD,
    364                         [(set v2f64:$XT, (fsqrt v2f64:$XB))]>;
    365   def XVSQRTSP : XX2Form<60, 139,
    366                         (outs vsrc:$XT), (ins vsrc:$XB),
    367                         "xvsqrtsp $XT, $XB", IIC_FPSqrtS,
    368                         [(set v4f32:$XT, (fsqrt v4f32:$XB))]>;
    369 
    370   def XVTDIVDP : XX3Form_1<60, 125,
    371                          (outs crrc:$crD), (ins vsrc:$XA, vsrc:$XB),
    372                          "xvtdivdp $crD, $XA, $XB", IIC_FPCompare, []>;
    373   def XVTDIVSP : XX3Form_1<60, 93,
    374                          (outs crrc:$crD), (ins vsrc:$XA, vsrc:$XB),
    375                          "xvtdivsp $crD, $XA, $XB", IIC_FPCompare, []>;
    376 
    377   def XVTSQRTDP : XX2Form_1<60, 234,
    378                           (outs crrc:$crD), (ins vsrc:$XB),
    379                           "xvtsqrtdp $crD, $XB", IIC_FPCompare, []>;
    380   def XVTSQRTSP : XX2Form_1<60, 170,
    381                           (outs crrc:$crD), (ins vsrc:$XB),
    382                           "xvtsqrtsp $crD, $XB", IIC_FPCompare, []>;
    383 
    384   def XVREDP : XX2Form<60, 218,
    385                         (outs vsrc:$XT), (ins vsrc:$XB),
    386                         "xvredp $XT, $XB", IIC_VecFP,
    387                         [(set v2f64:$XT, (PPCfre v2f64:$XB))]>;
    388   def XVRESP : XX2Form<60, 154,
    389                         (outs vsrc:$XT), (ins vsrc:$XB),
    390                         "xvresp $XT, $XB", IIC_VecFP,
    391                         [(set v4f32:$XT, (PPCfre v4f32:$XB))]>;
    392 
    393   def XVRSQRTEDP : XX2Form<60, 202,
    394                            (outs vsrc:$XT), (ins vsrc:$XB),
    395                            "xvrsqrtedp $XT, $XB", IIC_VecFP,
    396                            [(set v2f64:$XT, (PPCfrsqrte v2f64:$XB))]>;
    397   def XVRSQRTESP : XX2Form<60, 138,
    398                            (outs vsrc:$XT), (ins vsrc:$XB),
    399                            "xvrsqrtesp $XT, $XB", IIC_VecFP,
    400                            [(set v4f32:$XT, (PPCfrsqrte v4f32:$XB))]>;
    401 
    402   // Compare Instructions
    403   def XSCMPODP : XX3Form_1<60, 43,
    404                            (outs crrc:$crD), (ins vsfrc:$XA, vsfrc:$XB),
    405                            "xscmpodp $crD, $XA, $XB", IIC_FPCompare, []>;
    406   def XSCMPUDP : XX3Form_1<60, 35,
    407                            (outs crrc:$crD), (ins vsfrc:$XA, vsfrc:$XB),
    408                            "xscmpudp $crD, $XA, $XB", IIC_FPCompare, []>;
    409 
    410   defm XVCMPEQDP : XX3Form_Rcr<60, 99,
    411                              (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    412                              "xvcmpeqdp", "$XT, $XA, $XB", IIC_VecFPCompare, []>;
    413   defm XVCMPEQSP : XX3Form_Rcr<60, 67,
    414                              (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    415                              "xvcmpeqsp", "$XT, $XA, $XB", IIC_VecFPCompare, []>;
    416   defm XVCMPGEDP : XX3Form_Rcr<60, 115,
    417                              (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    418                              "xvcmpgedp", "$XT, $XA, $XB", IIC_VecFPCompare, []>;
    419   defm XVCMPGESP : XX3Form_Rcr<60, 83,
    420                              (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    421                              "xvcmpgesp", "$XT, $XA, $XB", IIC_VecFPCompare, []>;
    422   defm XVCMPGTDP : XX3Form_Rcr<60, 107,
    423                              (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    424                              "xvcmpgtdp", "$XT, $XA, $XB", IIC_VecFPCompare, []>;
    425   defm XVCMPGTSP : XX3Form_Rcr<60, 75,
    426                              (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    427                              "xvcmpgtsp", "$XT, $XA, $XB", IIC_VecFPCompare, []>;
    428 
    429   // Move Instructions
    430   def XSABSDP : XX2Form<60, 345,
    431                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    432                       "xsabsdp $XT, $XB", IIC_VecFP,
    433                       [(set f64:$XT, (fabs f64:$XB))]>;
    434   def XSNABSDP : XX2Form<60, 361,
    435                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    436                       "xsnabsdp $XT, $XB", IIC_VecFP,
    437                       [(set f64:$XT, (fneg (fabs f64:$XB)))]>;
    438   def XSNEGDP : XX2Form<60, 377,
    439                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    440                       "xsnegdp $XT, $XB", IIC_VecFP,
    441                       [(set f64:$XT, (fneg f64:$XB))]>;
    442   def XSCPSGNDP : XX3Form<60, 176,
    443                       (outs vsfrc:$XT), (ins vsfrc:$XA, vsfrc:$XB),
    444                       "xscpsgndp $XT, $XA, $XB", IIC_VecFP,
    445                       [(set f64:$XT, (fcopysign f64:$XB, f64:$XA))]>;
    446 
    447   def XVABSDP : XX2Form<60, 473,
    448                       (outs vsrc:$XT), (ins vsrc:$XB),
    449                       "xvabsdp $XT, $XB", IIC_VecFP,
    450                       [(set v2f64:$XT, (fabs v2f64:$XB))]>;
    451 
    452   def XVABSSP : XX2Form<60, 409,
    453                       (outs vsrc:$XT), (ins vsrc:$XB),
    454                       "xvabssp $XT, $XB", IIC_VecFP,
    455                       [(set v4f32:$XT, (fabs v4f32:$XB))]>;
    456 
    457   def XVCPSGNDP : XX3Form<60, 240,
    458                       (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    459                       "xvcpsgndp $XT, $XA, $XB", IIC_VecFP,
    460                       [(set v2f64:$XT, (fcopysign v2f64:$XB, v2f64:$XA))]>;
    461   def XVCPSGNSP : XX3Form<60, 208,
    462                       (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    463                       "xvcpsgnsp $XT, $XA, $XB", IIC_VecFP,
    464                       [(set v4f32:$XT, (fcopysign v4f32:$XB, v4f32:$XA))]>;
    465 
    466   def XVNABSDP : XX2Form<60, 489,
    467                       (outs vsrc:$XT), (ins vsrc:$XB),
    468                       "xvnabsdp $XT, $XB", IIC_VecFP,
    469                       [(set v2f64:$XT, (fneg (fabs v2f64:$XB)))]>;
    470   def XVNABSSP : XX2Form<60, 425,
    471                       (outs vsrc:$XT), (ins vsrc:$XB),
    472                       "xvnabssp $XT, $XB", IIC_VecFP,
    473                       [(set v4f32:$XT, (fneg (fabs v4f32:$XB)))]>;
    474 
    475   def XVNEGDP : XX2Form<60, 505,
    476                       (outs vsrc:$XT), (ins vsrc:$XB),
    477                       "xvnegdp $XT, $XB", IIC_VecFP,
    478                       [(set v2f64:$XT, (fneg v2f64:$XB))]>;
    479   def XVNEGSP : XX2Form<60, 441,
    480                       (outs vsrc:$XT), (ins vsrc:$XB),
    481                       "xvnegsp $XT, $XB", IIC_VecFP,
    482                       [(set v4f32:$XT, (fneg v4f32:$XB))]>;
    483 
    484   // Conversion Instructions
    485   def XSCVDPSP : XX2Form<60, 265,
    486                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    487                       "xscvdpsp $XT, $XB", IIC_VecFP, []>;
    488   def XSCVDPSXDS : XX2Form<60, 344,
    489                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    490                       "xscvdpsxds $XT, $XB", IIC_VecFP,
    491                       [(set f64:$XT, (PPCfctidz f64:$XB))]>;
    492   def XSCVDPSXWS : XX2Form<60, 88,
    493                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    494                       "xscvdpsxws $XT, $XB", IIC_VecFP,
    495                       [(set f64:$XT, (PPCfctiwz f64:$XB))]>;
    496   def XSCVDPUXDS : XX2Form<60, 328,
    497                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    498                       "xscvdpuxds $XT, $XB", IIC_VecFP,
    499                       [(set f64:$XT, (PPCfctiduz f64:$XB))]>;
    500   def XSCVDPUXWS : XX2Form<60, 72,
    501                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    502                       "xscvdpuxws $XT, $XB", IIC_VecFP,
    503                       [(set f64:$XT, (PPCfctiwuz f64:$XB))]>;
    504   def XSCVSPDP : XX2Form<60, 329,
    505                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    506                       "xscvspdp $XT, $XB", IIC_VecFP, []>;
    507   def XSCVSXDDP : XX2Form<60, 376,
    508                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    509                       "xscvsxddp $XT, $XB", IIC_VecFP,
    510                       [(set f64:$XT, (PPCfcfid f64:$XB))]>;
    511   def XSCVUXDDP : XX2Form<60, 360,
    512                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    513                       "xscvuxddp $XT, $XB", IIC_VecFP,
    514                       [(set f64:$XT, (PPCfcfidu f64:$XB))]>;
    515 
    516   def XVCVDPSP : XX2Form<60, 393,
    517                       (outs vsrc:$XT), (ins vsrc:$XB),
    518                       "xvcvdpsp $XT, $XB", IIC_VecFP, []>;
    519   def XVCVDPSXDS : XX2Form<60, 472,
    520                       (outs vsrc:$XT), (ins vsrc:$XB),
    521                       "xvcvdpsxds $XT, $XB", IIC_VecFP,
    522                       [(set v2i64:$XT, (fp_to_sint v2f64:$XB))]>;
    523   def XVCVDPSXWS : XX2Form<60, 216,
    524                       (outs vsrc:$XT), (ins vsrc:$XB),
    525                       "xvcvdpsxws $XT, $XB", IIC_VecFP, []>;
    526   def XVCVDPUXDS : XX2Form<60, 456,
    527                       (outs vsrc:$XT), (ins vsrc:$XB),
    528                       "xvcvdpuxds $XT, $XB", IIC_VecFP,
    529                       [(set v2i64:$XT, (fp_to_uint v2f64:$XB))]>;
    530   def XVCVDPUXWS : XX2Form<60, 200,
    531                       (outs vsrc:$XT), (ins vsrc:$XB),
    532                       "xvcvdpuxws $XT, $XB", IIC_VecFP, []>;
    533 
    534   def XVCVSPDP : XX2Form<60, 457,
    535                       (outs vsrc:$XT), (ins vsrc:$XB),
    536                       "xvcvspdp $XT, $XB", IIC_VecFP, []>;
    537   def XVCVSPSXDS : XX2Form<60, 408,
    538                       (outs vsrc:$XT), (ins vsrc:$XB),
    539                       "xvcvspsxds $XT, $XB", IIC_VecFP, []>;
    540   def XVCVSPSXWS : XX2Form<60, 152,
    541                       (outs vsrc:$XT), (ins vsrc:$XB),
    542                       "xvcvspsxws $XT, $XB", IIC_VecFP, []>;
    543   def XVCVSPUXDS : XX2Form<60, 392,
    544                       (outs vsrc:$XT), (ins vsrc:$XB),
    545                       "xvcvspuxds $XT, $XB", IIC_VecFP, []>;
    546   def XVCVSPUXWS : XX2Form<60, 136,
    547                       (outs vsrc:$XT), (ins vsrc:$XB),
    548                       "xvcvspuxws $XT, $XB", IIC_VecFP, []>;
    549   def XVCVSXDDP : XX2Form<60, 504,
    550                       (outs vsrc:$XT), (ins vsrc:$XB),
    551                       "xvcvsxddp $XT, $XB", IIC_VecFP,
    552                       [(set v2f64:$XT, (sint_to_fp v2i64:$XB))]>;
    553   def XVCVSXDSP : XX2Form<60, 440,
    554                       (outs vsrc:$XT), (ins vsrc:$XB),
    555                       "xvcvsxdsp $XT, $XB", IIC_VecFP, []>;
    556   def XVCVSXWDP : XX2Form<60, 248,
    557                       (outs vsrc:$XT), (ins vsrc:$XB),
    558                       "xvcvsxwdp $XT, $XB", IIC_VecFP, []>;
    559   def XVCVSXWSP : XX2Form<60, 184,
    560                       (outs vsrc:$XT), (ins vsrc:$XB),
    561                       "xvcvsxwsp $XT, $XB", IIC_VecFP, []>;
    562   def XVCVUXDDP : XX2Form<60, 488,
    563                       (outs vsrc:$XT), (ins vsrc:$XB),
    564                       "xvcvuxddp $XT, $XB", IIC_VecFP,
    565                       [(set v2f64:$XT, (uint_to_fp v2i64:$XB))]>;
    566   def XVCVUXDSP : XX2Form<60, 424,
    567                       (outs vsrc:$XT), (ins vsrc:$XB),
    568                       "xvcvuxdsp $XT, $XB", IIC_VecFP, []>;
    569   def XVCVUXWDP : XX2Form<60, 232,
    570                       (outs vsrc:$XT), (ins vsrc:$XB),
    571                       "xvcvuxwdp $XT, $XB", IIC_VecFP, []>;
    572   def XVCVUXWSP : XX2Form<60, 168,
    573                       (outs vsrc:$XT), (ins vsrc:$XB),
    574                       "xvcvuxwsp $XT, $XB", IIC_VecFP, []>;
    575 
    576   // Rounding Instructions
    577   def XSRDPI : XX2Form<60, 73,
    578                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    579                       "xsrdpi $XT, $XB", IIC_VecFP,
    580                       [(set f64:$XT, (frnd f64:$XB))]>;
    581   def XSRDPIC : XX2Form<60, 107,
    582                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    583                       "xsrdpic $XT, $XB", IIC_VecFP,
    584                       [(set f64:$XT, (fnearbyint f64:$XB))]>;
    585   def XSRDPIM : XX2Form<60, 121,
    586                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    587                       "xsrdpim $XT, $XB", IIC_VecFP,
    588                       [(set f64:$XT, (ffloor f64:$XB))]>;
    589   def XSRDPIP : XX2Form<60, 105,
    590                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    591                       "xsrdpip $XT, $XB", IIC_VecFP,
    592                       [(set f64:$XT, (fceil f64:$XB))]>;
    593   def XSRDPIZ : XX2Form<60, 89,
    594                       (outs vsfrc:$XT), (ins vsfrc:$XB),
    595                       "xsrdpiz $XT, $XB", IIC_VecFP,
    596                       [(set f64:$XT, (ftrunc f64:$XB))]>;
    597 
    598   def XVRDPI : XX2Form<60, 201,
    599                       (outs vsrc:$XT), (ins vsrc:$XB),
    600                       "xvrdpi $XT, $XB", IIC_VecFP,
    601                       [(set v2f64:$XT, (frnd v2f64:$XB))]>;
    602   def XVRDPIC : XX2Form<60, 235,
    603                       (outs vsrc:$XT), (ins vsrc:$XB),
    604                       "xvrdpic $XT, $XB", IIC_VecFP,
    605                       [(set v2f64:$XT, (fnearbyint v2f64:$XB))]>;
    606   def XVRDPIM : XX2Form<60, 249,
    607                       (outs vsrc:$XT), (ins vsrc:$XB),
    608                       "xvrdpim $XT, $XB", IIC_VecFP,
    609                       [(set v2f64:$XT, (ffloor v2f64:$XB))]>;
    610   def XVRDPIP : XX2Form<60, 233,
    611                       (outs vsrc:$XT), (ins vsrc:$XB),
    612                       "xvrdpip $XT, $XB", IIC_VecFP,
    613                       [(set v2f64:$XT, (fceil v2f64:$XB))]>;
    614   def XVRDPIZ : XX2Form<60, 217,
    615                       (outs vsrc:$XT), (ins vsrc:$XB),
    616                       "xvrdpiz $XT, $XB", IIC_VecFP,
    617                       [(set v2f64:$XT, (ftrunc v2f64:$XB))]>;
    618 
    619   def XVRSPI : XX2Form<60, 137,
    620                       (outs vsrc:$XT), (ins vsrc:$XB),
    621                       "xvrspi $XT, $XB", IIC_VecFP,
    622                       [(set v4f32:$XT, (frnd v4f32:$XB))]>;
    623   def XVRSPIC : XX2Form<60, 171,
    624                       (outs vsrc:$XT), (ins vsrc:$XB),
    625                       "xvrspic $XT, $XB", IIC_VecFP,
    626                       [(set v4f32:$XT, (fnearbyint v4f32:$XB))]>;
    627   def XVRSPIM : XX2Form<60, 185,
    628                       (outs vsrc:$XT), (ins vsrc:$XB),
    629                       "xvrspim $XT, $XB", IIC_VecFP,
    630                       [(set v4f32:$XT, (ffloor v4f32:$XB))]>;
    631   def XVRSPIP : XX2Form<60, 169,
    632                       (outs vsrc:$XT), (ins vsrc:$XB),
    633                       "xvrspip $XT, $XB", IIC_VecFP,
    634                       [(set v4f32:$XT, (fceil v4f32:$XB))]>;
    635   def XVRSPIZ : XX2Form<60, 153,
    636                       (outs vsrc:$XT), (ins vsrc:$XB),
    637                       "xvrspiz $XT, $XB", IIC_VecFP,
    638                       [(set v4f32:$XT, (ftrunc v4f32:$XB))]>;
    639 
    640   // Max/Min Instructions
    641   let isCommutable = 1 in {
    642   def XSMAXDP : XX3Form<60, 160,
    643                         (outs vsfrc:$XT), (ins vsfrc:$XA, vsfrc:$XB),
    644                         "xsmaxdp $XT, $XA, $XB", IIC_VecFP, []>;
    645   def XSMINDP : XX3Form<60, 168,
    646                         (outs vsfrc:$XT), (ins vsfrc:$XA, vsfrc:$XB),
    647                         "xsmindp $XT, $XA, $XB", IIC_VecFP, []>;
    648 
    649   def XVMAXDP : XX3Form<60, 224,
    650                         (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    651                         "xvmaxdp $XT, $XA, $XB", IIC_VecFP, []>;
    652   def XVMINDP : XX3Form<60, 232,
    653                         (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    654                         "xvmindp $XT, $XA, $XB", IIC_VecFP, []>;
    655 
    656   def XVMAXSP : XX3Form<60, 192,
    657                         (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    658                         "xvmaxsp $XT, $XA, $XB", IIC_VecFP, []>;
    659   def XVMINSP : XX3Form<60, 200,
    660                         (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    661                         "xvminsp $XT, $XA, $XB", IIC_VecFP, []>;
    662   } // isCommutable
    663 } // Uses = [RM]
    664 
    665   // Logical Instructions
    666   let isCommutable = 1 in
    667   def XXLAND : XX3Form<60, 130,
    668                        (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    669                        "xxland $XT, $XA, $XB", IIC_VecGeneral,
    670                        [(set v4i32:$XT, (and v4i32:$XA, v4i32:$XB))]>;
    671   def XXLANDC : XX3Form<60, 138,
    672                         (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    673                         "xxlandc $XT, $XA, $XB", IIC_VecGeneral,
    674                         [(set v4i32:$XT, (and v4i32:$XA,
    675                                               (vnot_ppc v4i32:$XB)))]>;
    676   let isCommutable = 1 in {
    677   def XXLNOR : XX3Form<60, 162,
    678                        (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    679                        "xxlnor $XT, $XA, $XB", IIC_VecGeneral,
    680                        [(set v4i32:$XT, (vnot_ppc (or v4i32:$XA,
    681                                                    v4i32:$XB)))]>;
    682   def XXLOR : XX3Form<60, 146,
    683                       (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    684                       "xxlor $XT, $XA, $XB", IIC_VecGeneral,
    685                       [(set v4i32:$XT, (or v4i32:$XA, v4i32:$XB))]>;
    686   let isCodeGenOnly = 1 in
    687   def XXLORf: XX3Form<60, 146,
    688                       (outs vsfrc:$XT), (ins vsfrc:$XA, vsfrc:$XB),
    689                       "xxlor $XT, $XA, $XB", IIC_VecGeneral, []>;
    690   def XXLXOR : XX3Form<60, 154,
    691                        (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    692                        "xxlxor $XT, $XA, $XB", IIC_VecGeneral,
    693                        [(set v4i32:$XT, (xor v4i32:$XA, v4i32:$XB))]>;
    694   } // isCommutable
    695 
    696   // Permutation Instructions
    697   def XXMRGHW : XX3Form<60, 18,
    698                        (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    699                        "xxmrghw $XT, $XA, $XB", IIC_VecPerm, []>;
    700   def XXMRGLW : XX3Form<60, 50,
    701                        (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB),
    702                        "xxmrglw $XT, $XA, $XB", IIC_VecPerm, []>;
    703 
    704   def XXPERMDI : XX3Form_2<60, 10,
    705                        (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB, u2imm:$DM),
    706                        "xxpermdi $XT, $XA, $XB, $DM", IIC_VecPerm, []>;
    707   def XXSEL : XX4Form<60, 3,
    708                       (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB, vsrc:$XC),
    709                       "xxsel $XT, $XA, $XB, $XC", IIC_VecPerm, []>;
    710 
    711   def XXSLDWI : XX3Form_2<60, 2,
    712                        (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB, u2imm:$SHW),
    713                        "xxsldwi $XT, $XA, $XB, $SHW", IIC_VecPerm, []>;
    714   def XXSPLTW : XX2Form_2<60, 164,
    715                        (outs vsrc:$XT), (ins vsrc:$XB, u2imm:$UIM),
    716                        "xxspltw $XT, $XB, $UIM", IIC_VecPerm, []>;
    717 } // neverHasSideEffects
    718 } // AddedComplexity
    719 
    720 def : InstAlias<"xvmovdp $XT, $XB",
    721                 (XVCPSGNDP vsrc:$XT, vsrc:$XB, vsrc:$XB)>;
    722 def : InstAlias<"xvmovsp $XT, $XB",
    723                 (XVCPSGNSP vsrc:$XT, vsrc:$XB, vsrc:$XB)>;
    724 
    725 def : InstAlias<"xxspltd $XT, $XB, 0",
    726                 (XXPERMDI vsrc:$XT, vsrc:$XB, vsrc:$XB, 0)>;
    727 def : InstAlias<"xxspltd $XT, $XB, 1",
    728                 (XXPERMDI vsrc:$XT, vsrc:$XB, vsrc:$XB, 3)>;
    729 def : InstAlias<"xxmrghd $XT, $XA, $XB",
    730                 (XXPERMDI vsrc:$XT, vsrc:$XA, vsrc:$XB, 0)>;
    731 def : InstAlias<"xxmrgld $XT, $XA, $XB",
    732                 (XXPERMDI vsrc:$XT, vsrc:$XA, vsrc:$XB, 3)>;
    733 def : InstAlias<"xxswapd $XT, $XB",
    734                 (XXPERMDI vsrc:$XT, vsrc:$XB, vsrc:$XB, 2)>;
    735 
    736 let AddedComplexity = 400 in { // Prefer VSX patterns over non-VSX patterns.
    737 def : Pat<(v2f64 (scalar_to_vector f64:$A)),
    738           (v2f64 (SUBREG_TO_REG (i64 1), $A, sub_64))>;
    739 
    740 def : Pat<(f64 (vector_extract v2f64:$S, 0)),
    741           (f64 (EXTRACT_SUBREG $S, sub_64))>;
    742 def : Pat<(f64 (vector_extract v2f64:$S, 1)),
    743           (f64 (EXTRACT_SUBREG (XXPERMDI $S, $S, 2), sub_64))>;
    744 
    745 // Additional fnmsub patterns: -a*c + b == -(a*c - b)
    746 def : Pat<(fma (fneg f64:$A), f64:$C, f64:$B),
    747           (XSNMSUBADP $B, $C, $A)>;
    748 def : Pat<(fma f64:$A, (fneg f64:$C), f64:$B),
    749           (XSNMSUBADP $B, $C, $A)>;
    750 
    751 def : Pat<(fma (fneg v2f64:$A), v2f64:$C, v2f64:$B),
    752           (XVNMSUBADP $B, $C, $A)>;
    753 def : Pat<(fma v2f64:$A, (fneg v2f64:$C), v2f64:$B),
    754           (XVNMSUBADP $B, $C, $A)>;
    755 
    756 def : Pat<(fma (fneg v4f32:$A), v4f32:$C, v4f32:$B),
    757           (XVNMSUBASP $B, $C, $A)>;
    758 def : Pat<(fma v4f32:$A, (fneg v4f32:$C), v4f32:$B),
    759           (XVNMSUBASP $B, $C, $A)>;
    760 
    761 def : Pat<(v2f64 (bitconvert v4f32:$A)),
    762           (COPY_TO_REGCLASS $A, VSRC)>;
    763 def : Pat<(v2f64 (bitconvert v4i32:$A)),
    764           (COPY_TO_REGCLASS $A, VSRC)>;
    765 def : Pat<(v2f64 (bitconvert v8i16:$A)),
    766           (COPY_TO_REGCLASS $A, VSRC)>;
    767 def : Pat<(v2f64 (bitconvert v16i8:$A)),
    768           (COPY_TO_REGCLASS $A, VSRC)>;
    769 
    770 def : Pat<(v4f32 (bitconvert v2f64:$A)),
    771           (COPY_TO_REGCLASS $A, VRRC)>;
    772 def : Pat<(v4i32 (bitconvert v2f64:$A)),
    773           (COPY_TO_REGCLASS $A, VRRC)>;
    774 def : Pat<(v8i16 (bitconvert v2f64:$A)),
    775           (COPY_TO_REGCLASS $A, VRRC)>;
    776 def : Pat<(v16i8 (bitconvert v2f64:$A)),
    777           (COPY_TO_REGCLASS $A, VRRC)>;
    778 
    779 def : Pat<(v2i64 (bitconvert v4f32:$A)),
    780           (COPY_TO_REGCLASS $A, VSRC)>;
    781 def : Pat<(v2i64 (bitconvert v4i32:$A)),
    782           (COPY_TO_REGCLASS $A, VSRC)>;
    783 def : Pat<(v2i64 (bitconvert v8i16:$A)),
    784           (COPY_TO_REGCLASS $A, VSRC)>;
    785 def : Pat<(v2i64 (bitconvert v16i8:$A)),
    786           (COPY_TO_REGCLASS $A, VSRC)>;
    787 
    788 def : Pat<(v4f32 (bitconvert v2i64:$A)),
    789           (COPY_TO_REGCLASS $A, VRRC)>;
    790 def : Pat<(v4i32 (bitconvert v2i64:$A)),
    791           (COPY_TO_REGCLASS $A, VRRC)>;
    792 def : Pat<(v8i16 (bitconvert v2i64:$A)),
    793           (COPY_TO_REGCLASS $A, VRRC)>;
    794 def : Pat<(v16i8 (bitconvert v2i64:$A)),
    795           (COPY_TO_REGCLASS $A, VRRC)>;
    796 
    797 def : Pat<(v2f64 (bitconvert v2i64:$A)),
    798           (COPY_TO_REGCLASS $A, VRRC)>;
    799 def : Pat<(v2i64 (bitconvert v2f64:$A)),
    800           (COPY_TO_REGCLASS $A, VRRC)>;
    801 
    802 // sign extension patterns
    803 // To extend "in place" from v2i32 to v2i64, we have input data like:
    804 // | undef | i32 | undef | i32 |
    805 // but xvcvsxwdp expects the input in big-Endian format:
    806 // | i32 | undef | i32 | undef |
    807 // so we need to shift everything to the left by one i32 (word) before
    808 // the conversion.
    809 def : Pat<(sext_inreg v2i64:$C, v2i32),
    810           (XVCVDPSXDS (XVCVSXWDP (XXSLDWI $C, $C, 1)))>;
    811 def : Pat<(v2f64 (sint_to_fp (sext_inreg v2i64:$C, v2i32))),
    812           (XVCVSXWDP (XXSLDWI $C, $C, 1))>;
    813 
    814 } // AddedComplexity
    815 } // HasVSX
    816 
    817