Home | History | Annotate | Line # | Download | only in rl78
rl78-virt.md revision 1.1.1.6
      1      1.1  mrg ;;  Machine Description for Renesas RL78 processors
      2  1.1.1.6  mrg ;;  Copyright (C) 2011-2018 Free Software Foundation, Inc.
      3      1.1  mrg ;;  Contributed by Red Hat.
      4      1.1  mrg 
      5      1.1  mrg ;; This file is part of GCC.
      6      1.1  mrg 
      7      1.1  mrg ;; GCC is free software; you can redistribute it and/or modify
      8      1.1  mrg ;; it under the terms of the GNU General Public License as published by
      9      1.1  mrg ;; the Free Software Foundation; either version 3, or (at your option)
     10      1.1  mrg ;; any later version.
     11      1.1  mrg 
     12      1.1  mrg ;; GCC is distributed in the hope that it will be useful,
     13      1.1  mrg ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     14      1.1  mrg ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15      1.1  mrg ;; GNU General Public License for more details.
     16      1.1  mrg 
     17      1.1  mrg ;; You should have received a copy of the GNU General Public License
     18      1.1  mrg ;; along with GCC; see the file COPYING3.  If not see
     19      1.1  mrg ;; <http://www.gnu.org/licenses/>.
     20      1.1  mrg 
     22      1.1  mrg ;; In this MD file, we define those insn patterns that involve
     23      1.1  mrg ;; registers, where such registers are virtual until allocated to a
     24      1.1  mrg ;; physical register.  All of these insns need to be conditional on
     25      1.1  mrg ;; rl78_virt_insns_ok () being true.
     26      1.1  mrg 
     27      1.1  mrg ;; This tells the physical register allocator what method to use to
     28      1.1  mrg ;; allocate registers.  Basically, this defines the template of the
     29      1.1  mrg ;; instruction - op1 is of the form "a = op(b)", op2 is "a = b op c"
     30      1.1  mrg ;; etc.
     31  1.1.1.4  mrg 
     32      1.1  mrg (define_attr "valloc" "op1,op2,ro1,cmp,umul,macax,divhi,divsi"
     33      1.1  mrg   (const_string "op2"))
     34      1.1  mrg 
     35      1.1  mrg ;;---------- Moving ------------------------
     36  1.1.1.2  mrg 
     37  1.1.1.2  mrg (define_insn "*movqi_virt_mm"
     38  1.1.1.2  mrg   [(set (match_operand:QI 0 "rl78_near_mem_operand" "=Y")
     39  1.1.1.2  mrg 	(match_operand    1 "rl78_near_mem_operand" "Y"))]
     40  1.1.1.2  mrg   "rl78_virt_insns_ok ()"
     41  1.1.1.2  mrg   "v.mov %0, %1"
     42  1.1.1.2  mrg   [(set_attr "valloc" "op1")]
     43  1.1.1.2  mrg )
     44      1.1  mrg 
     45  1.1.1.4  mrg (define_insn "*movqi_virt"
     46  1.1.1.4  mrg   [(set (match_operand:QI 0 "nonimmediate_operand" "=vY,v,*Wfr,Y,*Wfr,*Wfr")
     47      1.1  mrg 	(match_operand    1 "general_operand" "vInt8JY,*Wfr,vInt8J,*Wfr,Y,*Wfr"))]
     48      1.1  mrg   "rl78_virt_insns_ok ()"
     49      1.1  mrg   "v.mov %0, %1"
     50      1.1  mrg   [(set_attr "valloc" "op1")]
     51      1.1  mrg )
     52  1.1.1.2  mrg 
     53  1.1.1.2  mrg (define_insn "*movhi_virt_mm"
     54  1.1.1.2  mrg   [(set (match_operand:HI 0 "rl78_near_mem_operand" "=Y")
     55  1.1.1.2  mrg 	(match_operand:HI 1 "rl78_near_mem_operand" "Y"))]
     56  1.1.1.2  mrg   "rl78_virt_insns_ok ()"
     57  1.1.1.2  mrg   "v.movw %0, %1"
     58  1.1.1.2  mrg   [(set_attr "valloc" "op1")]
     59  1.1.1.2  mrg )
     60      1.1  mrg 
     61  1.1.1.4  mrg (define_insn "*movhi_virt"
     62  1.1.1.4  mrg   [(set (match_operand:HI 0 "nonimmediate_operand" "=vS,  Y,   v,   *Wfr")
     63      1.1  mrg 	(match_operand:HI 1 "general_operand"      "viYS, viS, *Wfr, vi"))]
     64      1.1  mrg   "rl78_virt_insns_ok ()"
     65      1.1  mrg   "v.movw %0, %1"
     66      1.1  mrg   [(set_attr "valloc" "op1")]
     67      1.1  mrg )
     68  1.1.1.6  mrg 
     69  1.1.1.6  mrg (define_insn "*bswaphi2_virt"
     70  1.1.1.6  mrg   [(set (match_operand:HI           0 "rl78_nonfar_nonimm_operand" "=vm")
     71  1.1.1.6  mrg         (bswap:HI (match_operand:HI 1 "general_operand"  "vim")))]
     72  1.1.1.6  mrg   "rl78_virt_insns_ok ()"
     73  1.1.1.6  mrg   "v.bswaphi\t%0, %1"
     74  1.1.1.6  mrg   [(set_attr "valloc" "op1")]
     75  1.1.1.6  mrg )
     76      1.1  mrg 
     77      1.1  mrg ;;---------- Conversions ------------------------
     78      1.1  mrg 
     79  1.1.1.4  mrg (define_insn "*zero_extendqihi2_virt"
     80  1.1.1.4  mrg   [(set (match_operand:HI                 0 "rl78_nonfar_nonimm_operand" "=vY,*Wfr")
     81  1.1.1.4  mrg 	(zero_extend:HI (match_operand:QI 1 "general_operand" "vim,viY")))]
     82      1.1  mrg   "rl78_virt_insns_ok () && rl78_one_far_p (operands, 2)"
     83      1.1  mrg   "v.zero_extend\t%0, %1"
     84      1.1  mrg   [(set_attr "valloc" "op1")]
     85      1.1  mrg   )
     86      1.1  mrg 
     87  1.1.1.4  mrg (define_insn "*extendqihi2_virt"
     88  1.1.1.4  mrg   [(set (match_operand:HI                 0 "rl78_nonfar_nonimm_operand" "=vY,*Wfr")
     89  1.1.1.4  mrg 	(sign_extend:HI (match_operand:QI 1 "general_operand" "vim,viY")))]
     90      1.1  mrg   "rl78_virt_insns_ok () && rl78_one_far_p (operands, 2)"
     91      1.1  mrg   "v.sign_extend\t%0, %1"
     92      1.1  mrg   [(set_attr "valloc" "op1")]
     93      1.1  mrg   )
     94      1.1  mrg 
     95      1.1  mrg ;;---------- Arithmetic ------------------------
     96  1.1.1.2  mrg 
     97  1.1.1.2  mrg (define_insn "*inc<mode>3_virt"
     98  1.1.1.2  mrg   [(set (match_operand:QHI           0 "rl78_incdec_memory_operand" "=vm")
     99  1.1.1.2  mrg 	(plus:QHI (match_operand:QHI 1 "rl78_incdec_memory_operand" "0")
    100  1.1.1.2  mrg 		  (match_operand:QHI 2 "rl78_1_2_operand" "KLNO")))
    101  1.1.1.2  mrg    ]
    102  1.1.1.2  mrg   "rl78_virt_insns_ok ()"
    103  1.1.1.2  mrg   "v.inc\t%0, %1, %2"
    104  1.1.1.2  mrg )
    105      1.1  mrg 
    106  1.1.1.4  mrg (define_insn "*add<mode>3_virt"
    107  1.1.1.4  mrg   [(set (match_operand:QHI           0 "rl78_nonimmediate_operand" "=vY,  S, *Wfr,  vY")
    108  1.1.1.4  mrg 	(plus:QHI (match_operand:QHI 1 "rl78_general_operand"      "%viY, 0, 0viY, *Wfr")
    109      1.1  mrg 		  (match_operand:QHI 2 "rl78_general_operand"       "vim, i, viY,  viY")))
    110  1.1.1.4  mrg    ]
    111      1.1  mrg   "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
    112      1.1  mrg   "v.add\t%0, %1, %2"
    113      1.1  mrg )
    114      1.1  mrg 
    115  1.1.1.4  mrg (define_insn "*sub<mode>3_virt"
    116  1.1.1.4  mrg   [(set (match_operand:QHI            0 "rl78_nonimmediate_operand" "=vY, S, *Wfr,  vY")
    117  1.1.1.4  mrg 	(minus:QHI (match_operand:QHI 1 "rl78_general_operand"      "viY, 0, 0viY, *Wfr")
    118      1.1  mrg 		   (match_operand:QHI 2 "rl78_general_operand"      "vim, i, viY,  viY")))
    119  1.1.1.4  mrg    ]
    120      1.1  mrg   "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
    121      1.1  mrg   "v.sub\t%0, %1, %2"
    122      1.1  mrg )
    123      1.1  mrg 
    124  1.1.1.4  mrg (define_insn "*umulhi3_shift_virt"
    125      1.1  mrg   [(set (match_operand:HI          0 "register_operand" "=v")
    126      1.1  mrg         (mult:HI (match_operand:HI 1 "rl78_nonfar_operand" "%vim")
    127  1.1.1.3  mrg                  (match_operand:HI 2 "rl78_24_operand" "Ni")))]
    128      1.1  mrg   "rl78_virt_insns_ok ()"
    129      1.1  mrg   "v.mulu\t%0, %1, %2"
    130      1.1  mrg   [(set_attr "valloc" "umul")]
    131      1.1  mrg )
    132      1.1  mrg 
    133  1.1.1.4  mrg (define_insn "*umulqihi3_virt"
    134      1.1  mrg   [(set (match_operand:HI                          0 "register_operand" "=v")
    135      1.1  mrg         (mult:HI (zero_extend:HI (match_operand:QI 1 "rl78_nonfar_operand" "%vim"))
    136  1.1.1.3  mrg                  (zero_extend:HI (match_operand:QI 2 "general_operand" "vim"))))]
    137      1.1  mrg   "rl78_virt_insns_ok ()"
    138      1.1  mrg   "v.mulu\t%0, %2"
    139      1.1  mrg   [(set_attr "valloc" "umul")]
    140      1.1  mrg )
    141      1.1  mrg 
    142  1.1.1.4  mrg (define_insn "*andqi3_virt"
    143  1.1.1.4  mrg   [(set (match_operand:QI         0 "rl78_nonimmediate_operand" "=vm,  *Wfr,  vY")
    144  1.1.1.4  mrg 	(and:QI (match_operand:QI 1 "rl78_general_operand"      "%vim, 0viY, *Wfr")
    145      1.1  mrg 		(match_operand:QI 2 "rl78_general_operand"      "vim,  viY,  viY")))
    146  1.1.1.4  mrg    ]
    147      1.1  mrg   "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
    148      1.1  mrg   "v.and\t%0, %1, %2"
    149      1.1  mrg )
    150      1.1  mrg 
    151  1.1.1.4  mrg (define_insn "*iorqi3_virt"
    152  1.1.1.4  mrg   [(set (match_operand:QI         0 "rl78_nonimmediate_operand" "=vm,  *Wfr,  vY")
    153  1.1.1.4  mrg 	(ior:QI (match_operand:QI 1 "rl78_general_operand"      "%vim, 0viY, *Wfr")
    154      1.1  mrg 		(match_operand:QI 2 "rl78_general_operand"      "vim,  viY,  viY")))
    155  1.1.1.4  mrg    ]
    156      1.1  mrg   "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
    157      1.1  mrg   "v.or\t%0, %1, %2"
    158      1.1  mrg )
    159  1.1.1.2  mrg 
    160  1.1.1.4  mrg (define_insn "*xorqi3_virt"
    161  1.1.1.4  mrg   [(set (match_operand:QI         0 "rl78_nonimmediate_operand" "=vm,  *Wfr,  vY")
    162  1.1.1.4  mrg 	(xor:QI (match_operand:QI 1 "rl78_general_operand"      "%vim, 0viY, *Wfr")
    163      1.1  mrg 		(match_operand    2 "rl78_general_operand"      "vim,  viY,  viY")))
    164  1.1.1.4  mrg    ]
    165      1.1  mrg   "rl78_virt_insns_ok () && rl78_one_far_p (operands, 3)"
    166      1.1  mrg   "v.xor\t%0, %1, %2"
    167      1.1  mrg )
    168      1.1  mrg 
    169      1.1  mrg ;;---------- Shifts ------------------------
    170      1.1  mrg 
    171      1.1  mrg (define_insn "*ashl<mode>3_virt"
    172      1.1  mrg   [(set (match_operand:QHI             0 "rl78_nonfar_nonimm_operand" "=vm")
    173      1.1  mrg 	(ashift:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim")
    174      1.1  mrg 		    (match_operand:QI  2 "general_operand" "vim")))
    175      1.1  mrg    ]
    176      1.1  mrg   "rl78_virt_insns_ok ()"
    177      1.1  mrg   "v.shl\t%0, %1, %2"
    178      1.1  mrg )
    179      1.1  mrg 
    180      1.1  mrg (define_insn "*ashr<mode>3_virt"
    181      1.1  mrg   [(set (match_operand:QHI               0 "rl78_nonfar_nonimm_operand" "=vm")
    182      1.1  mrg 	(ashiftrt:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim")
    183      1.1  mrg 		      (match_operand:QI  2 "general_operand" "vim")))
    184      1.1  mrg    ]
    185      1.1  mrg   "rl78_virt_insns_ok ()"
    186      1.1  mrg   "v.sar\t%0, %1, %2"
    187      1.1  mrg )
    188      1.1  mrg 
    189      1.1  mrg (define_insn "*lshr<mode>3_virt"
    190      1.1  mrg   [(set (match_operand:QHI               0 "rl78_nonfar_nonimm_operand" "=vm")
    191      1.1  mrg 	(lshiftrt:QHI (match_operand:QHI 1 "rl78_nonfar_operand" "vim")
    192      1.1  mrg 		      (match_operand:QI  2 "general_operand" "vim")))
    193      1.1  mrg    ]
    194      1.1  mrg   "rl78_virt_insns_ok ()"
    195      1.1  mrg   "v.shr\t%0, %1, %2"
    196      1.1  mrg )
    197  1.1.1.2  mrg 
    198  1.1.1.2  mrg ;; This is complex mostly because the RL78 has no SImode operations,
    199  1.1.1.2  mrg ;; and very limited HImode operations, and no variable shifts.  This
    200  1.1.1.2  mrg ;; pattern is optimized for each constant shift count and operand
    201  1.1.1.2  mrg ;; types, so as to use a hand-optimized pattern.  For readability, the
    202  1.1.1.2  mrg ;; usual \t\; syntax is not used here.  Also, there's no easy way to 
    203  1.1.1.2  mrg ;; constrain to avoid partial overlaps, hence the duplication.
    204  1.1.1.2  mrg (define_insn "ashrsi3_virt"                                  ;;   0  1      2-7            8         9-15           16   17-23     24   25-31 var
    205  1.1.1.2  mrg   [(set (match_operand:SI               0 "nonimmediate_operand" "=v,vU,&vU,v,  &vU,  &vU, v,  &vU,  v,  &vU, &vU,  vU,  v,&vU,    vU,  vU,   vU")
    206  1.1.1.2  mrg 	(ashiftrt:SI (match_operand:SI  1 "nonimmediate_operand" "0, 0,  vU,0,   vWab, U,  0,   vU,  0,   vWab,U,   vU,  0, vU,    vU,  vU,   0")
    207  1.1.1.2  mrg 		      (match_operand:SI 2 "nonmemory_operand"    "M, K,  K, Int3,Int3,Int3,Iv08,Iv08,Is09,Is09,Is09,Iv16,Is17,Is17,Iv24,Is25, iv")))
    208  1.1.1.2  mrg    (clobber (reg:HI X_REG))
    209  1.1.1.2  mrg     ]
    210  1.1.1.2  mrg    ""
    211  1.1.1.2  mrg    "@
    212  1.1.1.2  mrg     ; ashrsi %0, 0
    213  1.1.1.2  mrg 
    214  1.1.1.2  mrg    movw ax,%H1 \; sarw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
    215  1.1.1.2  mrg    movw ax,%H1 \; sarw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
    216  1.1.1.2  mrg 
    217  1.1.1.2  mrg    movw ax,%1 \; shlw ax,%r2 \; mov %0,a             \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
    218  1.1.1.2  mrg    movw ax,%1 \; shlw ax,%r2 \; mov %0,a             \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
    219  1.1.1.2  mrg    movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov a,%Q1 \; mov x,a   \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
    220  1.1.1.2  mrg 
    221  1.1.1.2  mrg    mov x,%Q1            \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; sarw ax,8 \; movw %H0,ax
    222  1.1.1.2  mrg    mov a,%Q1 \; mov x, a \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; sarw ax,8 \; movw %H0,ax
    223  1.1.1.2  mrg 
    224  1.1.1.2  mrg    mov x,%Q1           \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
    225  1.1.1.2  mrg    mov x,%Q1           \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
    226  1.1.1.2  mrg    mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
    227  1.1.1.2  mrg 
    228  1.1.1.2  mrg    movw ax,%H1 \; movw %0,ax \; sarw ax,15 \; movw %H0,ax
    229  1.1.1.2  mrg 
    230  1.1.1.2  mrg    movw ax,%H1 \; sarw ax,%S2 \; movw %0,ax \; sarw ax,15 \; movw %H0,ax
    231  1.1.1.2  mrg    movw ax,%H1 \; sarw ax,%S2 \; movw %0,ax \; sarw ax,15 \; movw %H0,ax
    232  1.1.1.2  mrg 
    233  1.1.1.2  mrg    movw ax,%H1 \; mov %0,a \; sarw ax,15 \; movw %H0,ax \; mov %Q0,a
    234  1.1.1.2  mrg 
    235  1.1.1.2  mrg    movw ax,%H1 \; sar a,%s2 \; mov %0,a \; sarw ax,15 \; movw %H0,ax \; mov %Q0,a
    236  1.1.1.2  mrg 
    237  1.1.1.2  mrg    mov b,%2 \; cmp0 b \; bz $2f \; 1: \; movw ax,%H1 \; sarw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a \; dec b \; bnz $1b \; 2:"
    238  1.1.1.2  mrg   [(set_attr "valloc" "macax")]
    239  1.1.1.2  mrg )
    240  1.1.1.2  mrg 
    241  1.1.1.2  mrg ;; Likewise.
    242  1.1.1.2  mrg (define_insn "lshrsi3_virt"                                  ;;   0  1      2-7            8         9-15           16   17-23     24   25-31 var
    243  1.1.1.2  mrg   [(set (match_operand:SI               0 "nonimmediate_operand" "=v,vU,&vU,v,  &vU,  &vU, v,  &vU,  v,  &vU, &vU,  vU,  v,&vU,    vU,  vU,   vU")
    244  1.1.1.2  mrg 	(lshiftrt:SI (match_operand:SI  1 "nonimmediate_operand" "0, 0,  vU,0,   vWab, U,  0,   vU,  0,   vWab,U,   vU,  0, vU,    vU,  vU,   0")
    245  1.1.1.2  mrg 		      (match_operand:SI 2 "nonmemory_operand"    "M, K,  K, Int3,Int3,Int3,Iv08,Iv08,Is09,Is09,Is09,Iv16,Is17,Is17,Iv24,Is25, iv")))
    246      1.1  mrg    (clobber (reg:HI X_REG))
    247      1.1  mrg    ]
    248      1.1  mrg   ""
    249  1.1.1.2  mrg   "@
    250  1.1.1.2  mrg    ; lshrsi %0, 0
    251  1.1.1.2  mrg 
    252  1.1.1.2  mrg    movw ax,%H1 \; shrw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
    253  1.1.1.2  mrg    movw ax,%H1 \; shrw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
    254  1.1.1.2  mrg 
    255  1.1.1.2  mrg    movw ax,%1 \; shlw ax,%r2 \; mov %0,a             \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
    256  1.1.1.2  mrg    movw ax,%1 \; shlw ax,%r2 \; mov %0,a             \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
    257  1.1.1.2  mrg    movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov a,%Q1 \; mov x,a   \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
    258  1.1.1.2  mrg 
    259  1.1.1.2  mrg    mov x,%Q1            \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; shrw ax,8 \; movw %H0,ax
    260  1.1.1.2  mrg    mov a,%Q1 \; mov x, a \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; shrw ax,8 \; movw %H0,ax
    261  1.1.1.2  mrg 
    262  1.1.1.2  mrg    mov x,%Q1           \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
    263  1.1.1.2  mrg    mov x,%Q1           \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
    264  1.1.1.2  mrg    mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
    265  1.1.1.2  mrg 
    266  1.1.1.2  mrg    movw ax,%H1 \; movw %0,ax \; movw ax,#0 \; movw %H0,ax
    267  1.1.1.2  mrg 
    268  1.1.1.2  mrg    movw ax,%H1 \; shrw ax,%S2 \; movw %0,ax \; movw ax,#0 \; movw %H0,ax
    269  1.1.1.2  mrg    movw ax,%H1 \; shrw ax,%S2 \; movw %0,ax \; movw ax,#0 \; movw %H0,ax
    270  1.1.1.2  mrg 
    271  1.1.1.2  mrg    movw ax,%H1 \; mov %0,a \; movw ax,#0 \; movw %H0,ax \; mov %Q0,a
    272  1.1.1.2  mrg 
    273  1.1.1.2  mrg    movw ax,%H1 \; shr a,%s2 \; mov %0,a \; movw ax,#0 \; movw %H0,ax \; mov %Q0,a
    274  1.1.1.2  mrg 
    275      1.1  mrg    mov b,%2 \; cmp0 b \; bz $2f \; 1: \; movw ax,%H1 \; shrw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a \; dec b \; bnz $1b \; 2:"
    276      1.1  mrg   [(set_attr "valloc" "macax")]
    277      1.1  mrg )
    278  1.1.1.2  mrg 
    279  1.1.1.2  mrg ;; Likewise.
    280  1.1.1.2  mrg (define_insn "ashlsi3_virt"                                ;;   0  1      2-7            8         9-15           16        17-23     24        25-31     var
    281  1.1.1.2  mrg   [(set (match_operand:SI             0 "nonimmediate_operand" "=v,vU,&vU,v,  &vU,  &vU, v,  &vU,  v,  &vU, &vU,  v,   U,   v,&vU,    v,   U,   v,   U,   vWab,vU,  vU")
    282  1.1.1.2  mrg 	(ashift:SI (match_operand:SI  1 "nonimmediate_operand" "0, 0,  vU,0,   vWab, U,  0,   vU,  0,   vWab,U,   vU,  vU,  0, vU,    vU,  vU,  vU,  vU,  0,   vWab,U")
    283  1.1.1.2  mrg 		    (match_operand:SI 2 "nonmemory_operand"    "M, K,  K, Int3,Int3,Int3,Iv08,Iv08,Is09,Is09,Is09,Iv16,Iv16,Is17,Is17,Iv24,Iv24,Is25,Is25,iv,  iv,  iv")))
    284  1.1.1.2  mrg    (clobber (reg:HI X_REG))
    285  1.1.1.2  mrg    ]
    286  1.1.1.2  mrg   ""
    287  1.1.1.2  mrg   "@
    288  1.1.1.2  mrg    ; lshrsi %0, 0
    289  1.1.1.2  mrg 
    290  1.1.1.2  mrg    movw ax,%1 \; shlw ax,1 \; movw %0,ax \; movw ax,%H1 \; rolwc ax,1 \; movw %H0,ax
    291  1.1.1.2  mrg    movw ax,%1 \; shlw ax,1 \; movw %0,ax \; movw ax,%H1 \; rolwc ax,1 \; movw %H0,ax
    292  1.1.1.2  mrg 
    293  1.1.1.2  mrg    movw ax,%H1 \; shlw ax,%u2 \; mov %E0,a \; mov x,%Q1           \; mov a, %H1 \; shlw ax,%S2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
    294  1.1.1.2  mrg    movw ax,%H1 \; shlw ax,%u2 \; mov %E0,a \; mov x,%Q1           \; mov a, %H1 \; shlw ax,%S2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
    295  1.1.1.2  mrg    movw ax,%H1 \; shlw ax,%u2 \; mov %E0,a \; mov a,%Q1 \; mov x,a \; mov a, %H1 \; shlw ax,%S2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
    296  1.1.1.2  mrg 
    297  1.1.1.2  mrg    mov x,%Q1           \; mov a,%H1 \; movw %H0,ax \; movw ax,%1 \; shlw ax,8 \; movw %0,ax
    298  1.1.1.2  mrg    mov a,%Q1 \; mov x,a \; mov a,%H1 \; movw %H0,ax \; movw ax,%1 \; shlw ax,8 \; movw %0,ax
    299  1.1.1.2  mrg 
    300  1.1.1.2  mrg    mov x,%Q1           \; mov a,%H1 \; shlw ax,%s2 \; movw %H0,ax \; movw ax,%1 \; shlw ax,%s2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
    301  1.1.1.2  mrg    mov x,%Q1           \; mov a,%H1 \; shlw ax,%s2 \; movw %H0,ax \; movw ax,%1 \; shlw ax,%s2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
    302  1.1.1.2  mrg    mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%s2 \; movw %H0,ax \; movw ax,%1 \; shlw ax,%s2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
    303  1.1.1.2  mrg 
    304  1.1.1.2  mrg    movw ax,%1 \; movw %H0,ax \; movw %0,#0
    305  1.1.1.2  mrg    movw ax,%1 \; movw %H0,ax \; movw ax,#0 \; movw %0,ax
    306  1.1.1.2  mrg 
    307  1.1.1.2  mrg    movw ax,%1 \; shlw ax,%S2 \; movw %H0,ax \; movw %0,#0
    308  1.1.1.2  mrg    movw ax,%1 \; shlw ax,%S2 \; movw %H0,ax \; movw ax,#0 \; movw %0,ax
    309  1.1.1.2  mrg 
    310  1.1.1.2  mrg    mov a,%1 \; movw %H0,ax \; mov %H0,#0 \; movw %0,#0
    311  1.1.1.2  mrg    mov a,%1 \; movw %H0,ax \; movw ax,#0 \; mov %H0,a \; movW %0,ax
    312  1.1.1.2  mrg 
    313  1.1.1.2  mrg    mov a,%1 \; shl a,%s2 \; movw %H0,ax \; mov %H0,#0 \; movw %0,#0
    314  1.1.1.2  mrg    mov a,%1 \; shl a,%s2 \; movw %H0,ax \; movw ax,#0 \; mov %H0,a \; movW %0,ax
    315  1.1.1.2  mrg 
    316  1.1.1.2  mrg    mov a,%2 \; cmp0 a \; bz $2f \; mov d,a \; movw ax,%H1 \; movw bc,%1 \; 1: \; shlw bc,1 \; rolwc ax,1 \; dec d \; bnz $1b \; movw %H0,ax \; movw ax,bc \; movw %0,ax \; 2:
    317  1.1.1.2  mrg    mov a,%2 \; mov d,a \; movw ax,%H1 \; movw bc,%1 \; cmp0 0xFFEFD \; bz $2f \; 1: \; shlw bc,1 \; rolwc ax,1 \; dec d \; bnz $1b \; 2: \; movw %H0,ax \; movw ax,bc \; movw %0,ax
    318  1.1.1.2  mrg    mov a,%2 \; mov d,a \; movw ax,%1 \; movw bc,ax \; movw ax,%H1 \; cmp0 0xFFEFD \; bz $2f \; 1: \; shlw bc,1 \; rolwc ax,1 \; dec d \; bnz $1b \; 2: \; movw %H0,ax \; movw ax,bc \; movw %0,ax"
    319  1.1.1.2  mrg    [(set_attr "valloc" "macax")]
    320  1.1.1.2  mrg  )
    321      1.1  mrg 
    322      1.1  mrg ;;---------- Branching ------------------------
    323      1.1  mrg 
    324      1.1  mrg (define_insn "*indirect_jump_virt"
    325      1.1  mrg   [(set (pc)
    326      1.1  mrg 	(match_operand:HI 0 "nonimmediate_operand" "vm"))]
    327      1.1  mrg   "rl78_virt_insns_ok ()"
    328      1.1  mrg   "v.br\t%0"
    329      1.1  mrg   [(set_attr "valloc" "ro1")]
    330      1.1  mrg )
    331      1.1  mrg 
    332      1.1  mrg (define_insn "*call_virt"
    333      1.1  mrg   [(call (match_operand:HI 0 "memory_operand" "Wab,Wcv")
    334      1.1  mrg 	 (match_operand 1 "" ""))]
    335      1.1  mrg   "rl78_virt_insns_ok ()"
    336      1.1  mrg   "v.call\t%0"
    337      1.1  mrg   [(set_attr "valloc" "ro1")]
    338      1.1  mrg   )
    339      1.1  mrg 
    340      1.1  mrg (define_insn "*call_value_virt"
    341      1.1  mrg   [(set (match_operand 0 "register_operand" "=v,v")
    342      1.1  mrg 	(call (match_operand:HI 1 "memory_operand" "Wab,Wcv")
    343      1.1  mrg 	      (match_operand 2 "" "")))]
    344      1.1  mrg   "rl78_virt_insns_ok ()"
    345      1.1  mrg   "v.call\t%1"
    346      1.1  mrg   [(set_attr "valloc" "op1")]
    347      1.1  mrg   )
    348  1.1.1.2  mrg 
    349  1.1.1.2  mrg (define_insn "*cbranchqi4_virt_signed"
    350  1.1.1.2  mrg   [(set (pc) (if_then_else
    351  1.1.1.2  mrg 	      (match_operator 0 "rl78_cmp_operator_signed"
    352  1.1.1.2  mrg 			      [(match_operand:QI 1 "general_operand" "vim")
    353  1.1.1.2  mrg 			       (match_operand:QI 2 "nonmemory_operand" "vi")])
    354  1.1.1.2  mrg               (label_ref (match_operand 3 "" ""))
    355  1.1.1.2  mrg 	      (pc)))]
    356  1.1.1.2  mrg   "rl78_virt_insns_ok ()"
    357  1.1.1.2  mrg   "v.cmp\t%1, %2\\n\tv.b%C0\t%3"
    358  1.1.1.2  mrg   [(set_attr "valloc" "cmp")]
    359  1.1.1.2  mrg   )
    360      1.1  mrg 
    361      1.1  mrg (define_insn "*cbranchqi4_virt"
    362      1.1  mrg   [(set (pc) (if_then_else
    363  1.1.1.2  mrg 	      (match_operator 0 "rl78_cmp_operator_real"
    364  1.1.1.2  mrg 			      [(match_operand:QI 1 "rl78_general_operand" "vim")
    365      1.1  mrg 			       (match_operand:QI 2 "rl78_general_operand" "vim")])
    366      1.1  mrg               (label_ref (match_operand 3 "" ""))
    367      1.1  mrg 	      (pc)))]
    368  1.1.1.2  mrg   "rl78_virt_insns_ok ()"
    369  1.1.1.2  mrg   "v.cmp\t%1, %2\\n\tv.b%C0\t%3"
    370  1.1.1.2  mrg   [(set_attr "valloc" "cmp")]
    371  1.1.1.2  mrg   )
    372  1.1.1.2  mrg 
    373  1.1.1.2  mrg (define_insn "*cbranchhi4_virt_signed"
    374  1.1.1.2  mrg   [(set (pc) (if_then_else
    375  1.1.1.2  mrg 	      (match_operator 0 "rl78_cmp_operator_signed"
    376  1.1.1.2  mrg 			      [(match_operand:HI 1 "general_operand" "vim")
    377  1.1.1.2  mrg 			       (match_operand:HI 2 "nonmemory_operand" "vi")])
    378  1.1.1.2  mrg               (label_ref (match_operand 3 "" ""))
    379  1.1.1.2  mrg 	      (pc)))]
    380  1.1.1.2  mrg   "rl78_virt_insns_ok ()"
    381      1.1  mrg   "v.cmpw\t%1, %2\\n\tv.b%C0\t%3"
    382      1.1  mrg   [(set_attr "valloc" "cmp")]
    383      1.1  mrg   )
    384      1.1  mrg 
    385      1.1  mrg (define_insn "*cbranchhi4_virt"
    386      1.1  mrg   [(set (pc) (if_then_else
    387  1.1.1.2  mrg 	      (match_operator 0 "rl78_cmp_operator_real"
    388  1.1.1.2  mrg 			      [(match_operand:HI 1 "rl78_general_operand" "vim")
    389      1.1  mrg 			       (match_operand:HI 2 "rl78_general_operand" "vim")])
    390      1.1  mrg               (label_ref (match_operand 3 "" ""))
    391      1.1  mrg 	      (pc)))]
    392  1.1.1.2  mrg   "rl78_virt_insns_ok ()"
    393      1.1  mrg   "v.cmpw\t%1, %2\\n\tv.b%C0\t%3"
    394      1.1  mrg   [(set_attr "valloc" "cmp")]
    395      1.1  mrg   )
    396  1.1.1.2  mrg 
    397  1.1.1.2  mrg (define_insn "*cbranchsi4_virt"
    398  1.1.1.2  mrg   [(set (pc) (if_then_else
    399  1.1.1.2  mrg 	      (match_operator 0 "rl78_cmp_operator"
    400  1.1.1.2  mrg 			      [(match_operand:SI 1 "general_operand" "vim")
    401  1.1.1.2  mrg 			       (match_operand:SI 2 "nonmemory_operand" "vi")])
    402  1.1.1.2  mrg               (label_ref (match_operand 3 "" ""))
    403  1.1.1.2  mrg 	      (pc)))
    404  1.1.1.2  mrg    (clobber (reg:HI AX_REG))
    405  1.1.1.2  mrg    ]
    406  1.1.1.2  mrg   "rl78_virt_insns_ok ()"
    407  1.1.1.2  mrg   "v.cmpd\t%1, %2\\n\tv.b%C0\t%3"
    408  1.1.1.2  mrg   [(set_attr "valloc" "macax")]
    409  1.1.1.2  mrg   )
    410      1.1  mrg 
    411      1.1  mrg ;;---------- Peepholes ------------------------
    412      1.1  mrg 
    413      1.1  mrg (define_peephole2
    414      1.1  mrg   [(set (match_operand:QI 0 "" "")
    415      1.1  mrg 	(match_operand:QI 1 "" ""))
    416      1.1  mrg    (set (match_operand:QI 2 "" "")
    417      1.1  mrg 	(match_operand:QI 3 "" ""))]
    418      1.1  mrg   "rl78_peep_movhi_p (operands)"
    419      1.1  mrg   [(set (match_dup 4)
    420      1.1  mrg 	(match_dup 5))]
    421      1.1  mrg   "rl78_setup_peep_movhi (operands);"
    422      1.1  mrg   )
    423      1.1  mrg 
    424      1.1  mrg (define_peephole2
    425      1.1  mrg   [(set (reg:QI A_REG)
    426      1.1  mrg 	(match_operand:QI 1 "" ""))
    427      1.1  mrg    (set (match_operand:QI 0 "" "")
    428      1.1  mrg 	(reg:QI A_REG))
    429      1.1  mrg    (set (reg:QI A_REG)
    430      1.1  mrg 	(match_operand:QI 3 "" ""))
    431      1.1  mrg    (set (match_operand:QI 2 "" "")
    432      1.1  mrg 	(reg:QI A_REG))
    433      1.1  mrg    ]
    434      1.1  mrg   "rl78_peep_movhi_p (operands)"
    435      1.1  mrg   [(set (reg:HI AX_REG)
    436      1.1  mrg 	(match_dup 5))
    437      1.1  mrg    (set (match_dup 4)
    438      1.1  mrg 	(reg:HI AX_REG))
    439      1.1  mrg    ]
    440      1.1  mrg   "rl78_setup_peep_movhi (operands);"
    441  1.1.1.2  mrg   )
    442  1.1.1.2  mrg 
    443  1.1.1.2  mrg (define_insn "*negandhi3_virt"
    444  1.1.1.2  mrg   [(set (match_operand:HI                 0 "register_operand" "=v")
    445  1.1.1.2  mrg 	(and:HI (neg:HI (match_operand:HI 1 "register_operand"  "0"))
    446  1.1.1.2  mrg  		(match_operand:HI         2 "immediate_operand" "n")))
    447  1.1.1.2  mrg    ]
    448  1.1.1.2  mrg   "rl78_virt_insns_ok ()"
    449  1.1.1.2  mrg   "v.nand\t%0, %1, %2"
    450               )
    451