Home | History | Annotate | Line # | Download | only in i386
      1 ;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
      2 ;;
      3 ;; This file is part of GCC.
      4 ;;
      5 ;; GCC is free software; you can redistribute it and/or modify
      6 ;; it under the terms of the GNU General Public License as published by
      7 ;; the Free Software Foundation; either version 3, or (at your option)
      8 ;; any later version.
      9 ;;
     10 ;; GCC is distributed in the hope that it will be useful,
     11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 ;; GNU General Public License for more details.
     14 ;;
     15 ;; You should have received a copy of the GNU General Public License
     16 ;; along with GCC; see the file COPYING3.  If not see
     17 ;; <http://www.gnu.org/licenses/>.
     18 ;;
     19 
     20 ;; ZHAOXIN yongfeng processor Scheduling
     21 ;; Modeling automatons for yongfeng decoders, integer execution pipes,
     22 ;; FP execution pipes, AGU pipes, and dividers.
     23 (define_automaton "yongfeng_decoder,yongfeng_ieu,yongfeng_fp,yongfeng_agu,yongfeng_idiv,yongfeng_fdiv")
     24 
     25 ;; The rules for the decoder are simple:
     26 ;;  - an instruction with 1 uop can be decoded by any of the four
     27 ;;    decoders in one cycle.
     28 ;;  - an instruction with 2 uops can be decoded by decoder 0 or decoder 1
     29 ;;    or decoder 2 but still in only one cycle.
     30 ;;  - a complex (microcode) instruction can only be decoded by
     31 ;;    decoder 0, and this takes an unspecified number of cycles.
     32 ;;
     33 ;; The goal is to schedule such that we have a few-one-two uops sequence
     34 ;; in each cycle, to decode as many instructions per cycle as possible.
     35 (define_cpu_unit "yf_decoder0" "yongfeng_decoder")
     36 (define_cpu_unit "yf_decoder1" "yongfeng_decoder")
     37 (define_cpu_unit "yf_decoder2" "yongfeng_decoder")
     38 (define_cpu_unit "yf_decoder3" "yongfeng_decoder")
     39 
     40 ;; We first wish to find an instruction for yf_decoder0, so exclude
     41 ;; other decoders from being reserved until yf_decoder0 is
     42 ;; reserved
     43 (presence_set "yf_decoder1" "yf_decoder0")
     44 (presence_set "yf_decoder2" "yf_decoder0")
     45 (presence_set "yf_decoder3" "yf_decoder0")
     46 
     47 ;; Most instructions can be decoded on any of the three decoders.
     48 (define_reservation "yf_decodern" "yf_decoder0|yf_decoder1|yf_decoder2|yf_decoder3")
     49 (define_reservation "yf_decoder012" "yf_decoder0|yf_decoder1|yf_decoder2")
     50 
     51 ;; The out-of-order core has ten pipelines. Port 0,1,2,3 are integer execution
     52 ;; pipelines, port 4, 5 are responsible for address calculation, load and store,
     53 ;; port 6,7,8,9 are FP pipelines.
     54 (define_cpu_unit "yf_p0,yf_p1,yf_p2,yf_p3" "yongfeng_ieu")
     55 (define_cpu_unit "yf_p4,yf_p5" "yongfeng_agu")
     56 (define_cpu_unit "yf_p6,yf_p7,yf_p8,yf_p9" "yongfeng_fp")
     57 
     58 (define_cpu_unit "yf_idiv" "yongfeng_idiv")
     59 (define_cpu_unit "yf_fdiv" "yongfeng_fdiv")
     60 
     61 (define_reservation "yf_ieu" "yf_p0|yf_p1|yf_p2|yf_p3")
     62 (define_reservation "yf_p01" "yf_p0|yf_p1")
     63 (define_reservation "yf_agu" "yf_p4|yf_p5")
     64 (define_reservation "yf_feu" "yf_p6|yf_p7|yf_p8|yf_p9")
     65 
     66 ;; Only the irregular instructions have to be modeled here.
     67 
     68 ;; Complex instruction.
     69 (define_insn_reservation "yongfeng_complex_insn" 6
     70 			 (and (eq_attr "cpu" "yongfeng")
     71 			      (eq_attr "type" "other,multi,str"))
     72 			 "yf_decoder0")
     73 
     74 ;; Call instruction.
     75 (define_insn_reservation "yongfeng_call" 3
     76 			 (and (eq_attr "cpu" "yongfeng")
     77 			      (eq_attr "type" "call,callv"))
     78 			 "yf_decoder012,yf_agu,yf_ieu*3")
     79 ;; Push and pop.
     80 (define_insn_reservation "yongfeng_push_reg" 1
     81 			 (and (eq_attr "cpu" "yongfeng")
     82 			      (and (eq_attr "memory" "store")
     83 				   (eq_attr "type" "push")))
     84 			 "yf_decodern,yf_agu,yf_ieu")
     85 
     86 (define_insn_reservation "yongfeng_push_mem" 4
     87 			 (and (eq_attr "cpu" "yongfeng")
     88 			      (and (eq_attr "memory" "both")
     89 				   (eq_attr "type" "push")))
     90 			 "yf_decoder012,yf_agu,yf_ieu")
     91 
     92 (define_insn_reservation "yongfeng_pop_reg" 4
     93 			 (and (eq_attr "cpu" "yongfeng")
     94 			      (and (eq_attr "memory" "load")
     95 				   (eq_attr "type" "pop")))
     96 			 "yf_decoder012,yf_p01,yf_agu")
     97 
     98 (define_insn_reservation "yongfeng_pop_mem" 4
     99 			 (and (eq_attr "cpu" "yongfeng")
    100 			      (and (eq_attr "memory" "both")
    101 				   (eq_attr "type" "pop")))
    102 			 "yf_decoder0,yf_agu,yf_ieu")
    103 
    104 (define_insn_reservation "yongfeng_leave" 3
    105 			 (and (eq_attr "cpu" "yongfeng")
    106 			      (eq_attr "type" "leave"))
    107 			 "yf_decoder0,yf_agu,yf_p01*3")
    108 
    109 ;; MOV - integer moves.
    110 (define_insn_reservation "yongfeng_imov" 1
    111 			 (and (eq_attr "cpu" "yongfeng")
    112 			      (and (eq_attr "memory" "none")
    113 				        (eq_attr "type" "imov,imovx")))
    114 			 "yf_decodern,yf_ieu")
    115 
    116 (define_insn_reservation "yongfeng_imov_load" 4
    117 			 (and (eq_attr "cpu" "yongfeng")
    118 			      (and (eq_attr "memory" "load")
    119 				   (eq_attr "type" "imov")))
    120 			 "yf_decodern,yf_agu")
    121 
    122 (define_insn_reservation "yongfeng_imovx_load" 4
    123 			 (and (eq_attr "cpu" "yongfeng")
    124 			      (and (eq_attr "memory" "load")
    125 				   (eq_attr "type" "imovx")))
    126 			 "yf_decoder012,yf_agu,yf_ieu|yf_ieu")
    127 
    128 (define_insn_reservation "yongfeng_imov_store" 1
    129 			 (and (eq_attr "cpu" "yongfeng")
    130 			      (and (eq_attr "memory" "store")
    131 				   (eq_attr "type" "imov")))
    132 			 "yf_decodern,yf_agu,yf_ieu")
    133 
    134 (define_insn_reservation "yongfeng_int_insn" 1
    135 			 (and (eq_attr "cpu" "yongfeng")
    136 			      (and (eq_attr "memory" "none,unknown")
    137 				   (eq_attr "type" "alu,alu1,icmov,icmp,test,lea,ishift1,rotate,rotate1,setcc,incdec")))
    138 			 "yf_decodern,yf_ieu")
    139 
    140 (define_insn_reservation "yongfeng_int_insn_load" 5
    141 			 (and (eq_attr "cpu" "yongfeng")
    142 			      (and (eq_attr "memory" "load")
    143 				   (eq_attr "type" "alu,alu1,icmov,icmp,test,ishift1,rotate,rotate1,setcc")))
    144 			 "yf_decoder012,yf_agu,yf_ieu")
    145 
    146 (define_insn_reservation "yongfeng_int_insn_store" 1
    147 			 (and (eq_attr "cpu" "yongfeng")
    148 			      (and (eq_attr "memory" "store")
    149 				   (eq_attr "type" "alu,alu1,icmp,test,ishift1,rotate,rotate1,setcc")))
    150 			 "yf_decoder012,yf_agu,yf_ieu")
    151 
    152 (define_insn_reservation "yongfeng_int_insn_both" 5
    153 			 (and (eq_attr "cpu" "yongfeng")
    154 			      (and (eq_attr "memory" "both")
    155 				   (eq_attr "type" "alu,alu1,icmp,test,ishift1,rotate,rotate1,setcc,incdec")))
    156 			 "yf_decoder012,yf_agu,yf_ieu")
    157 
    158 (define_insn_reservation "yongfeng_shift_HI" 5
    159 			 (and (eq_attr "cpu" "yongfeng")
    160 			      (and (eq_attr "memory" "none,unknown")
    161 				   (and (eq_attr "mode" "HI")
    162 			                (eq_attr "type" "ishift"))))
    163 			 "yf_decoder0,yf_ieu")
    164 
    165 (define_insn_reservation "yongfeng_shift_SIDI" 2
    166 			 (and (eq_attr "cpu" "yongfeng")
    167 			      (and (eq_attr "memory" "none,unknown")
    168 				   (and (eq_attr "mode" "SI,DI")
    169 			                (eq_attr "type" "ishift"))))
    170 			 "yf_decoder0,yf_ieu")
    171 
    172 (define_insn_reservation "yongfeng_shift_HI_mem" 9
    173 			 (and (eq_attr "cpu" "yongfeng")
    174 			      (and (eq_attr "memory" "!none")
    175 				   (and (eq_attr "mode" "HI")
    176 			                (eq_attr "type" "ishift"))))
    177 			 "yf_decoder0,yf_agu,yf_ieu")
    178 
    179 (define_insn_reservation "yongfeng_shift_SIDI_mem" 6
    180 			 (and (eq_attr "cpu" "yongfeng")
    181 			      (and (eq_attr "memory" "!none")
    182 				   (and (eq_attr "mode" "SI,DI")
    183 			                (eq_attr "type" "ishift"))))
    184 			 "yf_decoder0,yf_agu,yf_ieu")
    185 
    186 (define_insn_reservation "yongfeng_negnot_QIHI" 2
    187 			 (and (eq_attr "cpu" "yongfeng")
    188 			      (and (eq_attr "memory" "none,unknown")
    189 				   (and (eq_attr "mode" "QI,HI")
    190 			                (eq_attr "type" "negnot"))))
    191 			 "yf_decoder012,yf_ieu|yf_ieu")
    192 
    193 (define_insn_reservation "yongfeng_negnot_SIDI" 1
    194 			 (and (eq_attr "cpu" "yongfeng")
    195 			      (and (eq_attr "memory" "none,unknown")
    196 				   (and (eq_attr "mode" "SI,DI")
    197 			                (eq_attr "type" "negnot"))))
    198 			 "yf_decodern,yf_ieu")
    199 
    200 (define_insn_reservation "yongfeng_negnot_QIHI_mem" 6
    201 			 (and (eq_attr "cpu" "yongfeng")
    202 			      (and (eq_attr "memory" "!none")
    203 				   (and (eq_attr "mode" "QI,HI")
    204 			                (eq_attr "type" "negnot"))))
    205 			 "yf_decoder012,yf_agu,yf_ieu")
    206 
    207 (define_insn_reservation "yongfeng_negnot_SIDI_mem" 5
    208 			 (and (eq_attr "cpu" "yongfeng")
    209 			      (and (eq_attr "memory" "!none")
    210 				   (and (eq_attr "mode" "SI,DI")
    211 			                (eq_attr "type" "negnot"))))
    212 			 "yf_decoder012,yf_agu,yf_ieu")
    213 
    214 ;; branch instruction
    215 (define_insn_reservation "yongfeng_branch" 3
    216 			 (and (eq_attr "cpu" "yongfeng")
    217 			      (and (eq_attr "memory" "none")
    218 				   (eq_attr "type" "ibr")))
    219 			 "yf_decodern,yf_p2*3")
    220 
    221 (define_insn_reservation "yongfeng_branch_mem" 7
    222 			 (and (eq_attr "cpu" "yongfeng")
    223 			      (and (eq_attr "memory" "!none")
    224 				   (eq_attr "type" "ibr")))
    225 			 "yf_decodern,yf_agu,yf_p2")
    226 
    227 ;; Integer Multiplication instructions.
    228 
    229 (define_insn_reservation "yongfeng_imul_QI" 2
    230 			 (and (eq_attr "cpu" "yongfeng")
    231 			      (and (eq_attr "memory" "none")
    232 				   (and (eq_attr "mode" "QI")
    233 					(eq_attr "type" "imul"))))
    234 			 "yf_decodern,yf_ieu|yf_ieu")
    235 
    236 (define_insn_reservation "yongfeng_imul_HI" 3
    237 			 (and (eq_attr "cpu" "yongfeng")
    238 			      (and (eq_attr "memory" "none")
    239 				   (and (eq_attr "mode" "HI")
    240 					(eq_attr "type" "imul"))))
    241 			 "yf_decoder0,yf_ieu")
    242 
    243 (define_insn_reservation "yongfeng_imul_SIDI" 2
    244 			 (and (eq_attr "cpu" "yongfeng")
    245 			      (and (eq_attr "memory" "none")
    246 				   (and (eq_attr "mode" "SI,DI")
    247 					(eq_attr "type" "imul"))))
    248 			 "yf_decoder0,yf_ieu|yf_ieu")
    249 
    250 (define_insn_reservation "yongfeng_imul_QI_mem" 6
    251 			 (and (eq_attr "cpu" "yongfeng")
    252 			      (and (eq_attr "memory" "!none")
    253 				   (and (eq_attr "mode" "QI")
    254 				         (eq_attr "type" "imul"))))
    255 			 "yf_decoder012,yf_agu,yf_ieu")
    256 
    257 (define_insn_reservation "yongfeng_imul_SIDI_mem" 6
    258 			 (and (eq_attr "cpu" "yongfeng")
    259 			      (and (eq_attr "memory" "!none")
    260 				   (and (eq_attr "mode" "SI,DI")
    261 				         (eq_attr "type" "imul"))))
    262 			 "yf_decoder0,yf_agu,yf_ieu")
    263 
    264 (define_insn_reservation "yongfeng_imul_HI_mem" 7
    265 			 (and (eq_attr "cpu" "yongfeng")
    266 			      (and (eq_attr "memory" "!none")
    267 				   (and (eq_attr "mode" "HI")
    268 				         (eq_attr "type" "imul"))))
    269 			 "yf_decoder0,yf_agu,yf_ieu")
    270 
    271 ;; Integer Division instructions.
    272 
    273 (define_insn_reservation "yongfeng_idiv_DI" 41
    274 			 (and (eq_attr "cpu" "yongfeng")
    275 			      (and (eq_attr "memory" "none")
    276 				   (and (eq_attr "mode" "DI")
    277 					(eq_attr "type" "idiv"))))
    278 			 "yf_decoder0,yf_ieu,yf_feu,yf_idiv*41")
    279 
    280 (define_insn_reservation "yongfeng_idiv_HI" 9
    281 			 (and (eq_attr "cpu" "yongfeng")
    282 			      (and (eq_attr "memory" "none")
    283 				   (and (eq_attr "mode" "HI")
    284 					(eq_attr "type" "idiv"))))
    285 			 "yf_decoder0,yf_ieu,yf_feu,yf_idiv*3")
    286 
    287 (define_insn_reservation "yongfeng_idiv_QISI" 8
    288 			 (and (eq_attr "cpu" "yongfeng")
    289 			      (and (eq_attr "memory" "none")
    290 				   (and (eq_attr "mode" "QI,SI")
    291 					(eq_attr "type" "idiv"))))
    292 			 "yf_decoder0,yf_ieu,yf_feu,yf_idiv*3")
    293 
    294 
    295 (define_insn_reservation "yongfeng_idiv_mem_DI" 45
    296 			 (and (eq_attr "cpu" "yongfeng")
    297 			      (and (eq_attr "memory" "load")
    298 				   (and (eq_attr "mode" "DI")
    299 					(eq_attr "type" "idiv"))))
    300 			 "yf_decoder0,yf_agu,yf_ieu,yf_feu,yf_idiv*41")
    301 
    302 (define_insn_reservation "yongfeng_idiv_HI_mem" 13
    303 			 (and (eq_attr "cpu" "yongfeng")
    304 			      (and (eq_attr "memory" "load")
    305 				   (and (eq_attr "mode" "HI")
    306 					(eq_attr "type" "idiv"))))
    307 			 "yf_decoder0,yf_agu,yf_ieu,yf_feu,yf_idiv*3")
    308 
    309 
    310 (define_insn_reservation "yongfeng_idiv_QISI_mem" 12
    311 			 (and (eq_attr "cpu" "yongfeng")
    312 			      (and (eq_attr "memory" "load")
    313 				   (and (eq_attr "mode" "QI,SI")
    314 					(eq_attr "type" "idiv"))))
    315 			 "yf_decoder0,yf_agu,yf_ieu,yf_feu,yf_idiv*3")
    316 
    317 ;; MMX,SSE,AVX,AVX2 instructions
    318 ;; sse moves
    319 
    320 (define_insn_reservation "yongfeng_sse_mov" 1
    321 			 (and (eq_attr "cpu" "yongfeng")
    322                               (and (eq_attr "mode" "SF,DF,V4SF,V2DF,TI")
    323 			           (and (eq_attr "memory" "none")
    324 				        (eq_attr "type" "ssemov"))))
    325 			 "yf_decodern,yf_feu")
    326 
    327 (define_insn_reservation "yongfeng_sse_mov_store" 1
    328 			 (and (eq_attr "cpu" "yongfeng")
    329                               (and (eq_attr "mode" "SF,DF,V4SF,V2DF,TI")
    330 			           (and (eq_attr "memory" "store")
    331 				        (eq_attr "type" "ssemov"))))
    332 			 "yf_decodern,yf_agu,yf_feu")
    333 
    334 (define_insn_reservation "yongfeng_sse_mov_load" 5
    335 			 (and (eq_attr "cpu" "yongfeng")
    336                               (and (eq_attr "mode" "SF,DF,V4SF,V2DF,TI")
    337 			           (and (eq_attr "memory" "load")
    338 				        (eq_attr "type" "ssemov"))))
    339 			 "yf_decodern,yf_agu,yf_feu")
    340 
    341 (define_insn_reservation "yongfeng_avx256_mov" 1
    342 			 (and (eq_attr "cpu" "yongfeng")
    343                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    344 			           (and (eq_attr "memory" "none")
    345 				        (eq_attr "type" "ssemov"))))
    346 			 "yf_decoder012,yf_feu")
    347 
    348 (define_insn_reservation "yongfeng_avx256_mov_store" 1
    349 			 (and (eq_attr "cpu" "yongfeng")
    350                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    351 			           (and (eq_attr "memory" "store")
    352 				        (eq_attr "type" "ssemov"))))
    353 			 "yf_decoder012,yf_agu,yf_feu")
    354 
    355 (define_insn_reservation "yongfeng_avx256_mov_load" 6
    356 			 (and (eq_attr "cpu" "yongfeng")
    357                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    358 			           (and (eq_attr "memory" "load")
    359 				        (eq_attr "type" "ssemov"))))
    360 			 "yf_decoder012,yf_agu,yf_feu")
    361 
    362 ;;sse general instructions
    363 (define_insn_reservation "yongfeng_sse_insns" 3
    364 			 (and (eq_attr "cpu" "yongfeng")
    365                               (and (eq_attr "mode" "SF,DF,V4SF,V2DF,TI")
    366 			           (and (eq_attr "memory" "none")
    367 				        (eq_attr "type" "sseadd,sseadd1,ssemul,ssecmp"))))
    368 			 "yf_decodern,yf_feu|yf_feu")
    369 
    370 (define_insn_reservation "yongfeng_sse_insns_load" 7
    371 			 (and (eq_attr "cpu" "yongfeng")
    372                               (and (eq_attr "mode" "SF,DF,V4SF,V2DF,TI")
    373 			           (and (eq_attr "memory" "load")
    374 				        (eq_attr "type" "sseadd,sseadd1,ssemul,ssecmp"))))
    375 			 "yf_decodern,yf_agu,yf_feu")
    376 
    377 (define_insn_reservation "yongfeng_avx256_insns" 3
    378 			 (and (eq_attr "cpu" "yongfeng")
    379                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    380 			           (and (eq_attr "memory" "none")
    381 				        (eq_attr "type" "sseadd,sseadd1,ssemul,ssecmp"))))
    382 			 "yf_decoder012,yf_feu")
    383 
    384 (define_insn_reservation "yongfeng_avx256_insns_load" 8
    385 			 (and (eq_attr "cpu" "yongfeng")
    386                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    387 			           (and (eq_attr "memory" "load")
    388 				        (eq_attr "type" "sseadd,sseadd1,ssemul,ssecmp"))))
    389 			 "yf_decoder012,yf_agu,yf_feu")
    390 
    391 (define_insn_reservation "yongfeng_sse_iadd" 1
    392 			 (and (eq_attr "cpu" "yongfeng")
    393                               (and (eq_attr "mode" "DI,TI")
    394 			           (and (eq_attr "memory" "none")
    395 				        (eq_attr "type" "sseiadd"))))
    396 			 "yf_decodern,yf_feu")
    397 
    398 (define_insn_reservation "yongfeng_sse_iadd_load" 5
    399 			 (and (eq_attr "cpu" "yongfeng")
    400                               (and (eq_attr "mode" "DI,TI")
    401 			           (and (eq_attr "memory" "load")
    402 				        (eq_attr "type" "sseiadd"))))
    403 			 "yf_decodern,yf_agu,yf_feu")
    404 
    405 (define_insn_reservation "yongfeng_avx256_iadd" 1
    406 			 (and (eq_attr "cpu" "yongfeng")
    407                               (and (eq_attr "mode" "OI")
    408 			           (and (eq_attr "memory" "none")
    409 				        (eq_attr "type" "sseiadd"))))
    410 			 "yf_decoder012,yf_feu")
    411 
    412 (define_insn_reservation "yongfeng_avx256_iadd_load" 6
    413 			 (and (eq_attr "cpu" "yongfeng")
    414                               (and (eq_attr "mode" "OI")
    415 			           (and (eq_attr "memory" "load")
    416 				        (eq_attr "type" "sseiadd"))))
    417 			 "yf_decoder0,yf_agu,yf_feu")
    418 
    419 (define_insn_reservation "yongfeng_sse_iadd1" 2
    420 			 (and (eq_attr "cpu" "yongfeng")
    421 			           (and (eq_attr "memory" "none")
    422 				        (eq_attr "type" "sseiadd1")))
    423 			 "yf_decoder0,yf_feu")
    424 
    425 (define_insn_reservation "yongfeng_sse_iadd1_load" 6
    426 			 (and (eq_attr "cpu" "yongfeng")
    427 			           (and (eq_attr "memory" "load")
    428 				        (eq_attr "type" "sseiadd1")))
    429 			 "yf_decoder0,yf_agu,yf_feu")
    430 
    431 ;;sse imul
    432 (define_insn_reservation "yongfeng_sse_imul" 2
    433 			 (and (eq_attr "cpu" "yongfeng")
    434                               (and (eq_attr "mode" "DI,TI")
    435 			           (and (eq_attr "memory" "none")
    436 				        (eq_attr "type" "sseimul"))))
    437 			 "yf_decodern,yf_feu")
    438 
    439 (define_insn_reservation "yongfeng_sse_imul_load" 6
    440 			 (and (eq_attr "cpu" "yongfeng")
    441                               (and (eq_attr "mode" "DI,TI")
    442 			           (and (eq_attr "memory" "load")
    443 				        (eq_attr "type" "sseimul"))))
    444 			 "yf_decoder012,yf_agu,yf_feu")
    445 
    446 (define_insn_reservation "yongfeng_avx256_imul" 2
    447 			 (and (eq_attr "cpu" "yongfeng")
    448                               (and (eq_attr "mode" "OI")
    449 			           (and (eq_attr "memory" "none")
    450 				        (eq_attr "type" "sseimul"))))
    451 			 "yf_decoder012,yf_feu")
    452 
    453 (define_insn_reservation "yongfeng_avx256_imul_load" 7
    454 			 (and (eq_attr "cpu" "yongfeng")
    455                               (and (eq_attr "mode" "OI")
    456 			           (and (eq_attr "memory" "load")
    457 				        (eq_attr "type" "sseimul"))))
    458 			 "yf_decoder0,yf_agu,yf_feu")
    459 
    460 ;; sse FMA
    461 (define_insn_reservation "yongfeng_sse_fma" 5
    462 			 (and (eq_attr "cpu" "yongfeng")
    463                               (and (eq_attr "mode" "SF,DF,V4SF,V2DF")
    464 			           (and (eq_attr "memory" "none")
    465 				        (eq_attr "type" "ssemuladd"))))
    466 			 "yf_decodern,yf_feu")
    467 
    468 (define_insn_reservation "yongfeng_sse_fma_load" 9
    469 			 (and (eq_attr "cpu" "yongfeng")
    470                               (and (eq_attr "mode" "SF,DF,V4SF,V2DF")
    471 			           (and (eq_attr "memory" "load")
    472 				        (eq_attr "type" "ssemuladd"))))
    473 			 "yf_decoder012,yf_agu,yf_feu")
    474 
    475 (define_insn_reservation "yongfeng_avx256_fma" 5
    476 			 (and (eq_attr "cpu" "yongfeng")
    477                               (and (eq_attr "mode" "V8SF,V4DF")
    478 			           (and (eq_attr "memory" "none")
    479 				        (eq_attr "type" "ssemuladd"))))
    480 			 "yf_decoder012,yf_feu")
    481 
    482 (define_insn_reservation "yongfeng_avx256_fma_load" 10
    483 			 (and (eq_attr "cpu" "yongfeng")
    484                               (and (eq_attr "mode" "V8SF,V4DF")
    485 			           (and (eq_attr "memory" "load")
    486 				        (eq_attr "type" "ssemuladd"))))
    487 			 "yf_decoder0,yf_agu,yf_feu")
    488 ;; sse div
    489 (define_insn_reservation "yongfeng_ssediv_s" 10
    490 			 (and (eq_attr "cpu" "yongfeng")
    491                               (and (eq_attr "mode" "SF,V4SF")
    492 			           (and (eq_attr "memory" "none")
    493 				        (eq_attr "type" "ssediv"))))
    494 			 "yf_decodern,yf_fdiv*2")
    495 
    496 (define_insn_reservation "yongfeng_ssediv_s_load" 14
    497 			 (and (eq_attr "cpu" "yongfeng")
    498                               (and (eq_attr "mode" "SF,V4SF")
    499 			           (and (eq_attr "memory" "load")
    500 				        (eq_attr "type" "ssediv"))))
    501 			 "yf_decodern,yf_agu,yf_fdiv*2")
    502 
    503 (define_insn_reservation "yongfeng_ssediv_d" 14
    504 			 (and (eq_attr "cpu" "yongfeng")
    505                               (and (eq_attr "mode" "DF,V2DF")
    506 			           (and (eq_attr "memory" "none")
    507 				        (eq_attr "type" "ssediv"))))
    508 			 "yf_decodern,yf_fdiv*3")
    509 
    510 (define_insn_reservation "yongfeng_ssediv_d_load" 18
    511 			 (and (eq_attr "cpu" "yongfeng")
    512                               (and (eq_attr "mode" "DF,V2DF")
    513 			           (and (eq_attr "memory" "load")
    514 				        (eq_attr "type" "ssediv"))))
    515 			 "yf_decodern,yf_agu,yf_fdiv*3")
    516 
    517 (define_insn_reservation "yongfeng_ssediv_avx256_s" 10
    518 			 (and (eq_attr "cpu" "yongfeng")
    519                               (and (eq_attr "mode" "V8SF")
    520 			           (and (eq_attr "memory" "none")
    521 				        (eq_attr "type" "ssediv"))))
    522 			 "yf_decoder012,yf_fdiv*10")
    523 
    524 (define_insn_reservation "yongfeng_ssediv_avx256_s_load" 15
    525 			 (and (eq_attr "cpu" "yongfeng")
    526                               (and (eq_attr "mode" "V8SF")
    527 			           (and (eq_attr "memory" "none")
    528 				        (eq_attr "type" "ssediv"))))
    529 			 "yf_decoder012,yf_agu,yf_fdiv*10")
    530 
    531 (define_insn_reservation "yongfeng_ssediv_avx256_d" 14
    532 			 (and (eq_attr "cpu" "yongfeng")
    533                               (and (eq_attr "mode" "V4DF")
    534 			           (and (eq_attr "memory" "none")
    535 				        (eq_attr "type" "ssediv"))))
    536 			 "yf_decoder012,yf_fdiv*14")
    537 
    538 (define_insn_reservation "yongfeng_ssediv_avx256_d_load" 19
    539 			 (and (eq_attr "cpu" "yongfeng")
    540                               (and (eq_attr "mode" "V4DF")
    541 			           (and (eq_attr "memory" "load")
    542 				        (eq_attr "type" "ssediv"))))
    543 			 "yf_decoder012,yf_fdiv*14")
    544 
    545 ;;sse logical and shuffle instructions
    546 (define_insn_reservation "yongfeng_avx256_log_shuf" 1
    547 			 (and (eq_attr "cpu" "yongfeng")
    548                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    549 			           (and (eq_attr "memory" "none")
    550 				        (eq_attr "type" "sselog,sselog1,sseshuf,sseshuf1"))))
    551 			 "yf_decoder012,yf_feu")
    552 
    553 (define_insn_reservation "yongfeng_avx256_log_shuf_load" 6
    554 			 (and (eq_attr "cpu" "yongfeng")
    555                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    556 			           (and (eq_attr "memory" "load")
    557 				        (eq_attr "type" "sselog,sselog1,sseshuf,sseshuf1"))))
    558 			 "yf_decoder012,yf_agu,yf_feu")
    559 
    560 (define_insn_reservation "yongfeng_sse_log_shuf" 1
    561 			 (and (eq_attr "cpu" "yongfeng")
    562 			      (and (eq_attr "memory" "none")
    563 				   (eq_attr "type" "sselog,sselog1,sseshuf,sseshuf1")))
    564 			 "yf_decodern,yf_feu")
    565 
    566 (define_insn_reservation "yongfeng_sse_log_shuf_load" 5
    567 			 (and (eq_attr "cpu" "yongfeng")
    568 			      (and (eq_attr "memory" "load")
    569 				   (eq_attr "type" "sselog,sselog1,sseshuf,sseshuf1")))
    570 			 "yf_decodern,yf_agu,yf_feu")
    571 ;;sse shift
    572 
    573 (define_insn_reservation "yongfeng_avx256_shift" 1
    574 			 (and (eq_attr "cpu" "yongfeng")
    575                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    576 			           (and (eq_attr "memory" "none")
    577 				        (eq_attr "type" "sseishft,sseishft1"))))
    578 			 "yf_decoder012,yf_feu")
    579 
    580 (define_insn_reservation "yongfeng_avx256_shift_load" 6
    581 			 (and (eq_attr "cpu" "yongfeng")
    582                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    583 			           (and (eq_attr "memory" "load")
    584 				        (eq_attr "type" "sseishft,sseishft1"))))
    585 			 "yf_decoder0,yf_agu,yf_feu")
    586 
    587 (define_insn_reservation "yongfeng_sse_shift" 1
    588 			 (and (eq_attr "cpu" "yongfeng")
    589 			      (and (eq_attr "memory" "none")
    590 				   (eq_attr "type" "sseishft,sseishft1")))
    591 			 "yf_decodern,yf_feu")
    592 
    593 (define_insn_reservation "yongfeng_sse_shift_load" 5
    594 			 (and (eq_attr "cpu" "yongfeng")
    595 			      (and (eq_attr "memory" "load")
    596 				   (eq_attr "type" "sseishft,sseishft1")))
    597 			 "yf_decodern,yf_agu,yf_feu")
    598 ;;sse comi
    599 (define_insn_reservation "yongfeng_avx256_test" 4
    600 			 (and (eq_attr "cpu" "yongfeng")
    601                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    602                                    (and (eq_attr "prefix_extra" "1")
    603 			                (and (eq_attr "memory" "none")
    604 				             (eq_attr "type" "ssecomi")))))
    605 			 "yf_decoder012,yf_ieu*3")
    606 
    607 (define_insn_reservation "yongfeng_avx256_test_load" 9
    608 			 (and (eq_attr "cpu" "yongfeng")
    609                               (and (eq_attr "mode" "V8SF,V4DF,OI")
    610                                    (and (eq_attr "prefix_extra" "1")
    611 			                (and (eq_attr "memory" "load")
    612 				             (eq_attr "type" "ssecomi")))))
    613 			 "yf_decoder012,yf_agu,yf_ieu,yf_p6*3")
    614 
    615 (define_insn_reservation "yongfeng_sse_test" 3
    616 			 (and (eq_attr "cpu" "yongfeng")
    617                               (and (eq_attr "prefix_extra" "1")
    618 			           (and (eq_attr "memory" "none")
    619 				        (eq_attr "type" "ssecomi"))))
    620 			 "yf_decodern,yf_feu|yf_feu")
    621 
    622 (define_insn_reservation "yongfeng_sse_test_load" 7
    623 			 (and (eq_attr "cpu" "yongfeng")
    624                               (and (eq_attr "prefix_extra" "1")
    625 			           (and (eq_attr "memory" "load")
    626 				        (eq_attr "type" "ssecomi"))))
    627 			 "yf_decodern,yf_agu,yf_feu")
    628 
    629 (define_insn_reservation "yongfeng_sse_comi" 1
    630 			 (and (eq_attr "cpu" "yongfeng")
    631                               (and (eq_attr "prefix_extra" "0")
    632 			           (and (eq_attr "memory" "none")
    633 				        (eq_attr "type" "ssecomi"))))
    634 			 "yf_decodern,yf_feu|yf_feu")
    635 
    636 (define_insn_reservation "yongfeng_sse_comi_load" 4
    637 			 (and (eq_attr "cpu" "yongfeng")
    638                               (and (eq_attr "prefix_extra" "0")
    639 			           (and (eq_attr "memory" "load")
    640 				        (eq_attr "type" "ssecomi"))))
    641 			 "yf_decodern,yf_agu,yf_feu")
    642 
    643 ;;sse conversion
    644 (define_insn_reservation "yongfeng_avx_cvt_ps" 4
    645 			 (and (eq_attr "cpu" "yongfeng")
    646                               (and (eq_attr "mode" "V4SF")
    647 			           (and (eq_attr "memory" "none")
    648 				        (eq_attr "type" "ssecvt"))))
    649 			 "yf_decoder0,yf_feu")
    650 
    651 (define_insn_reservation "yongfeng_avx_cvt_ps_load" 8
    652 			 (and (eq_attr "cpu" "yongfeng")
    653                               (and (eq_attr "mode" "V4SF")
    654 			           (and (eq_attr "memory" "load")
    655 				        (eq_attr "type" "ssecvt"))))
    656 			 "yf_decoder0,yf_agu,yf_feu")
    657 
    658 (define_insn_reservation "yongfeng_avx_cvt_pd" 3
    659 			 (and (eq_attr "cpu" "yongfeng")
    660                               (and (eq_attr "mode" "V4DF")
    661 			           (and (eq_attr "memory" "none")
    662 				        (eq_attr "type" "ssecvt"))))
    663 			 "yf_decoder0,yf_feu")
    664 
    665 (define_insn_reservation "yongfeng_avx_cvt_pd_load" 7
    666 			 (and (eq_attr "cpu" "yongfeng")
    667                               (and (eq_attr "mode" "V4DF")
    668 			           (and (eq_attr "memory" "load")
    669 				        (eq_attr "type" "ssecvt"))))
    670 			 "yf_decoder0,yf_agu,yf_feu")
    671 
    672 (define_insn_reservation "yongfeng_sse_cvt" 3
    673 			 (and (eq_attr "cpu" "yongfeng")
    674 			           (and (eq_attr "memory" "none")
    675 				        (eq_attr "type" "ssecvt")))
    676 			 "yf_decodern,yf_feu|yf_feu")
    677 
    678 (define_insn_reservation "yongfeng_sse_cvt_load" 7
    679 			 (and (eq_attr "cpu" "yongfeng")
    680 			           (and (eq_attr "memory" "load")
    681 				        (eq_attr "type" "ssecvt")))
    682 			 "yf_decoder012,yf_agu,yf_feu")
    683 
    684 (define_insn_reservation "yongfeng_sse_icvt" 3
    685 			 (and (eq_attr "cpu" "yongfeng")
    686 			           (and (eq_attr "memory" "none")
    687 				        (eq_attr "type" "sseicvt")))
    688 			 "yf_decodern,yf_feu|yf_feu")
    689 
    690 (define_insn_reservation "yongfeng_sse_icvt_load" 7
    691 			 (and (eq_attr "cpu" "yongfeng")
    692 			           (and (eq_attr "memory" "load")
    693 				        (eq_attr "type" "sseicvt")))
    694 			 "yf_decoder012,yf_agu,yf_feu")
    695 
    696 (define_insn_reservation "yongfeng_sse_icvt_SI" 1
    697 			 (and (eq_attr "cpu" "yongfeng")
    698                               (and (eq_attr "mode" "SI")
    699 			           (and (eq_attr "memory" "none")
    700 				        (eq_attr "type" "sseicvt"))))
    701 			 "yf_decoder012,yf_feu")
    702 
    703 (define_insn_reservation "yongfeng_sse_icvt_SI_load" 5
    704 			 (and (eq_attr "cpu" "yongfeng")
    705                               (and (eq_attr "mode" "SI")
    706 			           (and (eq_attr "memory" "load")
    707 				        (eq_attr "type" "sseicvt"))))
    708 			 "yf_decoder012,yf_agu,yf_feu")
    709 
    710 (define_insn_reservation "yongfeng_sse_icvt_DI" 2
    711 			 (and (eq_attr "cpu" "yongfeng")
    712                               (and (eq_attr "mode" "DI")
    713 			           (and (eq_attr "memory" "none")
    714 				        (eq_attr "type" "sseicvt"))))
    715 			 "yf_decoder0,yf_feu")
    716 
    717 (define_insn_reservation "yongfeng_sse_icvt_DI_load" 6
    718 			 (and (eq_attr "cpu" "yongfeng")
    719                               (and (eq_attr "mode" "DI")
    720 			           (and (eq_attr "memory" "load")
    721 				        (eq_attr "type" "sseicvt"))))
    722 			 "yf_decoder0,yf_agu,yf_feu")
    723 ;; MMX
    724 (define_insn_reservation "yongfeng_mmx_move" 1
    725 			 (and (eq_attr "cpu" "yongfeng")
    726 			      (and (eq_attr "memory" "none")
    727 				   (eq_attr "type" "mmxmov")))
    728 			 "yf_decodern,yf_p0")
    729 
    730 (define_insn_reservation "yongfeng_mmx_move_load" 5
    731 			 (and (eq_attr "cpu" "yongfeng")
    732 			      (and (eq_attr "memory" "load")
    733 				   (eq_attr "type" "mmxmov")))
    734 			 "yf_decodern,yf_agu,yf_p0")
    735 
    736 (define_insn_reservation "yongfeng_mmx_move_store" 1
    737 			 (and (eq_attr "cpu" "yongfeng")
    738 			      (and (eq_attr "memory" "store")
    739 				   (eq_attr "type" "mmxmov")))
    740 			 "yf_decodern,yf_agu,yf_p0")
    741 
    742 (define_insn_reservation "yongfeng_mmx_mul" 2
    743 			 (and (eq_attr "cpu" "yongfeng")
    744 			      (and (eq_attr "memory" "none")
    745 				   (eq_attr "type" "mmxmul")))
    746 			 "yf_decodern,yf_feu")
    747 
    748 (define_insn_reservation "yongfeng_mmx_mul_load" 6
    749 			 (and (eq_attr "cpu" "yongfeng")
    750 			      (and (eq_attr "memory" "load")
    751 				   (eq_attr "type" "mmxmul")))
    752 			 "yf_decoder012,yf_agu,yf_feu")
    753 
    754 ;; MMX general instructions
    755 (define_insn_reservation "yongfeng_mmx_insns" 1
    756 			 (and (eq_attr "cpu" "yongfeng")
    757 			      (and (eq_attr "memory" "none")
    758 				   (eq_attr "type" "mmxadd,mmxshft,mmxcmp,mmx,mmxcvt")))
    759 			 "yf_decodern,yf_feu|yf_feu")
    760 
    761 (define_insn_reservation "yongfeng_mmx_insns_load" 5
    762 			 (and (eq_attr "cpu" "yongfeng")
    763 			      (and (eq_attr "memory" "load")
    764 				   (eq_attr "type" "mmxadd,mmxshft,mmxcmp,mmx,mmxcvt")))
    765 			 "yf_decodern,yf_agu,yf_feu|yf_feu")
    766 
    767 (define_insn_reservation "yongfeng_mmx_insns_store" 1
    768 			 (and (eq_attr "cpu" "yongfeng")
    769 			      (and (eq_attr "memory" "store")
    770 				   (eq_attr "type" "mmxadd,mmxshft,mmxcmp,mmx,mmxcvt")))
    771 			 "yf_decodern,yf_agu,yf_feu")
    772 
    773 ;; x87 floating point operations.
    774 
    775 (define_insn_reservation "yongfeng_fxch" 1
    776 			 (and (eq_attr "cpu" "yongfeng")
    777 			      (eq_attr "type" "fxch"))
    778 			 "yf_decodern,yf_p0|yf_p1")
    779 
    780 (define_insn_reservation "yongfeng_fcmov_sgn" 1
    781 			 (and (eq_attr "cpu" "yongfeng")
    782 			      (eq_attr "type" "fcmov,fsgn"))
    783 			 "yf_decodern,yf_p0|yf_p1,yf_feu")
    784 
    785 (define_insn_reservation "yongfeng_fcmp" 1
    786 			 (and (eq_attr "cpu" "yongfeng")
    787                               (and (eq_attr "memory" "none")
    788 			           (eq_attr "type" "fcmp")))
    789 			 "yf_decodern,yf_feu")
    790 
    791 (define_insn_reservation "yongfeng_fcmp_load" 5
    792 			 (and (eq_attr "cpu" "yongfeng")
    793                               (and (eq_attr "memory" "load")
    794 			           (eq_attr "type" "fcmp")))
    795 			 "yf_decodern,yf_agu,yf_feu")
    796 
    797 (define_insn_reservation "yongfeng_fmov" 1
    798 			 (and (eq_attr "cpu" "yongfeng")
    799                               (and (eq_attr "memory" "none")
    800 			           (eq_attr "type" "fmov")))
    801 			 "yf_decodern,yf_feu")
    802 
    803 (define_insn_reservation "yongfeng_fmov_store" 1
    804 			 (and (eq_attr "cpu" "yongfeng")
    805                               (and (eq_attr "memory" "store")
    806 			           (eq_attr "type" "fmov")))
    807 			 "yf_decoder0,yf_agu,yf_feu")
    808 
    809 (define_insn_reservation "yongfeng_fmov_load" 5
    810 			 (and (eq_attr "cpu" "yongfeng")
    811                               (and (eq_attr "memory" "load")
    812 			           (eq_attr "type" "fmov")))
    813 			 "yf_decoder0,yf_agu,yf_feu")
    814 
    815 (define_insn_reservation "yongfeng_fistp" 5
    816 			 (and (eq_attr "cpu" "yongfeng")
    817 			      (eq_attr "type" "fistp,fisttp"))
    818 			 "yf_decoder012,yf_agu,yf_feu")
    819 
    820 (define_insn_reservation "yongfeng_fop_mul" 3
    821 			 (and (eq_attr "cpu" "yongfeng")
    822 			      (and (eq_attr "memory" "none,unknown")
    823 				   (eq_attr "type" "fop,fmul")))
    824 			 "yf_decodern,yf_feu")
    825 
    826 (define_insn_reservation "yongfeng_fop_mul_load" 7
    827 			 (and (eq_attr "cpu" "yongfeng")
    828 			      (and (eq_attr "memory" "load,both")
    829 				   (eq_attr "type" "fop,fmul")))
    830 			 "yf_decoder012,yf_agu,yf_feu")
    831 
    832 (define_insn_reservation "yf_fop_store" 3
    833 			 (and (eq_attr "cpu" "yongfeng")
    834 			      (and (eq_attr "memory" "store")
    835 				   (eq_attr "type" "fop")))
    836 			 "yf_decodern,yf_agu,yf_feu")
    837 
    838 (define_insn_reservation "yongfeng_fdiv_fpspc" 14
    839 			 (and (eq_attr "cpu" "yongfeng")
    840 			      (and (eq_attr "memory" "none")
    841 				   (eq_attr "type" "fdiv,fpspc")))
    842 			 "yf_decodern,yf_fdiv*7")
    843 
    844 (define_insn_reservation "yongfeng_fdiv_fpspc_load" 18
    845 			 (and (eq_attr "cpu" "yongfeng")
    846 			      (and (eq_attr "memory" "load")
    847 				   (eq_attr "type" "fdiv,fpspc")))
    848 			 "yf_decoder012,yf_agu,yf_fdiv*7")
    849