home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gcc-2.6.0-src.lha / GNU / src / amiga / gcc-2.6.0 / config / clipper / clipper.md < prev    next >
Encoding:
Text File  |  1994-04-10  |  34.0 KB  |  1,379 lines

  1. ;;- Machine description for GNU compiler, Clipper Version
  2. ;;   Copyright (C) 1987, 1988, 1991, 1993, 1994 Free Software Foundation, Inc.
  3. ;; Contributed by Holger Teutsch (holger@hotbso.rhein-main.de)
  4.  
  5. ;; This file is part of GNU CC.
  6.  
  7. ;; GNU CC is free software; you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation; either version 2, or (at your option)
  10. ;; any later version.
  11.  
  12. ;; GNU CC is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ;; GNU General Public License for more details.
  16.  
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU CC; see the file COPYING.  If not, write to
  19. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  
  22. ;;- Instruction patterns.  When multiple patterns apply,
  23. ;;- the first one in the file is chosen.
  24. ;;-
  25. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  26. ;;-
  27. ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
  28. ;;- updates for most instructions.
  29.  
  30. ;;
  31. ;; define attributes
  32. ;;
  33. ;; instruction type
  34. ;;
  35. ;; unknown is temporary in order to generate 'cc clobber' until attribute
  36. ;; assignment is consistent
  37. ;;
  38. (define_attr "type" "load,store,arith,fp,branch,unknown"
  39.  (const_string "unknown"))
  40.  
  41. ;; condition code setting
  42. ;;
  43. ;; clobber    destroyed
  44. ;; unchanged
  45. ;; set1        set cc_status.value1, e.g. sub r0,r1
  46. ;; set2        set value1 and value2, e.g. mov r0,r1
  47. ;; change0    may be side effect, i.e. load mem,r0
  48. ;;
  49. ;; note: loadi and loadq are 'arith' instructions that set the condition codes
  50. ;;       mul,div,mod do NOT set the condition codes
  51. ;;
  52. (define_attr "cc" "clobber,unchanged,set1,set2,change0"
  53.  (cond [(eq_attr "type" "load")    (const_string "change0")
  54.     (eq_attr "type" "store,branch") (const_string "unchanged")
  55.     (eq_attr "type" "arith") (if_then_else (match_operand:SI 0 "" "")
  56.                   (const_string "set1")
  57.                   (const_string "clobber"))
  58.     ]
  59.   (const_string "clobber")))
  60.  
  61. ;;
  62. ;; clipper seems to be a tradional risc processor
  63. ;; we define a functional unit 'memory'
  64. ;;
  65. (define_function_unit "memory" 1 1 (eq_attr "type" "load") 4 0)     
  66.  
  67.  
  68. ;; We don't want to allow a constant operand for test insns because
  69. ;; (set (cc0) (const_int foo)) has no mode information.  Such insns will
  70. ;; be folded while optimizing anyway.
  71.  
  72. (define_insn "tstsi"
  73.   [(set (cc0)
  74.     (match_operand:SI 0 "int_reg_operand" "r"))]
  75.   ""
  76.   "cmpq   $0,%0")
  77.  
  78. (define_insn "cmpsi"
  79.   [(set (cc0)
  80.     (compare (match_operand:SI 0 "nonimmediate_operand" "r,r,n")
  81.          (match_operand:SI 1 "nonmemory_operand" "r,n,r")))]
  82.   ""
  83.   "*
  84. {
  85.   int val;
  86.  
  87.   if (which_alternative == 0)
  88.     return \"cmpw   %1,%0\";
  89.  
  90.   if (which_alternative == 1)
  91.     {
  92.       val = INTVAL (operands[1]);
  93.       if (0 <= val && val < 16)
  94.     return \"cmpq   %1,%0\";
  95.       return \"cmpi   %1,%0\";
  96.     }
  97.  
  98.   cc_status.flags |= CC_REVERSED;    /* immediate must be first */
  99.  
  100.   val = INTVAL (operands[0]);
  101.  
  102.   if (0 <= val && val < 16)
  103.     return \"cmpq   %0,%1\";
  104.  
  105.   return \"cmpi   %0,%1\";
  106. }")
  107.  
  108. (define_insn "cmpdf"
  109.   [(set (cc0)
  110.     (compare (match_operand:DF 0 "fp_reg_operand" "f")
  111.          (match_operand:DF 1 "fp_reg_operand" "f")))]
  112.   ""
  113.   "cmpd   %1,%0")
  114.  
  115. (define_insn "cmpsf"
  116.   [(set (cc0)
  117.     (compare (match_operand:SF 0 "fp_reg_operand" "f")
  118.          (match_operand:SF 1 "fp_reg_operand" "f")))]
  119.   ""
  120.   "cmps   %1,%0")
  121.  
  122.  
  123. ;;
  124. ;; double and single float move
  125. ;;
  126. (define_expand "movdf"
  127.   [(set (match_operand:DF 0 "general_operand" "")
  128.     (match_operand:DF 1 "general_operand" ""))]
  129.   ""
  130.   "
  131. {
  132.   if (GET_CODE (operands[0]) == MEM)
  133.     {
  134.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  135.     operands[1] = force_reg (DFmode,
  136.                  force_const_mem (DFmode, operands[1]));
  137.       else if (GET_CODE (operands[1]) != REG)
  138.     operands[1] = force_reg (DFmode, operands[1]);
  139.     }
  140.  
  141.   else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  142.     operands[1] = force_const_mem (DFmode, operands[1]);
  143. }")
  144.  
  145. ;;
  146. ;; provide two patterns with different predicates as we don't want combine
  147. ;; to recombine a mem -> mem move
  148. ;; 
  149. (define_insn ""
  150.   [(set (match_operand:DF 0 "register_operand" "=*rf")
  151.     (match_operand:DF 1 "nonimmediate_operand" "*rfo"))]
  152.   ""
  153.   "*
  154. {
  155. #define FP_REG_P(X) (GET_CODE (X) == REG && REGNO (X) >= 16)
  156.  
  157.   if (FP_REG_P (operands[0]))
  158.     {
  159.       if (FP_REG_P (operands[1]))    /* f -> f */
  160.     return \"movd   %1,%0\";
  161.  
  162.       if (GET_CODE (operands[1]) == REG) /* r -> f */
  163.     return \"movld  %1,%0\";
  164.  
  165.       return \"loadd  %1,%0\";        /* m -> f */
  166.     }
  167.  
  168.   if (FP_REG_P (operands[1]))
  169.     {
  170.       if (GET_CODE (operands[0]) == REG) /* f -> r */
  171.     return \"movdl  %1,%0\";
  172.  
  173.       abort ();
  174.     }
  175.  
  176.   if (GET_CODE (operands[1]) == MEM)    /* m -> r */
  177.     {
  178.       rtx xops[4];
  179.       xops[0] = operands[0];
  180.       xops[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  181.       xops[2] = operands[1];
  182.       xops[3] = adj_offsettable_operand (operands[1], 4);
  183.       output_asm_insn (\"loadw  %2,%0\;loadw  %3,%1\", xops);
  184.       return \"\";
  185.     }
  186.  
  187.   if (GET_CODE (operands[1]) == REG)    /* r -> r */
  188.     {
  189.       rtx xops[4];
  190.       xops[0] = operands[0];
  191.       xops[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  192.       xops[2] = operands[1];
  193.       xops[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  194.       output_asm_insn (\"movw   %2,%0\;movw   %3,%1\", xops);
  195.       return \"\";
  196.     }
  197.  
  198.   abort ();
  199. #undef FP_REG_P
  200. }")
  201.  
  202.  
  203. (define_insn ""
  204.   [(set (match_operand:DF 0 "memory_operand" "=o,m")
  205.     (match_operand:DF 1 "register_operand" "*rf,f"))]
  206.   ""
  207.   "*
  208. {
  209.   rtx xops[4];
  210.  
  211.   if (REGNO (operands[1]) >= 16)    /* f -> m */
  212.     return \"stord  %1,%0\";
  213.  
  214.   xops[0] = operands[0];        /* r -> o */
  215.   xops[1] = adj_offsettable_operand (operands[0], 4);
  216.   xops[2] = operands[1];
  217.   xops[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  218.   output_asm_insn (\"storw  %2,%0\;storw  %3,%1\", xops);
  219.   return \"\";
  220. }"
  221. [(set_attr "type" "store,store")
  222.  (set_attr "cc" "clobber,unchanged")])
  223.  
  224.  
  225. (define_expand "movsf"
  226.   [(set (match_operand:SF 0 "general_operand" "")
  227.     (match_operand:SF 1 "general_operand" ""))]
  228.   ""
  229.   "
  230. {
  231.   if (GET_CODE (operands[0]) == MEM)
  232.     {
  233.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  234.     operands[1] = force_reg (SFmode,
  235.                  force_const_mem (SFmode, operands[1]));
  236.       else if (GET_CODE (operands[1]) != REG)
  237.     operands[1] = force_reg (SFmode, operands[1]);
  238.     }
  239.  
  240.   else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  241.     operands[1] = force_const_mem (SFmode, operands[1]);
  242. }")
  243.  
  244. ;;
  245. ;; provide two patterns with different predicates as we don't want combine
  246. ;; to recombine a mem -> mem move
  247. ;; 
  248. (define_insn ""
  249.   [(set (match_operand:SF 0 "register_operand" "=*rf")
  250.     (match_operand:SF 1 "nonimmediate_operand" "*rfm"))]
  251.   ""
  252.   "*
  253. {
  254. #define FP_REG_P(X) (GET_CODE (X) == REG && REGNO (X) >= 16)
  255.  
  256.   if (FP_REG_P (operands[0]))
  257.     {
  258.       if (FP_REG_P (operands[1]))    /* f -> f */
  259.     return \"movs   %1,%0\";
  260.       if (GET_CODE (operands[1]) == REG) /* r -> f */
  261.     return
  262.       \"subq   $8,sp\;storw  %1,(sp)\;loads  (sp),%0\;addq   $8,sp\";
  263.       return \"loads  %1,%0\";        /* m -> f */
  264.     }
  265.  
  266.   if (FP_REG_P (operands[1]))
  267.     {
  268.       if (GET_CODE (operands[0]) == REG) /* f -> r */
  269.     return
  270.       \"subq   $8,sp\;stors  %1,(sp)\;loadw  (sp),%0\;addq   $8,sp\";
  271.       abort ();
  272.     }
  273.  
  274.   if (GET_CODE (operands[1]) == MEM)    /* m -> r */
  275.     return \"loadw   %1,%0\";
  276.  
  277.   if (GET_CODE (operands[1]) == REG)    /* r -> r */
  278.     return \"movw    %1,%0\";
  279.  
  280.   abort ();
  281. #undef FP_REG_P
  282. }")
  283.  
  284. (define_insn ""
  285.   [(set (match_operand:SF 0 "memory_operand" "=m")
  286.     (match_operand:SF 1 "register_operand" "*rf"))]
  287.   ""
  288.   "*
  289. {
  290.   if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) >= 16)
  291.     return \"stors  %1,%0\";        /* f-> m */
  292.  
  293.   return \"storw   %1,%0\";        /* r -> m */
  294. }"
  295. [(set_attr "type" "store")])
  296.  
  297.  
  298. (define_expand "movdi"
  299.   [(set (match_operand:DI 0 "general_operand" "")
  300.     (match_operand:DI 1 "general_operand" ""))]
  301.   ""
  302.   "
  303. {
  304.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) != REG)
  305.     operands[1] = force_reg (DImode, operands[1]);
  306. }")
  307.  
  308. ;; If an operand is a MEM but not offsetable, we can't load it into
  309. ;; a register, so we must force the third alternative to be the one
  310. ;; reloaded.  Hence we show the first as more expensive.
  311. (define_insn ""
  312.   [(set (match_operand:DI 0 "register_operand" "=?r,r,r")
  313.     (match_operand:DI 1 "general_operand"   "r,n,o"))]
  314.   ""
  315.   "*
  316. {
  317.   rtx xoperands[2],yoperands[2];
  318.  
  319.   xoperands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  320.  
  321.   if (which_alternative == 0)        /* r -> r */
  322.     {
  323.       output_asm_insn (\"movw   %1,%0\", operands);
  324.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  325.       output_asm_insn (\"movw   %1,%0\", xoperands);
  326.       return \"\";
  327.     }
  328.  
  329.   if (which_alternative == 1)        /* n -> r */
  330.     {
  331.       if (GET_CODE (operands[1]) == CONST_INT)
  332.     {
  333.       output_asm_insn (\"loadi   %1,%0\", operands);
  334.       output_asm_insn (\"loadq   $0,%0\", xoperands);
  335.       return \"\";
  336.     }
  337.  
  338.       if (GET_CODE (operands[1]) != CONST_DOUBLE)
  339.     abort ();
  340.  
  341.       yoperands[0] = operands[0];
  342.       yoperands[1] = gen_rtx (CONST_INT, VOIDmode,
  343.                   CONST_DOUBLE_LOW (operands[1]));
  344.       output_asm_insn (\"loadi  %1,%0\", yoperands);
  345.  
  346.       xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
  347.                   CONST_DOUBLE_HIGH (operands[1]));
  348.       output_asm_insn (\"loadi  %1,%0\", xoperands);
  349.       return \"\";
  350.     }
  351.                     /* m -> r */
  352.   output_asm_insn (\"loadw  %1,%0\", operands);
  353.   xoperands[1] = adj_offsettable_operand (operands[1], 4);
  354.   output_asm_insn (\"loadw  %1,%0\", xoperands);
  355.   return \"\";
  356. }" 
  357. [(set_attr "type" "arith,arith,load")
  358.   (set_attr "cc" "clobber,clobber,clobber")])
  359.  
  360. (define_insn ""
  361.   [(set (match_operand:DI 0 "memory_operand" "=o")
  362.     (match_operand:DI 1 "register_operand" "r"))]
  363.   ""
  364.   "*
  365. {
  366.   rtx xops[4];
  367.   xops[0] = operands[0];
  368.   xops[1] = adj_offsettable_operand (operands[0], 4);
  369.   xops[2] = operands[1];
  370.   xops[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  371.   output_asm_insn (\"storw  %2,%0\;storw  %3,%1\", xops);
  372.   return \"\";
  373. }"
  374. [(set_attr "type" "store")
  375.  (set_attr "cc" "clobber")])
  376.  
  377. (define_expand "movsi"
  378.   [(set (match_operand:SI 0 "general_operand" "")
  379.     (match_operand:SI 1 "general_operand" ""))]
  380.   ""
  381.   "
  382. {
  383.   if (GET_CODE (operands[0]) == MEM &&
  384.       GET_CODE (operands[1]) != REG)
  385.     operands[1] = force_reg (SImode, operands[1]);
  386. }")
  387.  
  388. ;; provide 2 patterns with different predicates as 'general_operand' in both
  389. ;; positions results in a 'mem -> mem' move from combine that must be reloaded 
  390. ;;
  391.  
  392. (define_insn ""
  393.   [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
  394.     (match_operand:SI 1 "general_operand"   "r,m,n,i"))]
  395.   ""
  396.   "*
  397. {
  398.   int val;
  399.  
  400.   if (which_alternative == 0)
  401.     return \"movw   %1,%0\";        /* reg -> reg */
  402.  
  403.   if (which_alternative == 1)
  404.     return \"loadw  %1,%0\";        /* mem -> reg */
  405.  
  406.   if (which_alternative == 2)
  407.     {
  408.       val = INTVAL (operands[1]);    /* known const ->reg */
  409.  
  410.       if (val == -1)
  411.     return \"notq   $0,%0\";
  412.  
  413.       if (val < 0 || val >= 16)
  414.     return \"loadi  %1,%0\";
  415.  
  416.       return \"loadq  %1,%0\";
  417.     }
  418.  
  419.   if (which_alternative == 3)        /* unknown const */
  420.     return \"loada  %a1,%0\";
  421. }"
  422. [(set_attr "type" "arith,load,arith,load")
  423.  (set_attr "cc" "set2,change0,set1,change0")])
  424.  
  425.  
  426. (define_insn ""
  427.   [(set (match_operand:SI 0 "memory_operand" "=m")
  428.     (match_operand:SI 1 "int_reg_operand" "r"))]
  429.   ""
  430.   "storw  %1,%0"
  431. [(set_attr "type" "store")])
  432.  
  433. ;; movhi
  434. ;;
  435. ;; loadh  mem to reg
  436. ;; storh  reg to mem
  437. ;;
  438. ;;
  439. (define_expand "movhi"
  440.   [(set (match_operand:HI 0 "general_operand" "")
  441.     (match_operand:HI 1 "general_operand" ""))]
  442.   ""
  443.   "
  444. {
  445.   if (GET_CODE (operands[0]) == MEM
  446.       && ! register_operand (operands[1], HImode))
  447.     operands[1] = force_reg (HImode, operands[1]);
  448. }")
  449.  
  450.  
  451. (define_insn ""
  452.   [(set (match_operand:HI 0 "register_operand" "=r,r,r")
  453.     (match_operand:HI 1 "general_operand"   "r,m,n"))]
  454.   ""
  455.   "@
  456.    movw   %1,%0
  457.    loadh  %1,%0
  458.    loadi  %1,%0"
  459. [(set_attr "type" "arith,load,arith")])
  460.  
  461. (define_insn ""
  462.   [(set (match_operand:HI 0 "memory_operand"  "=m")
  463.     (match_operand:HI 1 "register_operand" "r"))]
  464.   ""
  465.   "storh  %1,%0"
  466.  [(set_attr "type" "store")])
  467.  
  468. ;; movqi
  469. ;;
  470. ;; loadb  mem to reg
  471. ;; storb  reg to mem
  472. ;;
  473. (define_expand "movqi"
  474.   [(set (match_operand:QI 0 "general_operand" "")
  475.     (match_operand:QI 1 "general_operand" ""))]
  476.   ""
  477.   "
  478. {
  479.   if (GET_CODE (operands[0]) == MEM && 
  480.       ! register_operand (operands[1], QImode))
  481.     operands[1] = force_reg (QImode, operands[1]);
  482. }")
  483.  
  484.  
  485. (define_insn ""
  486.   [(set (match_operand:QI 0 "register_operand" "=r,r,r")
  487.     (match_operand:QI 1 "general_operand"   "r,m,n"))]
  488.   ""
  489.   "@
  490.    movw   %1,%0
  491.    loadb  %1,%0
  492.    loadi  %1,%0"
  493. [(set_attr "type" "arith,load,arith")])
  494.  
  495. (define_insn ""
  496.   [(set (match_operand:QI 0 "memory_operand" "=m")
  497.     (match_operand:QI 1 "register_operand" "r"))]
  498.   ""
  499.   "storb  %1,%0"
  500. [(set_attr "type" "store")])
  501.  
  502.  
  503. ;;
  504. ;; block move
  505. ;;
  506. (define_expand "movstrsi"
  507.   [(parallel
  508.     [(set (match_operand:BLK 0 "memory_operand" "")
  509.           (match_operand:BLK 1 "memory_operand" ""))
  510.      (use (match_operand:SI 2 "general_operand" ""))
  511.      (use (match_operand:SI 3 "const_int_operand" ""))
  512.      (clobber (match_scratch:SI 4 ""))
  513.      (clobber (match_scratch:SI 5 ""))
  514.      (clobber (match_dup 6))
  515.      (clobber (match_dup 7))])]
  516.   ""
  517.   "
  518. {
  519.   rtx addr0, addr1;
  520.  
  521.   addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
  522.   addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
  523.  
  524.   operands[6] = addr0;
  525.   operands[7] = addr1;
  526.  
  527.   operands[0] = gen_rtx (MEM, BLKmode, addr0);
  528.   operands[1] = gen_rtx (MEM, BLKmode, addr1);
  529.  
  530.   if (GET_CODE (operands[2]) != CONST_INT)
  531.     operands[2] = force_reg (SImode, operands[2]);
  532. }")
  533.  
  534. ;;
  535. ;; there is a problem with this insn in gcc-2.2.3
  536. ;; (clobber (match_dup 2)) does not prevent use of this operand later
  537. ;; we always use a scratch register and leave operand 2 unchanged
  538. ;;
  539. (define_insn ""
  540.   [(set (mem:BLK (match_operand:SI 0 "register_operand" "r"))
  541.     (mem:BLK (match_operand:SI 1 "register_operand" "r")))
  542.    (use (match_operand:SI 2 "nonmemory_operand" "rn"))
  543.    (use (match_operand:SI 3 "const_int_operand" "n"))
  544.    (clobber (match_scratch:SI 4 "=r"))
  545.    (clobber (match_scratch:SI 5 "=r"))
  546.    (clobber (match_dup 0))
  547.    (clobber (match_dup 1))]
  548.   ""
  549.   "*
  550. {
  551.   extern void clipper_movstr ();
  552.   clipper_movstr (operands);
  553.   return \"\";
  554. }"
  555. [(set_attr "cc" "clobber")])
  556.  
  557.  
  558.  
  559. ;; Extension and truncation insns.
  560. (define_insn "extendhisi2"
  561.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
  562.     (sign_extend:SI (match_operand:HI 1 "general_operand" "0,m")))]
  563.   ""
  564.   "@
  565.    andi   $65535,%0\;xori   $32768,%0\;subi   $32768,%0
  566.    loadh  %1,%0"
  567. [(set_attr "type" "arith,load")])
  568.  
  569.  
  570. (define_insn "extendqihi2"
  571.   [(set (match_operand:HI 0 "int_reg_operand" "=r,r")
  572.     (sign_extend:HI (match_operand:QI 1 "general_operand" "0,m")))]
  573.   ""
  574.   "@
  575.    andi   $255,%0\;xori   $128,%0\;subi   $128,%0
  576.    loadb  %1,%0"
  577. [(set_attr "type" "arith,load")
  578.  (set_attr "cc" "set1,change0")])
  579.  
  580.  
  581. (define_insn "extendqisi2"
  582.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
  583.     (sign_extend:SI (match_operand:QI 1 "general_operand" "0,m")))]
  584.   ""
  585.   "@
  586.    andi   $255,%0\;xori   $128,%0\;subi   $128,%0
  587.    loadb  %1,%0"
  588. [(set_attr "type" "arith,load")])
  589.  
  590.  
  591. (define_insn "extendsfdf2"
  592.   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
  593.     (float_extend:DF (match_operand:SF 1 "fp_reg_operand" "f")))]
  594.   ""
  595.   "cnvsd  %1,%0")
  596.  
  597. (define_insn "truncdfsf2"
  598.   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
  599.     (float_truncate:SF (match_operand:DF 1 "fp_reg_operand" "f")))]
  600.   ""
  601.   "cnvds  %1,%0")
  602.  
  603. (define_insn "zero_extendhisi2"
  604.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
  605.     (zero_extend:SI (match_operand:HI 1 "general_operand" "0,m")))]
  606.   ""
  607.   "@
  608.    andi   $65535,%0
  609.    loadhu %1,%0"
  610. [(set_attr "type" "arith,load")])
  611.  
  612.  
  613. (define_insn "zero_extendqihi2"
  614.   [(set (match_operand:HI 0 "int_reg_operand" "=r,r")
  615.     (zero_extend:HI (match_operand:QI 1 "general_operand" "0,m")))]
  616.   ""
  617.   "@
  618.    andi   $255,%0
  619.    loadbu %1,%0"
  620. [(set_attr "type" "arith,load")
  621.  (set_attr "cc" "clobber,clobber")])
  622.  
  623.  
  624. (define_insn "zero_extendqisi2"
  625.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
  626.     (zero_extend:SI (match_operand:QI 1 "general_operand" "0,m")))]
  627.   ""
  628.   "@
  629.    andi   $255,%0
  630.    loadbu %1,%0"
  631. [(set_attr "type" "arith,load")])
  632.  
  633.  
  634.  
  635. ;; Fix-to-float conversion insns.
  636.  
  637. (define_insn "floatsisf2"
  638.   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
  639.     (float:SF (match_operand:SI 1 "int_reg_operand" "r")))]
  640.   ""
  641.   "cnvws  %1,%0")
  642.  
  643. (define_insn "floatsidf2"
  644.   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
  645.     (float:DF (match_operand:SI 1 "int_reg_operand" "r")))]
  646.   ""
  647.   "cnvwd  %1,%0")
  648.  
  649.  
  650. ;; Float-to-fix conversion insns.
  651.  
  652. (define_insn "fix_truncsfsi2"
  653.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  654.     (fix:SI (fix:SF (match_operand:SF 1 "fp_reg_operand" "f"))))]
  655.   ""
  656.   "cnvtsw %1,%0")
  657.  
  658. (define_insn "fix_truncdfsi2"
  659.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  660.     (fix:SI (fix:DF (match_operand:DF 1 "fp_reg_operand" "f"))))]
  661.   ""
  662.   "cnvtdw %1,%0")
  663.  
  664. ;;- All kinds of add instructions.
  665.  
  666. (define_insn "adddf3"
  667.   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
  668.     (plus:DF (match_operand:DF 1 "fp_reg_operand" "0")
  669.          (match_operand:DF 2 "fp_reg_operand" "f")))]
  670.   ""
  671.   "addd   %2,%0"
  672.  [(set_attr "type" "fp")])
  673.  
  674.  
  675. (define_insn "addsf3"
  676.   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
  677.     (plus:SF (match_operand:SF 1 "fp_reg_operand" "0")
  678.          (match_operand:SF 2 "fp_reg_operand" "f")))]
  679.   ""
  680.   "adds   %2,%0"
  681.  [(set_attr "type" "fp")])
  682.  
  683. (define_insn "adddi3"
  684.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  685.     (plus:DI (match_operand:DI 1 "int_reg_operand" "%0")
  686.          (match_operand:DI 2 "int_reg_operand" "r")))]
  687.   ""
  688.   "*
  689. {
  690.   rtx xoperands[4];
  691.  
  692.   xoperands[0] = operands[0];
  693.   xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  694.   xoperands[2] = operands[2];
  695.   xoperands[3] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
  696.   output_asm_insn (\"addw   %2,%0\;addwc  %3,%1\", xoperands);
  697.   return \"\";
  698. }"
  699. [(set_attr "type" "arith")
  700.  (set_attr "cc" "clobber")])
  701.  
  702. (define_insn "addsi3"
  703.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r,r")
  704.     (plus:SI (match_operand:SI 1 "int_reg_operand" "%0,r,r")
  705.          (match_operand:SI 2 "nonmemory_operand" "rn,0,rn")))]
  706.   ""
  707.   "*
  708. {
  709.   if (which_alternative == 2)        /* 3 address version */
  710.     {
  711.       if (GET_CODE (operands[2]) == CONST_INT)
  712.     return \"loada  %a2(%1),%0\";
  713.       return \"loada  [%2](%1),%0\";
  714.     }
  715.                     /* 2 address version */
  716.   if (GET_CODE (operands[2]) == CONST_INT)
  717.     {
  718.       int val = INTVAL (operands[2]);
  719.  
  720.       if (val >= 16 || val == 0x80000000)
  721.     return \"addi   %2,%0\";
  722.  
  723.       if (val < 0)            /* change to sub */
  724.     {
  725.       rtx xops[2];
  726.  
  727.       val = -val;
  728.  
  729.       xops[0] = operands[0];
  730.       xops[1] = gen_rtx (CONST_INT, VOIDmode, val);
  731.  
  732.       if (val >= 16)
  733.         output_asm_insn (\"subi   %1,%0\", xops);
  734.       else
  735.         output_asm_insn (\"subq   %1,%0\", xops);
  736.  
  737.       return \"\";
  738.     }
  739.  
  740.       return \"addq   %2,%0\";
  741.     }
  742.  
  743.   if (which_alternative == 0)
  744.     return \"addw   %2,%0\";
  745.  
  746.   return \"addw   %1,%0\";
  747. }"
  748. [(set_attr "type" "arith,arith,arith")
  749.  (set_attr "cc" "set1,set1,change0")])
  750.  
  751.  
  752. ;;- All kinds of subtract instructions.
  753.  
  754. (define_insn "subdi3"
  755.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  756.     (minus:DI (match_operand:DI 1 "int_reg_operand" "%0")
  757.           (match_operand:DI 2 "int_reg_operand" "r")))]
  758.   ""
  759.   "*
  760. {
  761.   rtx xoperands[4];
  762.  
  763.   xoperands[0] = operands[0];
  764.   xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  765.   xoperands[2] = operands[2];
  766.   xoperands[3] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
  767.   output_asm_insn (\"subw   %2,%0\;subwc  %3,%1\", xoperands);
  768.   return \"\";
  769. }"
  770. [(set_attr "type" "arith")
  771.  (set_attr "cc" "clobber")])
  772.  
  773. (define_insn "subsi3"
  774.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  775.     (minus:SI (match_operand:SI 1 "int_reg_operand" "0")
  776.           (match_operand:SI 2 "nonmemory_operand" "rn")))]
  777.   ""
  778.   "*
  779. {
  780.   if (GET_CODE (operands[2]) == CONST_INT)
  781.     {
  782.       int val = INTVAL (operands[2]);
  783.  
  784.       if (val < 0 || val >= 16)
  785.     return \"subi   %2,%0\";
  786.       else
  787.     return \"subq   %2,%0\";
  788.     }
  789.  
  790.   return \"subw   %2,%0\";
  791. }"
  792. [(set_attr "type" "arith")])
  793.  
  794. (define_insn "subdf3"
  795.   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
  796.     (minus:DF (match_operand:DF 1 "fp_reg_operand" "0")
  797.           (match_operand:DF 2 "fp_reg_operand" "f")))]
  798.   ""
  799.   "subd   %2,%0"
  800.  [(set_attr "type" "fp")])
  801.  
  802. (define_insn "subsf3"
  803.   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
  804.     (minus:SF (match_operand:SF 1 "fp_reg_operand" "0")
  805.           (match_operand:SF 2 "fp_reg_operand" "f")))]
  806.   ""
  807.   "subs   %2,%0"
  808.  [(set_attr "type" "fp")])
  809.  
  810.  
  811. ;;- Multiply instructions.
  812.  
  813. (define_insn "muldf3"
  814.   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
  815.     (mult:DF (match_operand:DF 1 "fp_reg_operand" "0")
  816.          (match_operand:DF 2 "fp_reg_operand" "f")))]
  817.   ""
  818.   "muld   %2,%0"
  819.  [(set_attr "type" "fp")])
  820.  
  821. (define_insn "mulsf3"
  822.   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
  823.     (mult:SF (match_operand:SF 1 "fp_reg_operand" "0")
  824.          (match_operand:SF 2 "fp_reg_operand" "f")))]
  825.   ""
  826.   "muls   %2,%0"
  827.  [(set_attr "type" "fp")])
  828.  
  829. (define_insn "mulsidi3"
  830.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  831.     (mult:DI (sign_extend:DI (match_operand:SI 1 "int_reg_operand" "%0"))
  832.              (sign_extend:DI (match_operand:SI 2 "int_reg_operand" "r"))))]
  833.   ""
  834.   "mulwx  %2,%0"
  835. [(set_attr "type" "arith")
  836.  (set_attr "cc" "clobber")])
  837.  
  838. (define_insn "umulsidi3"
  839.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  840.     (mult:DI (zero_extend:DI (match_operand:SI 1 "int_reg_operand" "%0"))
  841.              (zero_extend:DI (match_operand:SI 2 "int_reg_operand" "r"))))]
  842.   ""
  843.   "mulwux %2,%0"
  844. [(set_attr "type" "arith")
  845.  (set_attr "cc" "clobber")])
  846.  
  847. (define_insn "mulsi3"
  848.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  849.     (mult:SI (match_operand:SI 1 "int_reg_operand" "%0")
  850.              (match_operand:SI 2 "int_reg_operand" "r")))]
  851.   ""
  852.   "mulw   %2,%0"
  853.  [(set_attr "type" "arith")
  854.   (set_attr "cc" "clobber")])
  855.  
  856.  
  857. ;;- Divide and mod instructions.
  858.  
  859. (define_insn "divdf3"
  860.   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
  861.     (div:DF (match_operand:DF 1 "fp_reg_operand" "0")
  862.         (match_operand:DF 2 "fp_reg_operand" "f")))]
  863.   ""
  864.   "divd   %2,%0"
  865.  [(set_attr "type" "fp")])
  866.  
  867. (define_insn "divsf3"
  868.   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
  869.     (div:SF (match_operand:SF 1 "fp_reg_operand" "0")
  870.         (match_operand:SF 2 "fp_reg_operand" "f")))]
  871.   ""
  872.   "divs   %2,%0"
  873.  [(set_attr "type" "fp")])
  874.  
  875. (define_insn "divsi3"
  876.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  877.     (div:SI (match_operand:SI 1 "int_reg_operand" "0")
  878.         (match_operand:SI 2 "int_reg_operand" "r")))]
  879.   ""
  880.   "divw   %2,%0"
  881.  [(set_attr "type" "arith")
  882.   (set_attr "cc" "clobber")])
  883.  
  884. (define_insn "udivsi3"
  885.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  886.     (udiv:SI (match_operand:SI 1 "int_reg_operand" "0")
  887.              (match_operand:SI 2 "int_reg_operand" "r")))]
  888.   ""
  889.   "divwu  %2,%0"
  890.  [(set_attr "type" "arith")
  891.   (set_attr "cc" "clobber")])
  892.  
  893.  
  894. (define_insn "modsi3"
  895.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  896.     (mod:SI (match_operand:SI 1 "int_reg_operand" "0")
  897.         (match_operand:SI 2 "int_reg_operand" "r")))]
  898.   ""
  899.   "modw   %2,%0"
  900.  [(set_attr "type" "arith")
  901.   (set_attr "cc" "clobber")])
  902.  
  903. (define_insn "umodsi3"
  904.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  905.     (umod:SI (match_operand:SI 1 "int_reg_operand" "0")
  906.              (match_operand:SI 2 "int_reg_operand" "r")))]
  907.   ""
  908.   "modwu  %2,%0"
  909.  [(set_attr "type" "arith")
  910.   (set_attr "cc" "clobber")])
  911.  
  912. ;;
  913. ;; bit and/or instructions
  914. ;;
  915. (define_insn "andsi3"
  916.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
  917.         (and:SI (match_operand:SI 1 "int_reg_operand" "%0,0")
  918.         (match_operand:SI 2 "nonmemory_operand" "r,n")))]
  919.   ""
  920.   "@
  921.    andw   %2,%0
  922.    andi   %2,%0"
  923.  [(set_attr "type" "arith")])
  924.  
  925. (define_insn "iorsi3"
  926.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
  927.     (ior:SI (match_operand:SI 1 "int_reg_operand" "%0,0")
  928.             (match_operand:SI 2 "nonmemory_operand" "r,n")))]
  929.   ""
  930.   "@
  931.    orw    %2,%0
  932.    ori    %2,%0"
  933.  [(set_attr "type" "arith")])
  934.  
  935. (define_insn "xorsi3"
  936.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
  937.     (xor:SI (match_operand:SI 1 "int_reg_operand" "%0,0")
  938.         (match_operand:SI 2 "nonmemory_operand" "r,n")))]
  939.   ""
  940.   "@
  941.    xorw   %2,%0
  942.    xori   %2,%0"
  943.  [(set_attr "type" "arith")])
  944.  
  945. (define_insn "negdf2"
  946.   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
  947.     (neg:DF (match_operand:DF 1 "fp_reg_operand" "f")))]
  948.   ""
  949.   "negd   %1,%0"
  950.  [(set_attr "type" "fp")])
  951.  
  952. (define_insn "negsf2"
  953.   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
  954.     (neg:SF (match_operand:SF 1 "fp_reg_operand" "f")))]
  955.   ""
  956.   "negs   %1,%0"
  957.  [(set_attr "type" "fp")])
  958.  
  959. (define_insn "negsi2"
  960.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  961.     (neg:SI (match_operand:SI 1 "int_reg_operand" "r")))]
  962.   ""
  963.   "negw   %1,%0"
  964.  [(set_attr "type" "arith")])
  965.  
  966.  
  967. (define_insn "one_cmplsi2"
  968.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  969.     (not:SI (match_operand:SI 1 "int_reg_operand" "r")))]
  970.   ""
  971.   "notw   %1,%0"
  972.  [(set_attr "type" "arith")])
  973.  
  974.  
  975.  
  976. ;; Right shift on the clipper works by negating the shift count,
  977. ;; then emitting a right shift with the shift count negated.  This means
  978. ;; that all actual shift counts in the RTL will be positive.
  979.  
  980. (define_expand "ashrdi3"
  981.   [(set (match_operand:DI 0 "int_reg_operand" "")
  982.     (ashiftrt:DI (match_operand:DI 1 "int_reg_operand" "")
  983.                  (match_operand:SI 2 "nonmemory_operand" "")))]
  984.   ""
  985.   "
  986. {
  987.   if (GET_CODE (operands[2]) != CONST_INT)
  988.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  989. }")
  990.  
  991. (define_insn ""
  992.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  993.     (ashiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
  994.              (match_operand:SI 2 "const_int_operand" "n")))]
  995.   ""
  996.   "shali  $%n2,%0"
  997.  [(set_attr "type" "arith")])
  998.  
  999. (define_insn ""
  1000.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  1001.     (ashiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
  1002.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
  1003.   ""
  1004.   "shal   %2,%0"
  1005.  [(set_attr "type" "arith")])
  1006.  
  1007. (define_expand "ashrsi3"
  1008.   [(set (match_operand:SI 0 "int_reg_operand" "")
  1009.     (ashiftrt:SI (match_operand:SI 1 "int_reg_operand" "")
  1010.                  (match_operand:SI 2 "nonmemory_operand" "")))]
  1011.   ""
  1012.   "
  1013. {
  1014.   if (GET_CODE (operands[2]) != CONST_INT)
  1015.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1016. }")
  1017.  
  1018. (define_insn ""
  1019.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  1020.     (ashiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
  1021.              (match_operand:SI 2 "const_int_operand" "n")))]
  1022.   ""
  1023.   "shai   $%n2,%0"
  1024.  [(set_attr "type" "arith")])
  1025.  
  1026. (define_insn ""
  1027.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  1028.     (ashiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
  1029.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
  1030.   ""
  1031.   "shaw   %2,%0"
  1032.  [(set_attr "type" "arith")])
  1033.  
  1034. ;;
  1035. ;; left shift
  1036. ;;
  1037.  
  1038. (define_insn "ashldi3"
  1039.   [(set (match_operand:DI 0 "int_reg_operand" "=r,r")
  1040.     (ashift:DI (match_operand:DI 1 "int_reg_operand" "0,0")
  1041.            (match_operand:SI 2 "nonmemory_operand" "r,n")))]
  1042.   ""
  1043.   "@
  1044.    shal   %2,%0
  1045.    shali  %2,%0"
  1046.  [(set_attr "type" "arith")])
  1047.  
  1048.  
  1049. (define_insn "ashlsi3"
  1050.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
  1051.     (ashift:SI (match_operand:SI 1 "int_reg_operand" "0,0")
  1052.            (match_operand:SI 2 "nonmemory_operand" "r,n")))]
  1053.   ""
  1054.   "*
  1055. {
  1056.   int val;
  1057.  
  1058.   if (which_alternative == 0)
  1059.    return \"shaw   %2,%0\";
  1060.  
  1061.   val = INTVAL (operands[2]);
  1062.  
  1063.   if (val == 2)
  1064.     return \"addw   %0,%0\;addw   %0,%0\";
  1065.  
  1066.   if (val == 1)
  1067.     return \"addw   %0,%0\";
  1068.  
  1069.   return \"shai   %2,%0\";
  1070. }"
  1071. [(set_attr "type" "arith")])
  1072.  
  1073. ;;
  1074. ;; logical shift
  1075. ;;
  1076.  
  1077. (define_expand "lshrdi3"
  1078.   [(set (match_operand:DI 0 "int_reg_operand" "")
  1079.     (lshiftrt:DI (match_operand:DI 1 "int_reg_operand" "")
  1080.                  (match_operand:SI 2 "nonmemory_operand" "")))]
  1081.   ""
  1082.   "
  1083. {
  1084.   if (GET_CODE (operands[2]) != CONST_INT)
  1085.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1086. }")
  1087.  
  1088. (define_insn ""
  1089.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  1090.     (lshiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
  1091.              (match_operand:SI 2 "const_int_operand" "n")))]
  1092.   ""
  1093.   "shlli  $%n2,%0"
  1094.  [(set_attr "type" "arith")])
  1095.  
  1096. (define_insn ""
  1097.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  1098.     (lshiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
  1099.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
  1100.   ""
  1101.   "shll   %2,%0"
  1102.  [(set_attr "type" "arith")])
  1103.  
  1104. (define_expand "lshrsi3"
  1105.   [(set (match_operand:SI 0 "int_reg_operand" "")
  1106.     (lshiftrt:SI (match_operand:SI 1 "int_reg_operand" "")
  1107.                  (match_operand:SI 2 "nonmemory_operand" "")))]
  1108.   ""
  1109.   "
  1110. {
  1111.   if (GET_CODE (operands[2]) != CONST_INT)
  1112.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1113. }")
  1114.  
  1115. (define_insn ""
  1116.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  1117.     (lshiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
  1118.              (match_operand:SI 2 "const_int_operand" "n")))]
  1119.   ""
  1120.   "shli   $%n2,%0"
  1121.  [(set_attr "type" "arith")])
  1122.  
  1123. (define_insn ""
  1124.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  1125.     (lshiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
  1126.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
  1127.   ""
  1128.   "shlw   %2,%0"
  1129.  [(set_attr "type" "arith")])
  1130.  
  1131.  
  1132. ;;
  1133. ;; rotate insn
  1134. ;;
  1135. (define_expand "rotrdi3"
  1136.   [(set (match_operand:DI 0 "int_reg_operand" "")
  1137.     (rotatert:DI (match_operand:DI 1 "int_reg_operand" "")
  1138.                  (match_operand:SI 2 "nonmemory_operand" "")))]
  1139.   ""
  1140.   "
  1141. {
  1142.   if (GET_CODE (operands[2]) != CONST_INT)
  1143.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1144. }")
  1145.  
  1146. (define_insn ""
  1147.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  1148.     (rotatert:DI (match_operand:DI 1 "int_reg_operand" "0")
  1149.              (match_operand:SI 2 "const_int_operand" "n")))]
  1150.   ""
  1151.   "rotli  $%n2,%0"
  1152.  [(set_attr "type" "arith")])
  1153.  
  1154. (define_insn ""
  1155.   [(set (match_operand:DI 0 "int_reg_operand" "=r")
  1156.     (rotatert:DI (match_operand:DI 1 "int_reg_operand" "0")
  1157.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
  1158.   ""
  1159.   "rotl   %2,%0"
  1160.  [(set_attr "type" "arith")])
  1161.  
  1162. (define_expand "rotrsi3"
  1163.   [(set (match_operand:SI 0 "int_reg_operand" "")
  1164.     (rotatert:SI (match_operand:SI 1 "int_reg_operand" "")
  1165.                  (match_operand:SI 2 "nonmemory_operand" "")))]
  1166.   ""
  1167.   "
  1168. {
  1169.   if (GET_CODE (operands[2]) != CONST_INT)
  1170.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1171. }")
  1172.  
  1173. (define_insn ""
  1174.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  1175.     (rotatert:SI (match_operand:SI 1 "int_reg_operand" "0")
  1176.              (match_operand:SI 2 "const_int_operand" "n")))]
  1177.   ""
  1178.   "roti   $%n2,%0"
  1179.  [(set_attr "type" "arith")])
  1180.  
  1181. (define_insn ""
  1182.   [(set (match_operand:SI 0 "int_reg_operand" "=r")
  1183.     (rotatert:SI (match_operand:SI 1 "int_reg_operand" "0")
  1184.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
  1185.   ""
  1186.   "rotw   %2,%0"
  1187.  [(set_attr "type" "arith")])
  1188.  
  1189. (define_insn "rotldi3"
  1190.   [(set (match_operand:DI 0 "int_reg_operand" "=r,r")
  1191.     (rotate:DI (match_operand:DI 1 "int_reg_operand" "0,0")
  1192.            (match_operand:SI 2 "nonmemory_operand" "r,n")))]
  1193.   ""
  1194.   "@
  1195.    rotl   %2,%0
  1196.    rotli  %2,%0"
  1197.  [(set_attr "type" "arith")])
  1198.  
  1199. (define_insn "rotlsi3"
  1200.   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
  1201.     (rotate:SI (match_operand:SI 1 "int_reg_operand" "0,0")
  1202.            (match_operand:SI 2 "nonmemory_operand" "r,n")))]
  1203.   ""
  1204.   "@
  1205.    rotw   %2,%0
  1206.    roti   %2,%0"
  1207.  [(set_attr "type" "arith")])
  1208.  
  1209.  
  1210. ;;
  1211. ;; jump and branch insns
  1212. ;;
  1213. (define_insn "jump"
  1214.   [(set (pc)
  1215.     (label_ref (match_operand 0 "" "")))]
  1216.   ""
  1217.   "b      %l0"
  1218.  [(set_attr "type" "branch")])
  1219.  
  1220. (define_insn "tablejump"
  1221.   [(set (pc) (match_operand:SI 0 "register_operand" "r"))
  1222.    (use (label_ref (match_operand 1 "" "")))]
  1223.   ""
  1224.   "b      (%0)"
  1225.  [(set_attr "type" "branch")])
  1226.  
  1227. (define_insn "beq"
  1228.   [(set (pc)
  1229.     (if_then_else (eq (cc0)
  1230.               (const_int 0))
  1231.               (label_ref (match_operand 0 "" ""))
  1232.               (pc)))]
  1233.   ""
  1234.   "breq   %l0"
  1235.  [(set_attr "type" "branch")])
  1236.  
  1237. (define_insn "bne"
  1238.   [(set (pc)
  1239.     (if_then_else (ne (cc0)
  1240.               (const_int 0))
  1241.               (label_ref (match_operand 0 "" ""))
  1242.               (pc)))]
  1243.   ""
  1244.   "brne   %l0"
  1245.  [(set_attr "type" "branch")])
  1246.  
  1247. (define_insn "bgt"
  1248.   [(set (pc)
  1249.     (if_then_else (gt (cc0)
  1250.               (const_int 0))
  1251.               (label_ref (match_operand 0 "" ""))
  1252.               (pc)))]
  1253.   ""
  1254.   "brgt   %l0"
  1255.  [(set_attr "type" "branch")])
  1256.  
  1257. (define_insn "bgtu"
  1258.   [(set (pc)
  1259.     (if_then_else (gtu (cc0)
  1260.                (const_int 0))
  1261.               (label_ref (match_operand 0 "" ""))
  1262.               (pc)))]
  1263.   ""
  1264.   "brgtu  %l0"
  1265.  [(set_attr "type" "branch")])
  1266.  
  1267. (define_insn "blt"
  1268.   [(set (pc)
  1269.     (if_then_else (lt (cc0)
  1270.               (const_int 0))
  1271.               (label_ref (match_operand 0 "" ""))
  1272.               (pc)))]
  1273.   ""
  1274.   "brlt   %l0"
  1275.  [(set_attr "type" "branch")])
  1276.  
  1277. (define_insn "bltu"
  1278.   [(set (pc)
  1279.     (if_then_else (ltu (cc0)
  1280.                (const_int 0))
  1281.               (label_ref (match_operand 0 "" ""))
  1282.               (pc)))]
  1283.   ""
  1284.   "brltu  %l0"
  1285.  [(set_attr "type" "branch")])
  1286.  
  1287. (define_insn "bge"
  1288.   [(set (pc)
  1289.     (if_then_else (ge (cc0)
  1290.               (const_int 0))
  1291.               (label_ref (match_operand 0 "" ""))
  1292.               (pc)))]
  1293.   ""
  1294.   "brge   %l0"
  1295.  [(set_attr "type" "branch")])
  1296.  
  1297. (define_insn "bgeu"
  1298.   [(set (pc)
  1299.     (if_then_else (geu (cc0)
  1300.                (const_int 0))
  1301.               (label_ref (match_operand 0 "" ""))
  1302.               (pc)))]
  1303.   ""
  1304.   "brgeu  %l0"
  1305.  [(set_attr "type" "branch")])
  1306.  
  1307. (define_insn "ble"
  1308.   [(set (pc)
  1309.     (if_then_else (le (cc0)
  1310.               (const_int 0))
  1311.               (label_ref (match_operand 0 "" ""))
  1312.               (pc)))]
  1313.  ""
  1314.  "brle   %l0"
  1315.  [(set_attr "type" "branch")])
  1316.  
  1317. (define_insn "bleu"
  1318.   [(set (pc)
  1319.     (if_then_else (leu (cc0)
  1320.                (const_int 0))
  1321.               (label_ref (match_operand 0 "" ""))
  1322.               (pc)))]
  1323.  ""
  1324.  "brleu  %l0"
  1325.  [(set_attr "type" "branch")])
  1326.  
  1327. ;; Recognize reversed jumps.
  1328. (define_insn ""
  1329.   [(set (pc)
  1330.     (if_then_else (match_operator 0 "comparison_operator"
  1331.                       [(cc0)
  1332.                        (const_int 0)])
  1333.               (pc)
  1334.               (label_ref (match_operand 1 "" ""))))]
  1335.  ""
  1336.  "br%C0    %l1" ; %C0 negates condition
  1337.  [(set_attr "type" "branch")])
  1338.  
  1339. ;;
  1340. ;; call instructions
  1341. ;;
  1342. (define_insn "call"
  1343.   [(call (match_operand:QI 0 "general_operand" "m")
  1344.      (match_operand:SI 1 "general_operand" ""))]
  1345.   ;; Operand 1 not used on the clipper.
  1346.   ""
  1347.   "call   sp,%0")
  1348.  
  1349. (define_insn "call_value"
  1350.   [(set (match_operand 0 "" "=rf")
  1351.     (call (match_operand:QI 1 "general_operand" "m")
  1352.           (match_operand:SI 2 "general_operand" "g")))]
  1353.   ;; Operand 2 not used on the clipper
  1354.   ""
  1355.   "call   sp,%1")
  1356.  
  1357. (define_insn "indirect_jump"
  1358.   [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
  1359.   ""
  1360.   "b      (%0)"
  1361.  [(set_attr "type" "branch")])
  1362.  
  1363.  
  1364. (define_insn "nop"
  1365.   [(const_int 0)]
  1366.   ""
  1367.   "noop"
  1368.  [(set_attr "type" "arith")
  1369.   (set_attr "cc" "unchanged")])
  1370.  
  1371.  
  1372.  
  1373. ;; while (--foo >= 0)
  1374. ;;
  1375. ;; Combiners for 'decrement test and branch' do not work for clipper.
  1376. ;; These patters are jump_insns that do not allow output reloads and clipper
  1377. ;; can only decrement and test registers.
  1378. ;;
  1379.