Home | History | Annotate | Download | only in MBlaze
      1 //===-- MBlazeInstrFSL.td - MBlaze FSL Instruction defs ----*- 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 //===----------------------------------------------------------------------===//
     11 // FSL Instruction Formats
     12 //===----------------------------------------------------------------------===//
     13 class FSLGet<bits<6> op, bits<5> flags, string instr_asm, Intrinsic OpNode> :
     14              MBlazeInst<op, FRCX, (outs GPR:$dst), (ins fslimm:$b),
     15                         !strconcat(instr_asm, " $dst, $b"),
     16                         [(set GPR:$dst, (OpNode immZExt4:$b))],IIC_FSLg>
     17 {
     18     bits<5> rd;
     19     bits<4> fslno;
     20 
     21     let Inst{6-10}  = rd;
     22     let Inst{11-15} = 0x0;
     23     let Inst{16}    = 0x0;
     24     let Inst{17-21} = flags; // NCTAE
     25     let Inst{22-27} = 0x0;
     26     let Inst{28-31} = fslno;
     27 }
     28 
     29 class FSLGetD<bits<6> op, bits<5> flags, string instr_asm, Intrinsic OpNode> :
     30               MBlazeInst<op, FRCR, (outs GPR:$dst), (ins GPR:$b),
     31                          !strconcat(instr_asm, " $dst, $b"),
     32                          [(set GPR:$dst, (OpNode GPR:$b))], IIC_FSLg>
     33 {
     34     bits<5> rd;
     35     bits<5> rb;
     36 
     37     let Inst{6-10}  = rd;
     38     let Inst{11-15} = 0x0;
     39     let Inst{16-20} = rb;
     40     let Inst{21}    = 0x0;
     41     let Inst{22-26} = flags; // NCTAE
     42     let Inst{27-31} = 0x0;
     43 }
     44 
     45 class FSLPut<bits<6> op, bits<4> flags, string instr_asm, Intrinsic OpNode> :
     46              MBlazeInst<op, FCRCX, (outs), (ins GPR:$v, fslimm:$b),
     47                         !strconcat(instr_asm, " $v, $b"),
     48                         [(OpNode GPR:$v, immZExt4:$b)], IIC_FSLp>
     49 {
     50     bits<5> ra;
     51     bits<4> fslno;
     52 
     53     let Inst{6-10}  = 0x0;
     54     let Inst{11-15} = ra;
     55     let Inst{16}    = 0x1;
     56     let Inst{17-20} = flags; // NCTA
     57     let Inst{21-27} = 0x0;
     58     let Inst{28-31} = fslno;
     59 }
     60 
     61 class FSLPutD<bits<6> op, bits<4> flags, string instr_asm, Intrinsic OpNode> :
     62               MBlazeInst<op, FCRR, (outs), (ins GPR:$v, GPR:$b),
     63                          !strconcat(instr_asm, " $v, $b"),
     64                          [(OpNode GPR:$v, GPR:$b)], IIC_FSLp>
     65 {
     66     bits<5> ra;
     67     bits<5> rb;
     68 
     69     let Inst{6-10}  = 0x0;
     70     let Inst{11-15} = ra;
     71     let Inst{16-20} = rb;
     72     let Inst{21}    = 0x1;
     73     let Inst{22-25} = flags; // NCTA
     74     let Inst{26-31} = 0x0;
     75 }
     76 
     77 class FSLPutT<bits<6> op, bits<4> flags, string instr_asm, Intrinsic OpNode> :
     78               MBlazeInst<op, FCX, (outs), (ins fslimm:$b),
     79                          !strconcat(instr_asm, " $b"),
     80                          [(OpNode immZExt4:$b)], IIC_FSLp>
     81 {
     82     bits<4> fslno;
     83 
     84     let Inst{6-10}  = 0x0;
     85     let Inst{11-15} = 0x0;
     86     let Inst{16}    = 0x1;
     87     let Inst{17-20} = flags; // NCTA
     88     let Inst{21-27} = 0x0;
     89     let Inst{28-31} = fslno;
     90 }
     91 
     92 class FSLPutTD<bits<6> op, bits<4> flags, string instr_asm, Intrinsic OpNode> :
     93                MBlazeInst<op, FCR, (outs), (ins GPR:$b),
     94                           !strconcat(instr_asm, " $b"),
     95                           [(OpNode GPR:$b)], IIC_FSLp>
     96 {
     97     bits<5> rb;
     98 
     99     let Inst{6-10}  = 0x0;
    100     let Inst{11-15} = 0x0;
    101     let Inst{16-20} = rb;
    102     let Inst{21}    = 0x1;
    103     let Inst{22-25} = flags; // NCTA
    104     let Inst{26-31} = 0x0;
    105 }
    106 
    107 //===----------------------------------------------------------------------===//
    108 // FSL Get Instructions
    109 //===----------------------------------------------------------------------===//
    110 def GET      : FSLGet<0x1B, 0x00, "get      ", int_mblaze_fsl_get>;
    111 def AGET     : FSLGet<0x1B, 0x02, "aget     ", int_mblaze_fsl_aget>;
    112 def CGET     : FSLGet<0x1B, 0x08, "cget     ", int_mblaze_fsl_cget>;
    113 def CAGET    : FSLGet<0x1B, 0x0A, "caget    ", int_mblaze_fsl_caget>;
    114 def EGET     : FSLGet<0x1B, 0x01, "eget     ", int_mblaze_fsl_eget>;
    115 def EAGET    : FSLGet<0x1B, 0x03, "eaget    ", int_mblaze_fsl_eaget>;
    116 def ECGET    : FSLGet<0x1B, 0x09, "ecget    ", int_mblaze_fsl_ecget>;
    117 def ECAGET   : FSLGet<0x1B, 0x0B, "ecaget   ", int_mblaze_fsl_ecaget>;
    118 def TGET     : FSLGet<0x1B, 0x04, "tget     ", int_mblaze_fsl_tget>;
    119 def TAGET    : FSLGet<0x1B, 0x06, "taget    ", int_mblaze_fsl_taget>;
    120 def TCGET    : FSLGet<0x1B, 0x0C, "tcget    ", int_mblaze_fsl_tcget>;
    121 def TCAGET   : FSLGet<0x1B, 0x0E, "tcaget   ", int_mblaze_fsl_tcaget>;
    122 def TEGET    : FSLGet<0x1B, 0x05, "teget    ", int_mblaze_fsl_teget>;
    123 def TEAGET   : FSLGet<0x1B, 0x07, "teaget   ", int_mblaze_fsl_teaget>;
    124 def TECGET   : FSLGet<0x1B, 0x0D, "tecget   ", int_mblaze_fsl_tecget>;
    125 def TECAGET  : FSLGet<0x1B, 0x0F, "tecaget  ", int_mblaze_fsl_tecaget>;
    126 
    127 let Defs = [CARRY] in {
    128   def NGET     : FSLGet<0x1B, 0x10, "nget     ", int_mblaze_fsl_nget>;
    129   def NAGET    : FSLGet<0x1B, 0x12, "naget    ", int_mblaze_fsl_naget>;
    130   def NCGET    : FSLGet<0x1B, 0x18, "ncget    ", int_mblaze_fsl_ncget>;
    131   def NCAGET   : FSLGet<0x1B, 0x1A, "ncaget   ", int_mblaze_fsl_ncaget>;
    132   def NEGET    : FSLGet<0x1B, 0x11, "neget    ", int_mblaze_fsl_neget>;
    133   def NEAGET   : FSLGet<0x1B, 0x13, "neaget   ", int_mblaze_fsl_neaget>;
    134   def NECGET   : FSLGet<0x1B, 0x19, "necget   ", int_mblaze_fsl_necget>;
    135   def NECAGET  : FSLGet<0x1B, 0x1B, "necaget  ", int_mblaze_fsl_necaget>;
    136   def TNGET    : FSLGet<0x1B, 0x14, "tnget    ", int_mblaze_fsl_tnget>;
    137   def TNAGET   : FSLGet<0x1B, 0x16, "tnaget   ", int_mblaze_fsl_tnaget>;
    138   def TNCGET   : FSLGet<0x1B, 0x1C, "tncget   ", int_mblaze_fsl_tncget>;
    139   def TNCAGET  : FSLGet<0x1B, 0x1E, "tncaget  ", int_mblaze_fsl_tncaget>;
    140   def TNEGET   : FSLGet<0x1B, 0x15, "tneget   ", int_mblaze_fsl_tneget>;
    141   def TNEAGET  : FSLGet<0x1B, 0x17, "tneaget  ", int_mblaze_fsl_tneaget>;
    142   def TNECGET  : FSLGet<0x1B, 0x1D, "tnecget  ", int_mblaze_fsl_tnecget>;
    143   def TNECAGET : FSLGet<0x1B, 0x1F, "tnecaget ", int_mblaze_fsl_tnecaget>;
    144 }
    145 
    146 //===----------------------------------------------------------------------===//
    147 // FSL Dynamic Get Instructions
    148 //===----------------------------------------------------------------------===//
    149 def GETD      : FSLGetD<0x13, 0x00, "getd     ", int_mblaze_fsl_get>;
    150 def AGETD     : FSLGetD<0x13, 0x02, "agetd    ", int_mblaze_fsl_aget>;
    151 def CGETD     : FSLGetD<0x13, 0x08, "cgetd    ", int_mblaze_fsl_cget>;
    152 def CAGETD    : FSLGetD<0x13, 0x0A, "cagetd   ", int_mblaze_fsl_caget>;
    153 def EGETD     : FSLGetD<0x13, 0x01, "egetd    ", int_mblaze_fsl_eget>;
    154 def EAGETD    : FSLGetD<0x13, 0x03, "eagetd   ", int_mblaze_fsl_eaget>;
    155 def ECGETD    : FSLGetD<0x13, 0x09, "ecgetd   ", int_mblaze_fsl_ecget>;
    156 def ECAGETD   : FSLGetD<0x13, 0x0B, "ecagetd  ", int_mblaze_fsl_ecaget>;
    157 def TGETD     : FSLGetD<0x13, 0x04, "tgetd    ", int_mblaze_fsl_tget>;
    158 def TAGETD    : FSLGetD<0x13, 0x06, "tagetd   ", int_mblaze_fsl_taget>;
    159 def TCGETD    : FSLGetD<0x13, 0x0C, "tcgetd   ", int_mblaze_fsl_tcget>;
    160 def TCAGETD   : FSLGetD<0x13, 0x0E, "tcagetd  ", int_mblaze_fsl_tcaget>;
    161 def TEGETD    : FSLGetD<0x13, 0x05, "tegetd   ", int_mblaze_fsl_teget>;
    162 def TEAGETD   : FSLGetD<0x13, 0x07, "teagetd  ", int_mblaze_fsl_teaget>;
    163 def TECGETD   : FSLGetD<0x13, 0x0D, "tecgetd  ", int_mblaze_fsl_tecget>;
    164 def TECAGETD  : FSLGetD<0x13, 0x0F, "tecagetd ", int_mblaze_fsl_tecaget>;
    165 
    166 let Defs = [CARRY] in {
    167   def NGETD     : FSLGetD<0x13, 0x10, "ngetd    ", int_mblaze_fsl_nget>;
    168   def NAGETD    : FSLGetD<0x13, 0x12, "nagetd   ", int_mblaze_fsl_naget>;
    169   def NCGETD    : FSLGetD<0x13, 0x18, "ncgetd   ", int_mblaze_fsl_ncget>;
    170   def NCAGETD   : FSLGetD<0x13, 0x1A, "ncagetd  ", int_mblaze_fsl_ncaget>;
    171   def NEGETD    : FSLGetD<0x13, 0x11, "negetd   ", int_mblaze_fsl_neget>;
    172   def NEAGETD   : FSLGetD<0x13, 0x13, "neagetd  ", int_mblaze_fsl_neaget>;
    173   def NECGETD   : FSLGetD<0x13, 0x19, "necgetd  ", int_mblaze_fsl_necget>;
    174   def NECAGETD  : FSLGetD<0x13, 0x1B, "necagetd ", int_mblaze_fsl_necaget>;
    175   def TNGETD    : FSLGetD<0x13, 0x14, "tngetd   ", int_mblaze_fsl_tnget>;
    176   def TNAGETD   : FSLGetD<0x13, 0x16, "tnagetd  ", int_mblaze_fsl_tnaget>;
    177   def TNCGETD   : FSLGetD<0x13, 0x1C, "tncgetd  ", int_mblaze_fsl_tncget>;
    178   def TNCAGETD  : FSLGetD<0x13, 0x1E, "tncagetd ", int_mblaze_fsl_tncaget>;
    179   def TNEGETD   : FSLGetD<0x13, 0x15, "tnegetd  ", int_mblaze_fsl_tneget>;
    180   def TNEAGETD  : FSLGetD<0x13, 0x17, "tneagetd ", int_mblaze_fsl_tneaget>;
    181   def TNECGETD  : FSLGetD<0x13, 0x1D, "tnecgetd ", int_mblaze_fsl_tnecget>;
    182   def TNECAGETD : FSLGetD<0x13, 0x1F, "tnecagetd", int_mblaze_fsl_tnecaget>;
    183 }
    184 
    185 //===----------------------------------------------------------------------===//
    186 // FSL Put Instructions
    187 //===----------------------------------------------------------------------===//
    188 def PUT     :  FSLPut<0x1B, 0x0, "put      ", int_mblaze_fsl_put>;
    189 def APUT    :  FSLPut<0x1B, 0x1, "aput     ", int_mblaze_fsl_aput>;
    190 def CPUT    :  FSLPut<0x1B, 0x4, "cput     ", int_mblaze_fsl_cput>;
    191 def CAPUT   :  FSLPut<0x1B, 0x5, "caput    ", int_mblaze_fsl_caput>;
    192 def TPUT    : FSLPutT<0x1B, 0x2, "tput     ", int_mblaze_fsl_tput>;
    193 def TAPUT   : FSLPutT<0x1B, 0x3, "taput    ", int_mblaze_fsl_taput>;
    194 def TCPUT   : FSLPutT<0x1B, 0x6, "tcput    ", int_mblaze_fsl_tcput>;
    195 def TCAPUT  : FSLPutT<0x1B, 0x7, "tcaput   ", int_mblaze_fsl_tcaput>;
    196 
    197 let Defs = [CARRY] in {
    198   def NPUT    :  FSLPut<0x1B, 0x8, "nput     ", int_mblaze_fsl_nput>;
    199   def NAPUT   :  FSLPut<0x1B, 0x9, "naput    ", int_mblaze_fsl_naput>;
    200   def NCPUT   :  FSLPut<0x1B, 0xC, "ncput    ", int_mblaze_fsl_ncput>;
    201   def NCAPUT  :  FSLPut<0x1B, 0xD, "ncaput   ", int_mblaze_fsl_ncaput>;
    202   def TNPUT   : FSLPutT<0x1B, 0xA, "tnput    ", int_mblaze_fsl_tnput>;
    203   def TNAPUT  : FSLPutT<0x1B, 0xB, "tnaput   ", int_mblaze_fsl_tnaput>;
    204   def TNCPUT  : FSLPutT<0x1B, 0xE, "tncput   ", int_mblaze_fsl_tncput>;
    205   def TNCAPUT : FSLPutT<0x1B, 0xF, "tncaput  ", int_mblaze_fsl_tncaput>;
    206 }
    207 
    208 //===----------------------------------------------------------------------===//
    209 // FSL Dynamic Put Instructions
    210 //===----------------------------------------------------------------------===//
    211 def PUTD     :  FSLPutD<0x13, 0x0, "putd     ", int_mblaze_fsl_put>;
    212 def APUTD    :  FSLPutD<0x13, 0x1, "aputd    ", int_mblaze_fsl_aput>;
    213 def CPUTD    :  FSLPutD<0x13, 0x4, "cputd    ", int_mblaze_fsl_cput>;
    214 def CAPUTD   :  FSLPutD<0x13, 0x5, "caputd   ", int_mblaze_fsl_caput>;
    215 def TPUTD    : FSLPutTD<0x13, 0x2, "tputd    ", int_mblaze_fsl_tput>;
    216 def TAPUTD   : FSLPutTD<0x13, 0x3, "taputd   ", int_mblaze_fsl_taput>;
    217 def TCPUTD   : FSLPutTD<0x13, 0x6, "tcputd   ", int_mblaze_fsl_tcput>;
    218 def TCAPUTD  : FSLPutTD<0x13, 0x7, "tcaputd  ", int_mblaze_fsl_tcaput>;
    219 
    220 let Defs = [CARRY] in {
    221   def NPUTD    :  FSLPutD<0x13, 0x8, "nputd    ", int_mblaze_fsl_nput>;
    222   def NAPUTD   :  FSLPutD<0x13, 0x9, "naputd   ", int_mblaze_fsl_naput>;
    223   def NCPUTD   :  FSLPutD<0x13, 0xC, "ncputd   ", int_mblaze_fsl_ncput>;
    224   def NCAPUTD  :  FSLPutD<0x13, 0xD, "ncaputd  ", int_mblaze_fsl_ncaput>;
    225   def TNPUTD   : FSLPutTD<0x13, 0xA, "tnputd   ", int_mblaze_fsl_tnput>;
    226   def TNAPUTD  : FSLPutTD<0x13, 0xB, "tnaputd  ", int_mblaze_fsl_tnaput>;
    227   def TNCPUTD  : FSLPutTD<0x13, 0xE, "tncputd  ", int_mblaze_fsl_tncput>;
    228   def TNCAPUTD : FSLPutTD<0x13, 0xF, "tncaputd ", int_mblaze_fsl_tncaput>;
    229 }
    230