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 / convex / convex.md < prev    next >
Encoding:
Text File  |  1994-04-10  |  53.5 KB  |  1,883 lines

  1. ;;- Machine description for GNU compiler, Convex Version
  2. ;;  Copyright (C) 1988, 1993, 1994 Free Software Foundation, Inc.
  3.  
  4. ;; This file is part of GNU CC.
  5.  
  6. ;; GNU CC is free software; you can redistribute it and/or modify
  7. ;; it under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation; either version 2, or (at your option)
  9. ;; any later version.
  10.  
  11. ;; GNU CC is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ;; GNU General Public License for more details.
  15.  
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with GNU CC; see the file COPYING.  If not, write to
  18. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. ;; Attribute specifications
  21.  
  22. ; Target CPU
  23. (define_attr "cpu" "c1,c32,c34,c38"
  24.   (const (symbol_ref "(enum attr_cpu) target_cpu")))
  25.  
  26. ;; Instruction classification
  27.  
  28. (define_attr "type"
  29.   "alu,xalu,mldw,mldl,mldb,mst,adds,addd,mulw,mull,muls,muld,divw,divl,divs,divd,shfw,shfl,cvts,cvtd"
  30.   (const_string "alu"))
  31.  
  32. ;; Instruction times
  33.  
  34. (define_function_unit "mem" 1 0
  35.   (and (eq_attr "cpu" "c1") (eq_attr "type" "mldw")) 2 0)
  36. (define_function_unit "mem" 1 0
  37.   (and (eq_attr "cpu" "c1") (eq_attr "type" "mldl")) 4 0)
  38. (define_function_unit "mem" 1 0
  39.   (and (eq_attr "cpu" "c32") (eq_attr "type" "mldw,mldl")) 2 0)
  40. (define_function_unit "mem" 1 0
  41.   (and (eq_attr "cpu" "c34") (eq_attr "type" "mldw,mldl")) 4 0)
  42. (define_function_unit "mem" 1 0
  43.   (and (eq_attr "cpu" "c38") (eq_attr "type" "mldw,mldl")) 2 0)
  44.  
  45. (define_function_unit "mem" 1 0
  46.   (and (eq_attr "cpu" "c32") (eq_attr "type" "mldb")) 9 0)
  47. (define_function_unit "mem" 1 0
  48.   (and (eq_attr "cpu" "c34") (eq_attr "type" "mldb")) 36 0)
  49. (define_function_unit "mem" 1 0
  50.   (and (eq_attr "cpu" "c38") (eq_attr "type" "mldb")) 21 0)
  51.  
  52. (define_function_unit "mem" 1 0
  53.   (and (eq_attr "cpu" "c1") (eq_attr "type" "xalu")) 1 0)
  54. (define_function_unit "mem" 1 0
  55.   (and (eq_attr "cpu" "c32") (eq_attr "type" "xalu")) 1 0)
  56. (define_function_unit "mem" 1 0
  57.   (and (eq_attr "cpu" "c34") (eq_attr "type" "xalu")) 5 0)
  58. (define_function_unit "mem" 1 0
  59.   (and (eq_attr "cpu" "c38") (eq_attr "type" "xalu")) 2 0)
  60.  
  61. (define_function_unit "add" 1 0
  62.   (and (eq_attr "cpu" "c1") (eq_attr "type" "adds,addd")) 3 2)
  63. (define_function_unit "add" 1 0
  64.   (and (eq_attr "cpu" "c32") (eq_attr "type" "adds,addd")) 2 1)
  65. (define_function_unit "add" 1 0
  66.   (and (eq_attr "cpu" "c34") (eq_attr "type" "adds,addd")) 5 2)
  67. (define_function_unit "add" 1 0
  68.   (and (eq_attr "cpu" "c38") (eq_attr "type" "adds,addd")) 2 1)
  69.  
  70. (define_function_unit "mul" 1 0
  71.   (and (eq_attr "cpu" "c1") (eq_attr "type" "mulw,muls")) 3 2)
  72. (define_function_unit "mul" 1 0
  73.   (and (eq_attr "cpu" "c32") (eq_attr "type" "mulw,muls")) 4 2)
  74. (define_function_unit "mul" 1 0
  75.   (and (eq_attr "cpu" "c34") (eq_attr "type" "mulw,muls")) 6 2)
  76. (define_function_unit "mul" 1 0
  77.   (and (eq_attr "cpu" "c38") (eq_attr "type" "mulw,muls")) 3 2)
  78.  
  79. (define_function_unit "mul" 1 0
  80.   (and (eq_attr "cpu" "c1") (eq_attr "type" "mull,muld")) 4 3)
  81. (define_function_unit "mul" 1 0
  82.   (and (eq_attr "cpu" "c32") (eq_attr "type" "mull")) 10 7)
  83. (define_function_unit "mul" 1 0
  84.   (and (eq_attr "cpu" "c32") (eq_attr "type" "muld")) 5 2)
  85. (define_function_unit "mul" 1 0
  86.   (and (eq_attr "cpu" "c34") (eq_attr "type" "mull,muld")) 7 3)
  87. (define_function_unit "mul" 1 0
  88.   (and (eq_attr "cpu" "c38") (eq_attr "type" "mull,muld")) 4 3)
  89.  
  90. (define_function_unit "div" 1 0
  91.   (and (eq_attr "cpu" "c1") (eq_attr "type" "divw")) 24 24)
  92. (define_function_unit "div" 1 0
  93.   (and (eq_attr "cpu" "c32") (eq_attr "type" "divw")) 44 6)
  94. (define_function_unit "div" 1 0
  95.   (and (eq_attr "cpu" "c34") (eq_attr "type" "divw")) 14 10)
  96. (define_function_unit "div" 1 0
  97.   (and (eq_attr "cpu" "c38") (eq_attr "type" "divw")) 11 10)
  98.  
  99. (define_function_unit "div" 1 0
  100.   (and (eq_attr "cpu" "c1") (eq_attr "type" "divl")) 41 42)
  101. (define_function_unit "div" 1 0
  102.   (and (eq_attr "cpu" "c32") (eq_attr "type" "divl")) 76 5)
  103. (define_function_unit "div" 1 0
  104.   (and (eq_attr "cpu" "c34") (eq_attr "type" "divl")) 22 18)
  105. (define_function_unit "div" 1 0
  106.   (and (eq_attr "cpu" "c38") (eq_attr "type" "divl")) 19 18)
  107.  
  108. (define_function_unit "div" 1 0
  109.   (and (eq_attr "cpu" "c1") (eq_attr "type" "divs")) 22 22)
  110. (define_function_unit "div" 1 0
  111.   (and (eq_attr "cpu" "c32") (eq_attr "type" "divs")) 8 6)
  112. (define_function_unit "div" 1 0
  113.   (and (eq_attr "cpu" "c34") (eq_attr "type" "divs")) 13 9)
  114. (define_function_unit "div" 1 0
  115.   (and (eq_attr "cpu" "c38") (eq_attr "type" "divs")) 10 9)
  116.  
  117. (define_function_unit "div" 1 0
  118.   (and (eq_attr "cpu" "c1") (eq_attr "type" "divd")) 37 38)
  119. (define_function_unit "div" 1 0
  120.   (and (eq_attr "cpu" "c32") (eq_attr "type" "divd")) 12 8)
  121. (define_function_unit "div" 1 0
  122.   (and (eq_attr "cpu" "c34") (eq_attr "type" "divd")) 20 16)
  123. (define_function_unit "div" 1 0
  124.   (and (eq_attr "cpu" "c38") (eq_attr "type" "divd")) 17 16)
  125.  
  126. (define_function_unit "misc" 1 0
  127.   (and (eq_attr "cpu" "c1") (eq_attr "type" "cvts,cvtd")) 4 3)
  128. (define_function_unit "misc" 1 0
  129.   (and (eq_attr "cpu" "c32") (eq_attr "type" "cvts")) 9 7)
  130. (define_function_unit "misc" 1 0
  131.   (and (eq_attr "cpu" "c32") (eq_attr "type" "cvtd")) 9 6)
  132. (define_function_unit "misc" 1 0
  133.   (and (eq_attr "cpu" "c34") (eq_attr "type" "cvts")) 6 2)
  134. (define_function_unit "misc" 1 0
  135.   (and (eq_attr "cpu" "c34") (eq_attr "type" "cvtd")) 6 1)
  136. (define_function_unit "misc" 1 0
  137.   (and (eq_attr "cpu" "c38") (eq_attr "type" "cvts,cvtd")) 3 1)
  138.  
  139. (define_function_unit "misc" 1 0
  140.   (and (eq_attr "cpu" "c1") (eq_attr "type" "shfw,shfl")) 3 2)
  141. (define_function_unit "misc" 1 0
  142.   (and (eq_attr "cpu" "c32") (eq_attr "type" "shfw")) 7 5)
  143. (define_function_unit "misc" 1 0
  144.   (and (eq_attr "cpu" "c32") (eq_attr "type" "shfl")) 7 4)
  145. (define_function_unit "misc" 1 0
  146.   (and (eq_attr "cpu" "c38") (eq_attr "type" "shfw,shfl")) 3 1)
  147.  
  148. (define_function_unit "mystery_latch" 1 1
  149.   (and (eq_attr "type" "!alu,mldw,mldl,adds,addd") (eq_attr "cpu" "c32")) 2 2)
  150.  
  151. ;(define_function_unit "ip" 1 1
  152. ;  (and (eq_attr "cpu" "c1")
  153. ;       (eq_attr "type" "divw,divl,divs,divd,xalu")) 2 2)
  154. ;(define_function_unit "ip" 1 1
  155. ;  (and (eq_attr "cpu" "c1")
  156. ;       (eq_attr "type" "!divw,divl,divs,divd,xalu")) 1 1)
  157. ;(define_function_unit "ip" 1 1
  158. ;  (and (eq_attr "cpu" "c32")
  159. ;       (eq_attr "type" "mull,muld,divl,divd,shfl,cvtd,xalu")) 2 2)
  160. ;(define_function_unit "ip" 1 1
  161. ;  (and (eq_attr "cpu" "c32")
  162. ;       (eq_attr "type" "!mull,muld,divl,divd,shfl,cvtd,xalu")) 1 1)
  163. ;(define_function_unit "ip" 1 1
  164. ;  (and (eq_attr "cpu" "c34")
  165. ;       (eq_attr "type" "addd,mull,muld,divl,divd,cvtd,xalu")) 2 2)
  166. ;(define_function_unit "ip" 1 1
  167. ;  (and (eq_attr "cpu" "c34")
  168. ;       (eq_attr "type" "!addd,mull,muld,divl,divd,cvtd,xalu")) 1 1)
  169.  
  170. ;; Make the first thing a real insn in case of genattrtab bug
  171.  
  172. (define_insn "nop"
  173.   [(const_int 0)]
  174.   ""
  175.   "nop")
  176.  
  177. ;; Moves
  178.  
  179. (define_expand "movdf"
  180.   [(set (match_operand:DF 0 "general_operand" "")
  181.     (match_operand:DF 1 "general_operand" ""))]
  182.   ""
  183.   "if (GET_CODE (operands[0]) != REG)
  184.      operands[1] = force_reg (DFmode, operands[1]);")
  185.  
  186. (define_insn ""
  187.   [(set (match_operand:DF 0 "general_operand" "=d,d,d,d,d,<,m")
  188.     (match_operand:DF 1 "general_operand"  "d,Q,m,G,H,d,d"))]
  189.   "register_operand (operands[0], DFmode)
  190.    || register_operand (operands[1], DFmode)"
  191.   "@
  192.    mov %1,%0
  193.    ldb.d %1,%0
  194.    ld.d %1,%0
  195.    ld.d %u1,%0
  196.    ld.l %v1,%0
  197.    psh.l %1
  198.    st.d %1,%0"
  199.   [(set_attr "type" "alu,mldb,mldl,alu,alu,alu,mst")])
  200.  
  201. ;; This is here so we can load any result of RTL constant folding
  202. ;; but do not use it on constants that can be loaded from memory.
  203. ;; It is never better and can be worse.
  204.  
  205. (define_insn ""
  206.   [(set (match_operand:DF 0 "register_operand" "=d")
  207.     (match_operand:DF 1 "const_double_operand" "F"))]
  208.   "CONST_DOUBLE_MEM (operands[1]) == const0_rtx"
  209.   "ld.u %u1,%0\;ld.w %v1,%0"
  210.   [(set_attr "type" "xalu")])
  211.  
  212. (define_expand "movsf"
  213.   [(set (match_operand:SF 0 "general_operand" "")
  214.     (match_operand:SF 1 "general_operand" ""))]
  215.   ""
  216.   "if (GET_CODE (operands[0]) != REG)
  217.      operands[1] = force_reg (SFmode, operands[1]);")
  218.  
  219. (define_insn ""
  220.   [(set (match_operand:SF 0 "general_operand" "=d,d,d,d,<,m")
  221.     (match_operand:SF 1 "general_operand" "d,Q,m,F,d,d"))]
  222.   "register_operand (operands[0], SFmode)
  223.    || register_operand (operands[1], SFmode)"
  224.   "@
  225.    mov.s %1,%0
  226.    ldb.s %1,%0
  227.    ld.s %1,%0
  228.    ld.s %1,%0
  229.    psh.w %1
  230.    st.s %1,%0"
  231.   [(set_attr "type" "alu,mldb,mldw,alu,alu,mst")])
  232.  
  233. (define_expand "movdi"
  234.   [(set (match_operand:DI 0 "general_operand" "")
  235.     (match_operand:DI 1 "general_operand" ""))]
  236.   ""
  237.   "if (GET_CODE (operands[0]) != REG)
  238.      operands[1] = force_reg (DImode, operands[1]);")
  239.  
  240. (define_insn ""
  241.   [(set (match_operand:DI 0 "general_operand" "=d,d,d,d,d,<,m")
  242.     (match_operand:DI 1 "general_operand" "d,Q,m,G,HI,d,d"))]
  243.   "register_operand (operands[0], DImode)
  244.    || register_operand (operands[1], DImode)"
  245.   "@
  246.    mov %1,%0
  247.    ldb.l %1,%0
  248.    ld.l %1,%0
  249.    ld.d %u1,%0
  250.    ld.l %1,%0
  251.    psh.l %1
  252.    st.l %1,%0"
  253.   [(set_attr "type" "alu,mldb,mldl,alu,alu,alu,mst")])
  254.  
  255. ;; This is here so we can load any result of RTL constant folding
  256. ;; but do not use it on constants that can be loaded from memory.
  257. ;; It is never better and can be worse.
  258.  
  259. (define_insn ""
  260.   [(set (match_operand:DI 0 "register_operand" "=d")
  261.     (match_operand:DI 1 "const_double_operand" "F"))]
  262.   "CONST_DOUBLE_MEM (operands[1]) == const0_rtx"
  263.   "ld.u %u1,%0\;ld.w %v1,%0"
  264.   [(set_attr "type" "xalu")])
  265.  
  266. (define_expand "movsi"
  267.   [(set (match_operand:SI 0 "general_operand" "")
  268.     (match_operand:SI 1 "general_operand" ""))]
  269.   ""
  270.   "if (GET_CODE (operands[0]) != REG)
  271.      operands[1] = force_reg (SImode, operands[1]);")
  272.  
  273. (define_insn ""
  274.   [(set (match_operand:SI 0 "push_operand" "=<,<")
  275.     (match_operand:SI 1 "nonmemory_operand" "Ad,i"))]
  276.   ""
  277.   "@
  278.    psh.w %1
  279.    pshea %a1")
  280.  
  281. (define_insn ""
  282.   [(set (match_operand:SI 0 "general_operand" "=d,r,d,r,r,m")
  283.     (match_operand:SI 1 "general_operand" "d,r,Q,m,i,r"))]
  284.   "register_operand (operands[0], SImode)
  285.    || register_operand (operands[1], SImode)"
  286.   "@
  287.    mov.w %1,%0
  288.    mov %1,%0
  289.    ldb.w %1,%0
  290.    ld.w %1,%0
  291.    ld.w %1,%0
  292.    st.w %1,%0"
  293.   [(set_attr "type" "alu,alu,mldb,mldw,alu,mst")])
  294.  
  295. (define_expand "movstrictsi"
  296.   [(set (strict_low_part (match_operand:SI 0 "general_operand" ""))
  297.     (match_operand:SI 1 "general_operand" ""))]
  298.   ""
  299.   "if (GET_CODE (operands[0]) != REG)
  300.      operands[1] = force_reg (SImode, operands[1]);")
  301.  
  302. (define_insn ""
  303.   [(set (strict_low_part (match_operand:SI 0 "general_operand" "=d,r,d,r,r,m"))
  304.     (match_operand:SI 1 "general_operand" "d,r,Q,m,i,r"))]
  305.   "register_operand (operands[0], SImode)
  306.    || register_operand (operands[1], SImode)"
  307.   "@
  308.    mov.w %1,%0
  309.    mov %1,%0
  310.    ldb.w %1,%0
  311.    ld.w %1,%0
  312.    ld.w %1,%0
  313.    st.w %1,%0"
  314.   [(set_attr "type" "alu,alu,mldb,mldw,alu,mst")])
  315.  
  316. (define_expand "movhi"
  317.   [(set (match_operand:HI 0 "general_operand" "")
  318.     (match_operand:HI 1 "general_operand" ""))]
  319.   ""
  320.   "if (GET_CODE (operands[0]) != REG)
  321.      operands[1] = force_reg (HImode, operands[1]);")
  322.  
  323. (define_insn ""
  324.   [(set (match_operand:HI 0 "general_operand" "=d,r,d,r,r,<,m")
  325.     (match_operand:HI 1 "general_operand" "d,r,Q,m,i,Ad,r"))]
  326.   "register_operand (operands[0], HImode)
  327.    || register_operand (operands[1], HImode)"
  328.   "@
  329.    mov.w %1,%0
  330.    mov %1,%0
  331.    ldb.h %1,%0
  332.    ld.h %1,%0
  333.    ld.w %1,%0
  334.    psh.w %1
  335.    st.h %1,%0"
  336.   [(set_attr "type" "alu,alu,mldb,mldw,alu,alu,mst")])
  337.  
  338. (define_expand "movqi"
  339.   [(set (match_operand:QI 0 "general_operand" "")
  340.     (match_operand:QI 1 "general_operand" ""))]
  341.   ""
  342.   "if (GET_CODE (operands[0]) != REG)
  343.      operands[1] = force_reg (QImode, operands[1]);")
  344.  
  345. (define_insn ""
  346.   [(set (match_operand:QI 0 "general_operand" "=d,r,d,r,r,<,m")
  347.     (match_operand:QI 1 "general_operand" "d,r,Q,m,i,Ad,r"))]
  348.   "register_operand (operands[0], QImode)
  349.    || register_operand (operands[1], QImode)"
  350.   "@
  351.    mov.w %1,%0
  352.    mov %1,%0
  353.    ldb.b %1,%0
  354.    ld.b %1,%0
  355.    ld.w %1,%0
  356.    psh.w %1
  357.    st.b %1,%0"
  358.   [(set_attr "type" "alu,alu,mldb,mldw,alu,alu,mst")])
  359.  
  360. ;; Expand block moves manually to get code that pipelines the loads.
  361.  
  362. (define_expand "movstrsi"
  363.   [(set (match_operand:BLK 0 "memory_operand" "=m")
  364.     (match_operand:BLK 1 "memory_operand" "m"))
  365.    (use (match_operand:SI 2 "const_int_operand" "i"))
  366.    (use (match_operand:SI 3 "const_int_operand" "i"))]
  367.   ""
  368.   " expand_movstr (operands); DONE; ")
  369.  
  370. ;; Extension and truncation insns.
  371. ;; Those for integer source operand
  372. ;; are ordered widest source type first.
  373.  
  374. (define_insn "truncsiqi2"
  375.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  376.     (truncate:QI (match_operand:SI 1 "register_operand" "d,a")))]
  377.   ""
  378.   "cvtw.b %1,%0")
  379.  
  380. (define_insn "truncsihi2"
  381.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  382.     (truncate:HI (match_operand:SI 1 "register_operand" "d,a")))]
  383.   ""
  384.   "cvtw.h %1,%0")
  385.  
  386. (define_insn "trunchiqi2"
  387.   [(set (match_operand:QI 0 "register_operand" "=r")
  388.     (truncate:QI (match_operand:HI 1 "register_operand" "0")))]
  389.   ""
  390.   "")
  391.  
  392. (define_insn "truncdisi2"
  393.   [(set (match_operand:SI 0 "register_operand" "=d")
  394.     (truncate:SI (match_operand:DI 1 "register_operand" "d")))]
  395.   ""
  396.   "cvtl.w %1,%0")
  397.  
  398. (define_insn "extendsidi2"
  399.   [(set (match_operand:DI 0 "register_operand" "=d")
  400.     (sign_extend:DI (match_operand:SI 1 "register_operand" "d")))]
  401.   ""
  402.   "cvtw.l %1,%0")
  403.  
  404. (define_insn "extendhisi2"
  405.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  406.     (sign_extend:SI (match_operand:HI 1 "register_operand" "d,a")))]
  407.   ""
  408.   "cvth.w %1,%0")
  409.  
  410. (define_insn "extendqihi2"
  411.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  412.     (sign_extend:HI (match_operand:QI 1 "register_operand" "d,a")))]
  413.   ""
  414.   "cvtb.w %1,%0")
  415.  
  416. (define_insn "extendqisi2"
  417.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  418.     (sign_extend:SI (match_operand:QI 1 "register_operand" "d,a")))]
  419.   ""
  420.   "cvtb.w %1,%0")
  421.  
  422. (define_insn "extendsfdf2"
  423.   [(set (match_operand:DF 0 "register_operand" "=d")
  424.     (float_extend:DF (match_operand:SF 1 "register_operand" "d")))]
  425.   ""
  426.   "cvts.d %1,%0"
  427.   [(set_attr "type" "cvts")])
  428.  
  429. (define_insn "truncdfsf2"
  430.   [(set (match_operand:SF 0 "register_operand" "=d")
  431.     (float_truncate:SF (match_operand:DF 1 "register_operand" "d")))]
  432.   ""
  433.   "cvtd.s %1,%0"
  434.   [(set_attr "type" "cvtd")])
  435.  
  436. (define_insn "zero_extendhisi2"
  437.   [(set (match_operand:SI 0 "register_operand" "=r")
  438.     (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))]
  439.   ""
  440.   "and #0xffff,%0")
  441.  
  442. (define_insn "zero_extendqihi2"
  443.   [(set (match_operand:HI 0 "register_operand" "=r")
  444.     (zero_extend:HI (match_operand:QI 1 "register_operand" "0")))]
  445.   ""
  446.   "and #0xff,%0")
  447.  
  448. (define_insn "zero_extendqisi2"
  449.   [(set (match_operand:SI 0 "register_operand" "=r")
  450.     (zero_extend:SI (match_operand:QI 1 "register_operand" "0")))]
  451.   ""
  452.   "and #0xff,%0")
  453.  
  454. (define_insn "zero_extendsidi2"
  455.   [(set (match_operand:DI 0 "register_operand" "=d")
  456.     (zero_extend:DI (match_operand:SI 1 "register_operand" "0")))]
  457.   ""
  458.   "ld.u #0,%0")
  459.  
  460. ;; Fix-to-float conversion insns.
  461. ;; Note that the ones that start with SImode come first.
  462. ;; That is so that an operand that is a CONST_INT
  463. ;; (and therefore lacks a specific machine mode).
  464. ;; will be recognized as SImode (which is always valid)
  465. ;; rather than as QImode or HImode.
  466.  
  467. (define_insn "floatsisf2"
  468.   [(set (match_operand:SF 0 "register_operand" "=d")
  469.     (float:SF (match_operand:SI 1 "register_operand" "d")))]
  470.   ""
  471.   "cvtw.s %1,%0"
  472.   [(set_attr "type" "cvts")])
  473.  
  474. (define_insn "floatdisf2"
  475.   [(set (match_operand:SF 0 "register_operand" "=d")
  476.     (float:SF (match_operand:DI 1 "register_operand" "d")))]
  477.   ""
  478.   "cvtl.s %1,%0"
  479.   [(set_attr "type" "cvtd")])
  480.  
  481. (define_insn "floatsidf2"
  482.   [(set (match_operand:DF 0 "register_operand" "=d")
  483.     (float:DF (match_operand:SI 1 "register_operand" "d")))]
  484.   "! TARGET_C1"
  485.   "cvtw.d %1,%0"
  486.   [(set_attr "type" "cvts")])
  487.  
  488. (define_insn "floatdidf2"
  489.   [(set (match_operand:DF 0 "register_operand" "=d")
  490.     (float:DF (match_operand:DI 1 "register_operand" "d")))]
  491.   ""
  492.   "cvtl.d %1,%0"
  493.   [(set_attr "type" "cvtd")])
  494.  
  495. ;; These are a little slower than gcc's normal way of doing unsigned
  496. ;; DI floats (if the DI number is "negative") but they avoid double
  497. ;; rounding and they avoid explicit constants.
  498.  
  499. (define_expand "floatunsdidf2"
  500.   [(set (match_operand:DF 0 "register_operand" "=d")
  501.     (float:DF (match_operand:DI 1 "register_operand" "d")))
  502.    (set (cc0) (compare:DI (match_dup 3) (match_dup 1)))
  503.    (set (pc)
  504.     (if_then_else (le (cc0) (const_int 0))
  505.               (label_ref (match_dup 4))
  506.               (pc)))
  507.    (set (match_dup 2) (lshiftrt:DI (match_dup 1) (const_int 1)))
  508.    (set (match_dup 0) (float:DF (match_dup 2)))
  509.    (set (match_dup 0) (plus:DF (match_dup 0) (match_dup 0)))
  510.    (match_dup 4)
  511.    (set (match_dup 0) (match_dup 0))]
  512.   ""
  513.   "
  514. {
  515.   operands[2] = gen_reg_rtx (DImode);
  516.   operands[3] = force_reg (DImode, const0_rtx);
  517.   operands[4] = gen_label_rtx ();
  518. }")
  519.  
  520. (define_expand "floatunsdisf2"
  521.   [(set (match_operand:SF 0 "register_operand" "=d")
  522.     (float:SF (match_operand:DI 1 "register_operand" "d")))
  523.    (set (cc0) (compare:DI (match_dup 3) (match_dup 1)))
  524.    (set (pc)
  525.     (if_then_else (le (cc0) (const_int 0))
  526.               (label_ref (match_dup 4))
  527.               (pc)))
  528.    (set (match_dup 2) (lshiftrt:DI (match_dup 1) (const_int 1)))
  529.    (set (match_dup 0) (float:SF (match_dup 2)))
  530.    (set (match_dup 0) (plus:SF (match_dup 0) (match_dup 0)))
  531.    (match_dup 4)
  532.    (set (match_dup 0) (match_dup 0))]
  533.   ""
  534.   "
  535. {
  536.   operands[2] = gen_reg_rtx (DImode);
  537.   operands[3] = force_reg (DImode, const0_rtx);
  538.   operands[4] = gen_label_rtx ();
  539. }")
  540.  
  541. ;; These patterns are identical to gcc's default action 
  542. ;; if DI->DF and DI->SF are not present.  There are here
  543. ;; only to prevent SI->*F from promoting to DI->*F.
  544.  
  545. (define_expand "floatunssidf2"
  546.   [(set (match_dup 2)
  547.     (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
  548.    (set (match_operand:DF 0 "register_operand" "")
  549.     (float:DF (match_dup 2)))]
  550.   ""
  551.   "operands[2] = gen_reg_rtx (DImode);")
  552.  
  553. (define_expand "floatunssisf2"
  554.   [(set (match_dup 2)
  555.         (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
  556.    (set (match_operand:SF 0 "register_operand" "")
  557.         (float:SF (match_dup 2)))]
  558.   ""
  559.   "operands[2] = gen_reg_rtx (DImode);")
  560.  
  561. ;; Float-to-fix conversion insns.
  562.  
  563. (define_insn "fix_truncsfsi2"
  564.   [(set (match_operand:SI 0 "register_operand" "=d")
  565.     (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "d"))))]
  566.   ""
  567.   "cvts.w %1,%0"
  568.   [(set_attr "type" "cvts")])
  569.  
  570. (define_insn "fix_truncsfdi2"
  571.   [(set (match_operand:DI 0 "register_operand" "=d")
  572.     (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "d"))))]
  573.   ""
  574.   "cvts.l %1,%0"
  575.   [(set_attr "type" "cvts")])
  576.  
  577. (define_insn "fix_truncdfsi2"
  578.   [(set (match_operand:SI 0 "register_operand" "=d")
  579.     (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "d"))))]
  580.   ""
  581.   "cvtd.l %1,%0"
  582.   [(set_attr "type" "cvtd")])
  583.  
  584. (define_insn "fix_truncdfdi2"
  585.   [(set (match_operand:DI 0 "register_operand" "=d")
  586.     (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "d"))))]
  587.   ""
  588.   "cvtd.l %1,%0"
  589.   [(set_attr "type" "cvtd")])
  590.  
  591. ;;- All kinds of add instructions.
  592.  
  593. (define_insn "adddf3"
  594.   [(set (match_operand:DF 0 "register_operand" "=d")
  595.     (plus:DF (match_operand:DF 1 "register_operand" "%0")
  596.          (match_operand:DF 2 "register_operand" "d")))]
  597.   ""
  598.   "add.d %2,%0"
  599.   [(set_attr "type" "addd")])
  600.  
  601. (define_insn "addsf3"
  602.   [(set (match_operand:SF 0 "register_operand" "=d")
  603.     (plus:SF (match_operand:SF 1 "register_operand" "%0")
  604.          (match_operand:SF 2 "nonmemory_operand" "dF")))]
  605.   ""
  606.   "add.s %2,%0"
  607.   [(set_attr "type" "adds")])
  608.  
  609. (define_insn "adddi3"
  610.   [(set (match_operand:DI 0 "register_operand" "=d")
  611.     (plus:DI (match_operand:DI 1 "register_operand" "%0")
  612.          (match_operand:DI 2 "register_operand" "d")))]
  613.   ""
  614.   "add.l %2,%0")
  615.  
  616. (define_expand "addsi3"
  617.   [(set (match_operand:SI 0 "register_operand" "")
  618.     (plus:SI (match_operand:SI 1 "register_operand" "")
  619.          (match_operand:SI 2 "nonmemory_operand" "")))]
  620.   ""
  621.   "")
  622.  
  623. (define_insn ""
  624.   [(set (match_operand:SI 0 "register_operand" "=a")
  625.     (plus:SI (match_operand:SI 1 "register_operand" "%A")
  626.          (match_operand:SI 2 "immediate_operand" "i")))]
  627.   "operands[1] == frame_pointer_rtx || operands[1] == arg_pointer_rtx"
  628.   "ldea %a2(%1),%0")
  629.  
  630. (define_insn ""
  631.   [(set (match_operand:SI 0 "register_operand" "=a")
  632.     (plus:SI (match_operand:SI 1 "register_operand" "%a")
  633.          (match_operand:SI 2 "nonmemory_operand" "ri")))]
  634.   "operands[1] == stack_pointer_rtx && operands[0] != stack_pointer_rtx"
  635.   "mov %1,%0\;add.w %2,%0")
  636.  
  637. (define_insn ""
  638.   [(set (match_operand:SI 0 "push_operand" "=<")
  639.     (plus:SI (match_operand:SI 1 "register_operand" "A")
  640.          (match_operand:SI 2 "immediate_operand" "i")))]
  641.   "operands[1] != stack_pointer_rtx"
  642.   "pshea %a2(%1)"
  643.   [(set_attr "type" "mst")])
  644.  
  645. (define_insn ""
  646.   [(set (match_operand:SI 0 "register_operand" "=d,a,a")
  647.     (plus:SI (match_operand:SI 1 "register_operand" "%0,0,A")
  648.          (match_operand:SI 2 "nonmemory_operand" "di,ri,i")))]
  649.   "TARGET_C1"
  650.   "@
  651.    add.w %2,%0
  652.    add.w %2,%0
  653.    ldea %a2(%1),%0")
  654.  
  655. (define_insn ""
  656.   [(set (match_operand:SI 0 "register_operand" "=d,a,r")
  657.     (plus:SI (match_operand:SI 1 "register_operand" "%0,0,A")
  658.          (match_operand:SI 2 "nonmemory_operand" "di,ri,i")))]
  659.   ""
  660.   "@
  661.    add.w %2,%0
  662.    add.w %2,%0
  663.    ldea %a2(%1),%0")
  664.  
  665. (define_insn "addhi3"
  666.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  667.     (plus:HI (match_operand:HI 1 "register_operand" "%0,0")
  668.          (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  669.   ""
  670.   "add.h %2,%0")
  671.  
  672. (define_insn "addqi3"
  673.   [(set (match_operand:QI 0 "register_operand" "=d,d")
  674.     (plus:QI (match_operand:QI 1 "register_operand" "%0,0")
  675.          (match_operand:QI 2 "nonmemory_operand" "d,i")))]
  676.   ""
  677.   "@
  678.    add.b %2,%0
  679.    add.w %2,%0")
  680.  
  681. ;;- All kinds of subtract instructions.
  682.  
  683. (define_insn "subdf3"
  684.   [(set (match_operand:DF 0 "register_operand" "=d")
  685.     (minus:DF (match_operand:DF 1 "register_operand" "0")
  686.           (match_operand:DF 2 "register_operand" "d")))]
  687.   ""
  688.   "sub.d %2,%0"
  689.   [(set_attr "type" "addd")])
  690.  
  691. (define_insn "subsf3"
  692.   [(set (match_operand:SF 0 "register_operand" "=d")
  693.     (minus:SF (match_operand:SF 1 "register_operand" "0")
  694.           (match_operand:SF 2 "nonmemory_operand" "dF")))]
  695.   ""
  696.   "sub.s %2,%0"
  697.   [(set_attr "type" "adds")])
  698.  
  699. (define_insn "subdi3"
  700.   [(set (match_operand:DI 0 "register_operand" "=d")
  701.     (minus:DI (match_operand:DI 1 "register_operand" "0")
  702.           (match_operand:DI 2 "register_operand" "d")))]
  703.   ""
  704.   "sub.l %2,%0")
  705.  
  706. (define_insn "subsi3"
  707.   [(set (match_operand:SI 0 "register_operand" "=d,a,?d,?a")
  708.     (minus:SI (match_operand:SI 1 "nonmemory_operand" "0,0,di,ai")
  709.           (match_operand:SI 2 "nonmemory_operand" "di,ai,0,0")))]
  710.   ""
  711.   "@
  712.   sub.w %2,%0
  713.   sub.w %2,%0
  714.   sub.w %1,%0\;neg.w %0,%0
  715.   sub.w %1,%0\;neg.w %0,%0")
  716.  
  717. (define_insn "subhi3"
  718.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  719.     (minus:HI (match_operand:HI 1 "register_operand" "0,0")
  720.           (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  721.   ""
  722.   "sub.h %2,%0")
  723.  
  724. (define_insn "subqi3"
  725.   [(set (match_operand:QI 0 "register_operand" "=d,d")
  726.     (minus:QI (match_operand:QI 1 "register_operand" "0,0")
  727.           (match_operand:QI 2 "nonmemory_operand" "d,i")))]
  728.   ""
  729.   "@
  730.    sub.b %2,%0
  731.    sub.w %2,%0")
  732.  
  733. ;;- Multiply instructions.
  734.  
  735. (define_insn "muldf3"
  736.   [(set (match_operand:DF 0 "register_operand" "=d")
  737.     (mult:DF (match_operand:DF 1 "register_operand" "%0")
  738.          (match_operand:DF 2 "register_operand" "d")))]
  739.   ""
  740.   "mul.d %2,%0"
  741.   [(set_attr "type" "muld")])
  742.  
  743. (define_insn "mulsf3"
  744.   [(set (match_operand:SF 0 "register_operand" "=d")
  745.     (mult:SF (match_operand:SF 1 "register_operand" "%0")
  746.          (match_operand:SF 2 "nonmemory_operand" "dF")))]
  747.   ""
  748.   "mul.s %2,%0"
  749.   [(set_attr "type" "muls")])
  750.  
  751. (define_insn "muldi3"
  752.   [(set (match_operand:DI 0 "register_operand" "=d")
  753.     (mult:DI (match_operand:DI 1 "register_operand" "%0")
  754.          (match_operand:DI 2 "register_operand" "d")))]
  755.   ""
  756.   "mul.l %2,%0"
  757.   [(set_attr "type" "mull")])
  758.  
  759. (define_insn "mulsi3"
  760.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  761.     (mult:SI (match_operand:SI 1 "register_operand" "%0,0")
  762.          (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  763.   ""
  764.   "mul.w %2,%0"
  765.   [(set_attr "type" "mulw")])
  766.  
  767. (define_insn "mulhi3"
  768.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  769.     (mult:HI (match_operand:HI 1 "register_operand" "%0,0")
  770.          (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  771.   ""
  772.   "mul.h %2,%0"
  773.   [(set_attr "type" "mulw")])
  774.  
  775. (define_insn "mulqi3"
  776.   [(set (match_operand:QI 0 "register_operand" "=d,d")
  777.     (mult:QI (match_operand:QI 1 "register_operand" "%0,0")
  778.          (match_operand:QI 2 "nonmemory_operand" "d,i")))]
  779.   ""
  780.   "@
  781.    mul.b %2,%0
  782.    mul.w %2,%0"
  783.   [(set_attr "type" "mulw,mulw")])
  784.  
  785. ;;- Divide instructions.
  786.  
  787. (define_insn "divdf3"
  788.   [(set (match_operand:DF 0 "register_operand" "=d")
  789.     (div:DF (match_operand:DF 1 "register_operand" "0")
  790.         (match_operand:DF 2 "register_operand" "d")))]
  791.   ""
  792.   "div.d %2,%0"
  793.   [(set_attr "type" "divd")])
  794.  
  795. (define_insn "divsf3"
  796.   [(set (match_operand:SF 0 "register_operand" "=d")
  797.     (div:SF (match_operand:SF 1 "register_operand" "0")
  798.         (match_operand:SF 2 "nonmemory_operand" "dF")))]
  799.   ""
  800.   "div.s %2,%0"
  801.   [(set_attr "type" "divs")])
  802.  
  803. (define_insn "divdi3"
  804.   [(set (match_operand:DI 0 "register_operand" "=d")
  805.     (div:DI (match_operand:DI 1 "register_operand" "0")
  806.         (match_operand:DI 2 "register_operand" "d")))]
  807.   ""
  808.   "div.l %2,%0"
  809.   [(set_attr "type" "divl")])
  810.  
  811. (define_expand "udivsi3"
  812.   [(set (match_dup 3)
  813.     (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
  814.    (set (match_dup 4)
  815.     (zero_extend:DI (match_operand:SI 2 "register_operand" "")))
  816.    (set (match_dup 3)
  817.     (div:DI (match_dup 3) (match_dup 4)))
  818.    (set (match_operand:SI 0 "register_operand" "")
  819.     (subreg:SI (match_dup 3) 0))]
  820.   ""
  821.   "operands[3] = gen_reg_rtx (DImode);
  822.    operands[4] = gen_reg_rtx (DImode); ")
  823.  
  824. (define_insn "udivdi3"
  825.   [(set (match_operand:DI 0 "register_operand" "=d")
  826.     (udiv:DI (match_operand:DI 1 "register_operand" "d")
  827.          (match_operand:DI 2 "register_operand" "d")))]
  828.   ""
  829.   "psh.l %2\;psh.l %1\;callq udiv64\;pop.l %0\;add.w #8,sp")
  830.  
  831. (define_insn "divsi3"
  832.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  833.     (div:SI (match_operand:SI 1 "register_operand" "0,0")
  834.         (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  835.   ""
  836.   "div.w %2,%0"
  837.   [(set_attr "type" "divw")])
  838.  
  839. (define_insn "divhi3"
  840.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  841.     (div:HI (match_operand:HI 1 "register_operand" "0,0")
  842.         (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  843.   ""
  844.   "div.h %2,%0"
  845.   [(set_attr "type" "divw")])
  846.  
  847. (define_insn "divqi3"
  848.   [(set (match_operand:QI 0 "register_operand" "=d")
  849.     (div:QI (match_operand:QI 1 "register_operand" "0")
  850.         (match_operand:QI 2 "register_operand" "d")))]
  851.   ""
  852.   "div.b %2,%0"
  853.   [(set_attr "type" "divw")])
  854.  
  855. ;;- Bit clear instructions.
  856.  
  857. (define_insn ""
  858.   [(set (match_operand:DI 0 "register_operand" "=d")
  859.     (and:DI (match_operand:DI 1 "register_operand" "%0")
  860.         (match_operand:DI 2 "" "")))]
  861.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
  862.    || (GET_CODE (operands[2]) == CONST_DOUBLE
  863.        && CONST_DOUBLE_HIGH (operands[2]) == -1)"
  864.   "and %2,%0")
  865.  
  866. (define_insn "anddi3"
  867.   [(set (match_operand:DI 0 "register_operand" "=d")
  868.     (and:DI (match_operand:DI 1 "register_operand" "%0")
  869.         (match_operand:DI 2 "register_operand" "d")))]
  870.   ""
  871.   "and %2,%0")
  872.  
  873. (define_insn "andsi3"
  874.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  875.     (and:SI (match_operand:SI 1 "register_operand" "%0,0")
  876.         (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  877.   ""
  878.   "and %2,%0")
  879.  
  880. (define_insn "andhi3"
  881.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  882.     (and:HI (match_operand:HI 1 "register_operand" "%0,0")
  883.         (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  884.   ""
  885.   "and %2,%0")
  886.  
  887. (define_insn "andqi3"
  888.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  889.     (and:QI (match_operand:QI 1 "register_operand" "%0,0")
  890.         (match_operand:QI 2 "nonmemory_operand" "di,ai")))]
  891.   ""
  892.   "and %2,%0")
  893.  
  894. ;;- Bit set instructions.
  895.  
  896. (define_insn ""
  897.   [(set (match_operand:DI 0 "register_operand" "=d")
  898.     (ior:DI (match_operand:DI 1 "register_operand" "%0")
  899.         (match_operand:DI 2 "" "")))]
  900.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0)
  901.    || (GET_CODE (operands[2]) == CONST_DOUBLE
  902.        && CONST_DOUBLE_HIGH (operands[2]) == 0)"
  903.   "or %2,%0")
  904.  
  905. (define_insn "iordi3"
  906.   [(set (match_operand:DI 0 "register_operand" "=d")
  907.     (ior:DI (match_operand:DI 1 "register_operand" "%0")
  908.         (match_operand:DI 2 "register_operand" "d")))]
  909.   ""
  910.   "or %2,%0")
  911.  
  912. (define_insn "iorsi3"
  913.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  914.     (ior:SI (match_operand:SI 1 "register_operand" "%0,0")
  915.         (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  916.   ""
  917.   "or %2,%0")
  918.  
  919. (define_insn "iorhi3"
  920.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  921.     (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
  922.         (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  923.   ""
  924.   "or %2,%0")
  925.  
  926. (define_insn "iorqi3"
  927.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  928.     (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
  929.         (match_operand:QI 2 "nonmemory_operand" "di,ai")))]
  930.   ""
  931.   "or %2,%0")
  932.  
  933. ;;- xor instructions.
  934.  
  935. (define_insn ""
  936.   [(set (match_operand:DI 0 "register_operand" "=d")
  937.     (xor:DI (match_operand:DI 1 "register_operand" "%0")
  938.         (match_operand:DI 2 "" "")))]
  939.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0)
  940.    || (GET_CODE (operands[2]) == CONST_DOUBLE
  941.        && CONST_DOUBLE_HIGH (operands[2]) == 0)"
  942.   "xor %2,%0")
  943.  
  944. (define_insn "xordi3"
  945.   [(set (match_operand:DI 0 "register_operand" "=d")
  946.     (xor:DI (match_operand:DI 1 "register_operand" "%0")
  947.         (match_operand:DI 2 "register_operand" "d")))]
  948.   ""
  949.   "xor %2,%0")
  950.  
  951. (define_insn "xorsi3"
  952.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  953.     (xor:SI (match_operand:SI 1 "register_operand" "%0,0")
  954.         (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  955.   ""
  956.   "xor %2,%0")
  957.  
  958. (define_insn "xorhi3"
  959.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  960.     (xor:HI (match_operand:HI 1 "register_operand" "%0,0")
  961.         (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  962.   ""
  963.   "xor %2,%0")
  964.  
  965. (define_insn "xorqi3"
  966.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  967.     (xor:QI (match_operand:QI 1 "register_operand" "%0,0")
  968.         (match_operand:QI 2 "nonmemory_operand" "di,ai")))]
  969.   ""
  970.   "xor %2,%0")
  971.  
  972. (define_insn "negdf2"
  973.   [(set (match_operand:DF 0 "register_operand" "=d")
  974.     (neg:DF (match_operand:DF 1 "register_operand" "d")))]
  975.   ""
  976.   "neg.d %1,%0"
  977.   [(set_attr "type" "addd")])
  978.  
  979. (define_insn "negsf2"
  980.   [(set (match_operand:SF 0 "register_operand" "=d")
  981.     (neg:SF (match_operand:SF 1 "register_operand" "d")))]
  982.   ""
  983.   "neg.s %1,%0"
  984.   [(set_attr "type" "adds")])
  985.  
  986. (define_insn "negdi2"
  987.   [(set (match_operand:DI 0 "register_operand" "=d")
  988.     (neg:DI (match_operand:DI 1 "register_operand" "d")))]
  989.   ""
  990.   "neg.l %1,%0")
  991.  
  992. (define_insn "negsi2"
  993.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  994.     (neg:SI (match_operand:SI 1 "register_operand" "d,a")))]
  995.   ""
  996.   "neg.w %1,%0")
  997.  
  998. (define_insn "neghi2"
  999.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  1000.     (neg:HI (match_operand:HI 1 "register_operand" "d,a")))]
  1001.   ""
  1002.   "neg.h %1,%0")
  1003.  
  1004. (define_insn "negqi2"
  1005.   [(set (match_operand:QI 0 "register_operand" "=d")
  1006.     (neg:QI (match_operand:QI 1 "register_operand" "d")))]
  1007.   ""
  1008.   "neg.b %1,%0")
  1009.  
  1010. (define_insn "one_cmpldi2"
  1011.   [(set (match_operand:DI 0 "register_operand" "=d")
  1012.     (not:DI (match_operand:DI 1 "register_operand" "d")))]
  1013.   ""
  1014.   "not %1,%0")
  1015.  
  1016. (define_insn "one_cmplsi2"
  1017.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  1018.     (not:SI (match_operand:SI 1 "register_operand" "d,a")))]
  1019.   ""
  1020.   "not %1,%0")
  1021.  
  1022. (define_insn "one_cmplhi2"
  1023.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  1024.     (not:HI (match_operand:HI 1 "register_operand" "d,a")))]
  1025.   ""
  1026.   "not %1,%0")
  1027.  
  1028. (define_insn "one_cmplqi2"
  1029.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  1030.     (not:QI (match_operand:QI 1 "register_operand" "d,a")))]
  1031.   ""
  1032.   "not %1,%0")
  1033.  
  1034. ;;- Shifts
  1035. ;;
  1036. ;; The extreme profusion of patterns here is due to the different-speed
  1037. ;; shifts on different machines, and the C1's lack of word shift S-register
  1038. ;; instructions.
  1039.  
  1040. ;; SImode
  1041.  
  1042. ;; Arithmetic left 1, 1 cycle on all machines via add
  1043.  
  1044. (define_insn ""
  1045.   [(set (match_operand:SI 0 "register_operand" "=r")
  1046.     (ashift:SI (match_operand:SI 1 "register_operand" "0")
  1047.            (const_int 1)))]
  1048.   ""
  1049.   "add.w %0,%0")
  1050.  
  1051. ;; C34 general shift is 1 cycle
  1052.  
  1053. (define_insn ""
  1054.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  1055.     (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
  1056.            (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  1057.   "TARGET_C34"
  1058.   "@
  1059.    shf.w %2,%0
  1060.    shf %2,%0"
  1061.   [(set_attr "type" "shfw,shfw")])
  1062.  
  1063. ;; else shift left 0..7 is 1 cycle if we use an A register
  1064.  
  1065. (define_insn ""
  1066.   [(set (match_operand:SI 0 "register_operand" "=a,?d")
  1067.     (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
  1068.            (match_operand:SI 2 "immediate_operand" "ai,di")))]
  1069.   "TARGET_C1 && INTVAL (operands[2]) < (unsigned) 8"
  1070.   "@
  1071.    shf %2,%0
  1072.    shf %2,%0"
  1073.   [(set_attr "type" "alu,shfl")])
  1074.  
  1075. (define_insn ""
  1076.   [(set (match_operand:SI 0 "register_operand" "=a,?d")
  1077.     (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
  1078.            (match_operand:SI 2 "immediate_operand" "ai,di")))]
  1079.   "INTVAL (operands[2]) < (unsigned) 8"
  1080.   "@
  1081.    shf %2,%0
  1082.    shf.w %2,%0"
  1083.   [(set_attr "type" "alu,shfw")])
  1084.  
  1085. ;; else general left shift
  1086.  
  1087. (define_insn ""
  1088.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  1089.     (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
  1090.            (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  1091.   "TARGET_C1"
  1092.   "@
  1093.    shf %2,%0
  1094.    shf %2,%0"
  1095.   [(set_attr "type" "shfl,shfw")])
  1096.  
  1097. (define_insn ""
  1098.   [(set (match_operand:SI 0 "register_operand" "=r")
  1099.     (ashift:SI (match_operand:SI 1 "register_operand" "0")
  1100.            (match_operand:SI 2 "const_int_operand" "i")))]
  1101.   "TARGET_C2 && INTVAL (operands[2]) < (unsigned) 32"
  1102.   "mul.w %z2,%0"
  1103.   [(set_attr "type" "mulw")])
  1104.  
  1105. (define_insn "ashlsi3"
  1106.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  1107.     (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
  1108.            (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  1109.   ""
  1110.   "@
  1111.    shf.w %2,%0
  1112.    shf %2,%0"
  1113.   [(set_attr "type" "shfw,shfw")])
  1114.  
  1115. ;; Logical right, general
  1116. ;; The hardware wants the negative of the shift count
  1117.  
  1118. (define_expand "lshrsi3"
  1119.   [(set (match_operand:SI 0 "register_operand" "")
  1120.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
  1121.              (neg:SI (match_operand:SI 2 "nonmemory_operand" ""))))]
  1122.   ""
  1123.   "operands[2] = negate_rtx (SImode, operands[2]);")
  1124.  
  1125. ;; C1 lacks word shift S reg
  1126.  
  1127. (define_insn ""
  1128.   [(set
  1129.     (match_operand:SI 0 "register_operand" "=a,?d")
  1130.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
  1131.          (neg:SI (match_operand:SI 2 "nonmemory_operand" "ai,di"))))]
  1132.   "TARGET_C1"
  1133.   "@
  1134.    shf %2,%0
  1135.    ld.u #0,%0\;shf %2,%0"
  1136.   [(set_attr "type" "shfw,shfl")])
  1137.  
  1138. ;; general case
  1139.  
  1140. (define_insn ""
  1141.   [(set
  1142.     (match_operand:SI 0 "register_operand" "=d,a")
  1143.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
  1144.          (neg:SI (match_operand:SI 2 "nonmemory_operand" "di,ai"))))]
  1145.   ""
  1146.   "@
  1147.    shf.w %2,%0
  1148.    shf %2,%0"
  1149.   [(set_attr "type" "shfw,shfw")])
  1150.  
  1151. ;; Patterns without neg produced by constant folding
  1152.  
  1153. (define_insn ""
  1154.   [(set
  1155.     (match_operand:SI 0 "register_operand" "=a,?d")
  1156.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
  1157.          (match_operand:SI 2 "immediate_operand" "i,i")))]
  1158.   "TARGET_C1"
  1159.   "@
  1160.    shf #%n2,%0
  1161.    ld.u #0,%0\;shf #%n2,%0"
  1162.   [(set_attr "type" "shfw,shfl")])
  1163.  
  1164. (define_insn ""
  1165.   [(set
  1166.     (match_operand:SI 0 "register_operand" "=d,a")
  1167.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
  1168.          (match_operand:SI 2 "immediate_operand" "i,i")))]
  1169.   ""
  1170.   "@
  1171.    shf.w #%n2,%0
  1172.    shf #%n2,%0"
  1173.   [(set_attr "type" "shfw,shfw")])
  1174.  
  1175. ;; Arithmetic right, general
  1176. ;; Sign-extend to 64 bits, then shift that.  Works for 0..32.
  1177.  
  1178. (define_expand "ashrsi3"
  1179.   [(set (match_operand:SI 0 "register_operand" "")
  1180.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
  1181.              (neg:SI (match_operand:SI 2 "nonmemory_operand" ""))))]
  1182.   ""
  1183.   "operands[2] = negate_rtx (SImode, operands[2]);")
  1184.  
  1185. (define_insn ""
  1186.   [(set (match_operand:SI 0 "register_operand" "=d,&d")
  1187.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,d")
  1188.              (neg:SI
  1189.               (match_operand:SI 2 "nonmemory_operand" "di,di"))))]
  1190.   ""
  1191.   "cvtw.l %1,%0\;shf %2,%0"
  1192.   [(set_attr "type" "shfl,shfl")])
  1193.  
  1194. (define_insn ""
  1195.   [(set (match_operand:SI 0 "register_operand" "=d")
  1196.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
  1197.              (match_operand:SI 2 "immediate_operand" "i")))]
  1198.   ""
  1199.   "cvtw.l %1,%0\;shf #%n2,%0"
  1200.   [(set_attr "type" "shfl")])
  1201.  
  1202. ;; DImode
  1203. ;; Arithmetic left, 1-cycle
  1204.  
  1205. (define_insn ""
  1206.   [(set (match_operand:DI 0 "register_operand" "=d")
  1207.     (ashift:DI (match_operand:DI 1 "register_operand" "0")
  1208.            (const_int 1)))]
  1209.   ""
  1210.   "add.l %0,%0")
  1211.  
  1212. ;; Arithmetic left, general
  1213.  
  1214. (define_insn "ashldi3"
  1215.   [(set (match_operand:DI 0 "register_operand" "=d")
  1216.     (ashift:DI (match_operand:DI 1 "register_operand" "0")
  1217.            (match_operand:SI 2 "nonmemory_operand" "di")))]
  1218.   ""
  1219.   "shf %2,%0"
  1220.   [(set_attr "type" "shfl")])
  1221.  
  1222. ;; Can omit zero- or sign-extend if shift is 32 or more.
  1223.  
  1224. (define_insn ""
  1225.   [(set (match_operand:DI 0 "register_operand" "=d")
  1226.     (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
  1227.            (match_operand:SI 2 "const_int_operand" "i")))]
  1228.   "INTVAL (operands[2]) >= 32"
  1229.   "shf %2,%0"
  1230.   [(set_attr "type" "shfl")])
  1231.  
  1232. (define_insn ""
  1233.   [(set (match_operand:DI 0 "register_operand" "=d")
  1234.     (ashift:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
  1235.            (match_operand:SI 2 "const_int_operand" "i")))]
  1236.   "INTVAL (operands[2]) >= 32"
  1237.   "shf %2,%0"
  1238.   [(set_attr "type" "shfl")])
  1239.  
  1240. ;; Logical right, general
  1241.  
  1242. (define_expand "lshrdi3"
  1243.   [(set (match_operand:DI 0 "register_operand" "")
  1244.     (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
  1245.              (neg:SI (match_operand:SI 2 "nonmemory_operand" ""))))]
  1246.   ""
  1247.   "operands[2] = negate_rtx (SImode, operands[2]);")
  1248.  
  1249. (define_insn ""
  1250.   [(set (match_operand:DI 0 "register_operand" "=d")
  1251.     (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
  1252.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "di"))))]
  1253.   ""
  1254.   "shf %2,%0"
  1255.   [(set_attr "type" "shfl")])
  1256.  
  1257. (define_insn ""
  1258.   [(set (match_operand:DI 0 "register_operand" "=d")
  1259.     (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
  1260.              (match_operand:SI 2 "immediate_operand" "i")))]
  1261.   ""
  1262.   "shf #%n2,%0"
  1263.   [(set_attr "type" "shfl")])
  1264.  
  1265. ;; Arithmetic right, general
  1266. ;; Use
  1267. ;;     ((a >> b) ^ signbit) - signbit
  1268. ;; where signbit is (1 << 63) >> b
  1269. ;; Works for 0..63.  Does not work for 64; unfortunate but legal.
  1270.  
  1271. (define_expand "ashrdi3"
  1272.   [(set (match_operand:DI 0 "register_operand" "")
  1273.     (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
  1274.              (neg:SI (match_operand:SI 2 "nonmemory_operand" ""))))
  1275.    (set (match_dup 3) (lshiftrt:DI (match_dup 3) (neg:SI (match_dup 2))))
  1276.    (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 3)))
  1277.    (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 3)))]
  1278.   ""
  1279.   "
  1280. {
  1281.   if (GET_CODE (operands[2]) == CONST_INT)
  1282.     switch (INTVAL (operands[2]))
  1283.       {
  1284.       case 32:
  1285.     emit_insn (gen_ashrdi3_32 (operands[0], operands[1]));
  1286.     DONE;
  1287.       }
  1288.  
  1289.   operands[2] = negate_rtx (SImode, operands[2]);
  1290.   operands[3] = force_reg (DImode, immed_double_const (0, 1 << 31, DImode));
  1291. }")
  1292.  
  1293. ;; Arithmetic right 32, a common case that can save a couple of insns.
  1294.  
  1295. (define_expand "ashrdi3_32"
  1296.   [(set (match_operand:DI 0 "register_operand" "")
  1297.     (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
  1298.              (const_int 32)))
  1299.    (set (match_dup 0)
  1300.     (sign_extend:DI (subreg:SI (match_dup 0) 0)))]
  1301.   ""
  1302.   "")
  1303.  
  1304. ;; __builtin instructions
  1305.  
  1306. (define_insn "sqrtdf2"
  1307.   [(set (match_operand:DF 0 "register_operand" "=d")
  1308.     (sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
  1309.   "! TARGET_C1 && flag_fast_math"
  1310.   "sqrt.d %0"
  1311.   [(set_attr "type" "divd")])
  1312.  
  1313. (define_insn "sqrtsf2"
  1314.   [(set (match_operand:SF 0 "register_operand" "=d")
  1315.     (sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
  1316.   "! TARGET_C1 && flag_fast_math"
  1317.   "sqrt.s %0"
  1318.   [(set_attr "type" "divs")])
  1319.  
  1320. (define_insn "sindf2"
  1321.   [(set (match_operand:DF 0 "register_operand" "=d")
  1322.     (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 1))]
  1323.   "! TARGET_C1 && flag_fast_math"
  1324.   "sin.d %0")
  1325.  
  1326. (define_insn "sinsf2"
  1327.   [(set (match_operand:SF 0 "register_operand" "=d")
  1328.     (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 1))]
  1329.   "! TARGET_C1 && flag_fast_math"
  1330.   "sin.s %0")
  1331.  
  1332. (define_insn "cosdf2"
  1333.   [(set (match_operand:DF 0 "register_operand" "=d")
  1334.     (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 2))]
  1335.   "! TARGET_C1 && flag_fast_math"
  1336.   "cos.d %0")
  1337.  
  1338. (define_insn "cossf2"
  1339.   [(set (match_operand:SF 0 "register_operand" "=d")
  1340.     (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 2))]
  1341.   "! TARGET_C1 && flag_fast_math"
  1342.   "cos.s %0")
  1343.  
  1344. (define_insn "ftruncdf2"
  1345.   [(set (match_operand:DF 0 "register_operand" "=d")
  1346.     (fix:DF (match_operand:DF 1 "register_operand" "d")))]
  1347.   "! TARGET_C1"
  1348.   "frint.d %1,%0"
  1349.   [(set_attr "type" "cvtd")])
  1350.  
  1351. (define_insn "ftruncsf2"
  1352.   [(set (match_operand:SF 0 "register_operand" "=d")
  1353.     (fix:SF (match_operand:SF 1 "register_operand" "d")))]
  1354.   "! TARGET_C1"
  1355.   "frint.s %1,%0"
  1356.   [(set_attr "type" "cvts")])
  1357.  
  1358. (define_insn ""
  1359.   [(set (match_operand:SI 0 "register_operand" "=d")
  1360.     (minus:SI (ffs:SI (match_operand:SI 1 "register_operand" "d"))
  1361.           (const_int 1)))]
  1362.   ""
  1363.   "tzc %1,%0\;le.w #32,%0\;jbrs.f L0%=\;ld.w #-1,%0\\nL0%=:")
  1364.  
  1365. (define_expand "ffssi2"
  1366.   [(set (match_operand:SI 0 "register_operand" "=d")
  1367.     (minus:SI (ffs:SI (match_operand:SI 1 "register_operand" "d"))
  1368.           (const_int 1)))
  1369.    (set (match_dup 0)
  1370.     (plus:SI (match_dup 0)
  1371.          (const_int 1)))]
  1372.   ""
  1373.   "")
  1374.  
  1375. (define_insn "abssf2"
  1376.   [(set (match_operand:SF 0 "register_operand" "=d")
  1377.     (abs:SF (match_operand:SF 1 "register_operand" "0")))]
  1378.   ""
  1379.   "and #0x7fffffff,%0")
  1380.  
  1381. (define_expand "absdf2"
  1382.   [(set (subreg:DI (match_operand:DF 0 "register_operand" "=d") 0)
  1383.     (and:DI (subreg:DI (match_operand:DF 1 "register_operand" "d") 0)
  1384.         (match_dup 2)))]
  1385.   ""
  1386.   "operands[2] = force_reg (DImode,
  1387.                             immed_double_const (-1, 0x7fffffff, DImode));")
  1388.  
  1389. ;;- Compares
  1390.  
  1391. (define_insn "cmpdi"
  1392.   [(set (cc0)
  1393.     (compare (match_operand:DI 0 "register_operand" "d")
  1394.          (match_operand:DI 1 "register_operand" "d")))]
  1395.   ""
  1396.   "* return output_cmp (operands[0], operands[1], 'l');")
  1397.  
  1398. (define_insn ""
  1399.   [(set (cc0) (match_operand:DI 0 "register_operand" "d"))
  1400.    (clobber (match_scratch:DI 1 "=d"))]
  1401.   "next_insn_tests_no_inequality (insn)"
  1402.   "* return output_cmp (operands[0], operands[1], 'L');")
  1403.  
  1404. (define_insn "cmpsi"
  1405.   [(set (cc0)
  1406.     (compare (match_operand:SI 0 "register_operand" "d,a")
  1407.          (match_operand:SI 1 "nonmemory_operand" "di,ai")))]
  1408.   ""
  1409.   "* return output_cmp (operands[0], operands[1], 'w');")
  1410.  
  1411. (define_insn "cmphi"
  1412.   [(set (cc0)
  1413.     (compare (match_operand:HI 0 "register_operand" "d,a")
  1414.          (match_operand:HI 1 "nonmemory_operand" "di,ai")))]
  1415.   ""
  1416.   "* return output_cmp (operands[0], operands[1], 'h');")
  1417.  
  1418. ; cmpqi is intentionally omitted.
  1419. ;
  1420. ; gcc will sign-extend or zero-extend the operands to the next
  1421. ; wider mode, HImode.
  1422. ;
  1423. ; For reg .cmp. constant, we just go with the halfword immediate
  1424. ; instruction.  Perhaps the widening insn can be cse'd or combined away.
  1425. ; If not, we're still as good as loading a byte constant into a register
  1426. ; to do a reg-reg byte compare.
  1427. ;
  1428. ; The following patterns pick up cases that can use reg .cmp. reg after all.
  1429.  
  1430. (define_insn ""
  1431.   [(set (cc0)
  1432.     (compare
  1433.      (sign_extend:HI (match_operand:QI 0 "register_operand" "d"))
  1434.      (sign_extend:HI (match_operand:QI 1 "register_operand" "d"))))]
  1435.   ""
  1436.   "* return output_cmp (operands[0], operands[1], 'b');")
  1437.  
  1438. (define_insn ""
  1439.   [(set (cc0)
  1440.     (compare
  1441.      (ashift:HI (subreg:HI (match_operand:QI 0 "register_operand" "d") 0)
  1442.             (const_int 8))
  1443.      (ashift:HI (subreg:HI (match_operand:QI 1 "register_operand" "d") 0)
  1444.             (const_int 8))))]
  1445.   ""
  1446.   "* return output_cmp (operands[0], operands[1], 'b');")
  1447.  
  1448. (define_insn ""
  1449.   [(set (cc0)
  1450.     (compare (match_operand:QI 0 "register_operand" "d")
  1451.          (match_operand:QI 1 "register_operand" "d")))]
  1452.   ""
  1453.   "* return output_cmp (operands[0], operands[1], 'b');")
  1454.  
  1455. (define_insn ""
  1456.   [(set (cc0) (match_operand:QI 0 "register_operand" "d,a"))
  1457.    (clobber (match_scratch:QI 1 "=d,a"))]
  1458.   "next_insn_tests_no_inequality (insn)"
  1459.   "* return output_cmp (operands[0], operands[1], 'B');")
  1460.  
  1461. (define_insn ""
  1462.   [(set (cc0) (subreg (match_operand:QI 0 "register_operand" "d,a") 0))
  1463.    (clobber (match_scratch:QI 1 "=d,a"))]
  1464.   "next_insn_tests_no_inequality (insn)"
  1465.   "* return output_cmp (operands[0], operands[1], 'B');")
  1466.  
  1467. (define_insn ""
  1468.   [(set (cc0)
  1469.     (zero_extend (subreg (match_operand:QI 0 "register_operand" "d,a") 0)))
  1470.    (clobber (match_scratch:QI 1 "=d,a"))]
  1471.   "next_insn_tests_no_inequality (insn)"
  1472.   "* return output_cmp (operands[0], operands[1], 'B');")
  1473.  
  1474. (define_insn "cmpdf"
  1475.   [(set (cc0)
  1476.     (compare (match_operand:DF 0 "register_operand" "d")
  1477.          (match_operand:DF 1 "register_operand" "d")))]
  1478.   ""
  1479.   "* return output_cmp (operands[0], operands[1], 'd');")
  1480.  
  1481. (define_insn "cmpsf"
  1482.   [(set (cc0)
  1483.     (compare (match_operand:SF 0 "register_operand" "d")
  1484.          (match_operand:SF 1 "nonmemory_cmpsf_operand" "dF")))]
  1485.   ""
  1486.   "* return output_cmp (operands[0], operands[1], 's');")
  1487.  
  1488. ;; decrement-and-set-cc0 insns.
  1489. ;;
  1490. ;; The most important case where we can use the carry bit from an
  1491. ;; arithmetic insn to eliminate a redundant compare is the decrement in
  1492. ;; constructs like while (n--) and while (--n >= 0).  
  1493. ;;
  1494. ;; We do it with combine patterns instead of NOTICE_UPDATE_CC because
  1495. ;; the decrement needs to be kept at the end of the block during scheduling.
  1496. ;; 
  1497. ;; These patterns must have memory alternatives because reload refuses
  1498. ;; to do output reloads for an insn that sets cc0 (since it does not
  1499. ;; want to clobber cc0 with its moves).  Convex moves do not clobber
  1500. ;; cc0, but there is no evident way to get reload to know that.
  1501.  
  1502. (define_insn ""
  1503.   [(set (cc0)
  1504.     (match_operand:SI 0 "register_operand" "+r,*m"))
  1505.    (set (match_dup 0)
  1506.     (plus:SI (match_dup 0)
  1507.          (const_int -1)))]
  1508.   "next_insn_tests_no_inequality (insn)"
  1509.   "*
  1510. {
  1511.   if (which_alternative == 0)
  1512.     {
  1513.       output_cmp (operands[0], constm1_rtx, 'W');
  1514.       return \"add.w #-1,%0\";
  1515.     }
  1516.   else
  1517.     {
  1518.       output_cmp (gen_rtx (REG, SImode, 7), constm1_rtx, 'W');
  1519.       return \"psh.w s7\;ld.w %0,s7\;add.w #-1,s7\;st.w s7,%0\;pop.w s7\";
  1520.     }
  1521. }")
  1522.      
  1523. (define_insn ""
  1524.   [(set (cc0)
  1525.     (plus:SI (match_operand:SI 0 "register_operand" "+r,*m")
  1526.          (const_int -1)))
  1527.    (set (match_dup 0)
  1528.     (plus:SI (match_dup 0)
  1529.          (const_int -1)))]
  1530.   "find_reg_note (next_cc0_user (insn), REG_NONNEG, 0)"
  1531.   "*
  1532. {
  1533.   if (which_alternative == 0)
  1534.     {
  1535.       output_cmp (operands[0], const0_rtx, 'W');
  1536.       return \"add.w #-1,%0\";
  1537.     }
  1538.   else
  1539.     {
  1540.       output_cmp (gen_rtx (REG, SImode, 7), const0_rtx, 'W');
  1541.       return \"psh.w s7\;ld.w %0,s7\;add.w #-1,s7\;st.w s7,%0\;pop.w s7\";
  1542.     }
  1543. }")
  1544.  
  1545. (define_insn ""
  1546.   [(set (cc0)
  1547.     (match_operand:HI 0 "register_operand" "+r,*m"))
  1548.    (set (match_dup 0)
  1549.     (plus:HI (match_dup 0)
  1550.          (const_int -1)))]
  1551.   "next_insn_tests_no_inequality (insn)"
  1552.   "*
  1553. {
  1554.   if (which_alternative == 0)
  1555.     {
  1556.       output_cmp (operands[0], constm1_rtx, 'W');
  1557.       return \"add.w #-1,%0\";
  1558.     }
  1559.   else
  1560.     {
  1561.       output_cmp (gen_rtx (REG, HImode, 7), constm1_rtx, 'W');
  1562.       return \"psh.w s7\;ld.h %0,s7\;add.h #-1,s7\;st.h s7,%0\;pop.w s7\";
  1563.     }
  1564. }")
  1565.      
  1566. (define_insn ""
  1567.   [(set (cc0)
  1568.     (plus:HI (match_operand:HI 0 "register_operand" "+r,*m")
  1569.          (const_int -1)))
  1570.    (set (match_dup 0)
  1571.     (plus:HI (match_dup 0)
  1572.          (const_int -1)))]
  1573.   "find_reg_note (next_cc0_user (insn), REG_NONNEG, 0)"
  1574.   "*
  1575. {
  1576.   if (which_alternative == 0)
  1577.     {
  1578.       output_cmp (operands[0], const0_rtx, 'W');
  1579.       return \"add.w #-1,%0\";
  1580.     }
  1581.   else
  1582.     {
  1583.       output_cmp (gen_rtx (REG, HImode, 7), const0_rtx, 'W');
  1584.       return \"psh.w s7\;ld.h %0,s7\;add.h #-1,s7\;st.h s7,%0\;pop.w s7\";
  1585.     }
  1586. }")
  1587.  
  1588. ;;- Jumps
  1589.  
  1590. (define_insn "jump"
  1591.   [(set (pc)
  1592.     (label_ref (match_operand 0 "" "")))]
  1593.   ""
  1594.   "jbr %l0")
  1595.  
  1596. (define_insn "beq"
  1597.   [(set (pc)
  1598.     (if_then_else (eq (cc0)
  1599.               (const_int 0))
  1600.               (label_ref (match_operand 0 "" ""))
  1601.               (pc)))]
  1602.   ""
  1603.   "* return output_condjump (operands[0], \"eq\", 't'); ")
  1604.  
  1605. (define_insn "bne"
  1606.   [(set (pc)
  1607.     (if_then_else (ne (cc0)
  1608.               (const_int 0))
  1609.               (label_ref (match_operand 0 "" ""))
  1610.               (pc)))]
  1611.   ""
  1612.   "* return output_condjump (operands[0], \"eq\", 'f'); ")
  1613.  
  1614. (define_insn "bgt"
  1615.   [(set (pc)
  1616.     (if_then_else (gt (cc0)
  1617.               (const_int 0))
  1618.               (label_ref (match_operand 0 "" ""))
  1619.               (pc)))]
  1620.   ""
  1621.   "* return output_condjump (operands[0], \"le\", 'f'); ")
  1622.  
  1623. (define_insn "bgtu"
  1624.   [(set (pc)
  1625.     (if_then_else (gtu (cc0)
  1626.                (const_int 0))
  1627.               (label_ref (match_operand 0 "" ""))
  1628.               (pc)))]
  1629.   ""
  1630.   "* return output_condjump (operands[0], \"leu\", 'f'); ")
  1631.  
  1632. (define_insn "blt"
  1633.   [(set (pc)
  1634.     (if_then_else (lt (cc0)
  1635.               (const_int 0))
  1636.               (label_ref (match_operand 0 "" ""))
  1637.               (pc)))]
  1638.   ""
  1639.   "* return output_condjump (operands[0], \"lt\", 't'); ")
  1640.  
  1641. (define_insn "bltu"
  1642.   [(set (pc)
  1643.     (if_then_else (ltu (cc0)
  1644.                (const_int 0))
  1645.               (label_ref (match_operand 0 "" ""))
  1646.               (pc)))]
  1647.   ""
  1648.   "* return output_condjump (operands[0], \"ltu\", 't'); ")
  1649.  
  1650. (define_insn "bge"
  1651.   [(set (pc)
  1652.     (if_then_else (ge (cc0)
  1653.               (const_int 0))
  1654.               (label_ref (match_operand 0 "" ""))
  1655.               (pc)))]
  1656.   ""
  1657.   "* return output_condjump (operands[0], \"lt\", 'f'); ")
  1658.  
  1659. (define_insn "bgeu"
  1660.   [(set (pc)
  1661.     (if_then_else (geu (cc0)
  1662.                (const_int 0))
  1663.               (label_ref (match_operand 0 "" ""))
  1664.               (pc)))]
  1665.   ""
  1666.   "* return output_condjump (operands[0], \"ltu\", 'f'); ")
  1667.  
  1668. (define_insn "ble"
  1669.   [(set (pc)
  1670.     (if_then_else (le (cc0)
  1671.               (const_int 0))
  1672.               (label_ref (match_operand 0 "" ""))
  1673.               (pc)))]
  1674.   ""
  1675.   "* return output_condjump (operands[0], \"le\", 't'); ")
  1676.  
  1677. (define_insn "bleu"
  1678.   [(set (pc)
  1679.     (if_then_else (leu (cc0)
  1680.                (const_int 0))
  1681.               (label_ref (match_operand 0 "" ""))
  1682.               (pc)))]
  1683.   ""
  1684.   "* return output_condjump (operands[0], \"leu\", 't'); ")
  1685.  
  1686. (define_insn ""
  1687.   [(set (pc)
  1688.     (if_then_else (eq (cc0)
  1689.               (const_int 0))
  1690.               (pc)
  1691.               (label_ref (match_operand 0 "" ""))))]
  1692.   ""
  1693.   "* return output_condjump (operands[0], \"eq\", 'f'); ")
  1694.  
  1695. (define_insn ""
  1696.   [(set (pc)
  1697.     (if_then_else (ne (cc0)
  1698.               (const_int 0))
  1699.               (pc)
  1700.               (label_ref (match_operand 0 "" ""))))]
  1701.   ""
  1702.   "* return output_condjump (operands[0], \"eq\", 't'); ")
  1703.  
  1704. (define_insn ""
  1705.   [(set (pc)
  1706.     (if_then_else (gt (cc0)
  1707.               (const_int 0))
  1708.               (pc)
  1709.               (label_ref (match_operand 0 "" ""))))]
  1710.   ""
  1711.   "* return output_condjump (operands[0], \"le\", 't'); ")
  1712.  
  1713. (define_insn ""
  1714.   [(set (pc)
  1715.     (if_then_else (gtu (cc0)
  1716.                (const_int 0))
  1717.               (pc)
  1718.               (label_ref (match_operand 0 "" ""))))]
  1719.   ""
  1720.   "* return output_condjump (operands[0], \"leu\", 't'); ")
  1721.  
  1722. (define_insn ""
  1723.   [(set (pc)
  1724.     (if_then_else (lt (cc0)
  1725.               (const_int 0))
  1726.               (pc)
  1727.               (label_ref (match_operand 0 "" ""))))]
  1728.   ""
  1729.   "* return output_condjump (operands[0], \"lt\", 'f'); ")
  1730.  
  1731. (define_insn ""
  1732.   [(set (pc)
  1733.     (if_then_else (ltu (cc0)
  1734.                (const_int 0))
  1735.               (pc)
  1736.               (label_ref (match_operand 0 "" ""))))]
  1737.   ""
  1738.   "* return output_condjump (operands[0], \"ltu\", 'f'); ")
  1739.  
  1740. (define_insn ""
  1741.   [(set (pc)
  1742.     (if_then_else (ge (cc0)
  1743.               (const_int 0))
  1744.               (pc)
  1745.               (label_ref (match_operand 0 "" ""))))]
  1746.   ""
  1747.   "* return output_condjump (operands[0], \"lt\", 't'); ")
  1748.  
  1749. (define_insn ""
  1750.   [(set (pc)
  1751.     (if_then_else (geu (cc0)
  1752.                (const_int 0))
  1753.               (pc)
  1754.               (label_ref (match_operand 0 "" ""))))]
  1755.   ""
  1756.   "* return output_condjump (operands[0], \"ltu\", 't'); ")
  1757.  
  1758. (define_insn ""
  1759.   [(set (pc)
  1760.     (if_then_else (le (cc0)
  1761.               (const_int 0))
  1762.               (pc)
  1763.               (label_ref (match_operand 0 "" ""))))]
  1764.   ""
  1765.   "* return output_condjump (operands[0], \"le\", 'f'); ")
  1766.  
  1767. (define_insn ""
  1768.   [(set (pc)
  1769.     (if_then_else (leu (cc0)
  1770.                (const_int 0))
  1771.               (pc)
  1772.               (label_ref (match_operand 0 "" ""))))]
  1773.   ""
  1774.   "* return output_condjump (operands[0], \"leu\", 'f'); ")
  1775.  
  1776. ;;- Calls
  1777.  
  1778. (define_expand "call_pop"
  1779.   [(parallel [(call (match_operand:QI 0 "memory_operand" "m")
  1780.             (match_operand:SI 1 "const_int_operand" "i"))
  1781.           (match_operand:SI 2 "const_int_operand" "i")
  1782.           (match_operand:SI 3 "const_int_operand" "i")
  1783.           (reg:SI 8)])]
  1784.   ""
  1785.   "")
  1786.  
  1787. (define_insn ""
  1788.   [(call (match_operand:QI 0 "memory_operand" "m")
  1789.      (match_operand:SI 1 "const_int_operand" "i"))
  1790.    (match_operand:SI 2 "const_int_operand" "i")
  1791.    (match_operand:SI 3 "const_int_operand" "i")
  1792.    (match_operand:SI 4 "" "")]
  1793.   ""
  1794.   "* return output_call (insn, &operands[0]);")
  1795.  
  1796. (define_expand "call_value_pop"
  1797.   [(parallel [(set (match_operand 0 "" "=g")
  1798.            (call (match_operand:QI 1 "memory_operand" "m")
  1799.              (match_operand:SI 2 "const_int_operand" "i")))
  1800.           (match_operand:SI 3 "const_int_operand" "i")
  1801.           (match_operand:SI 4 "const_int_operand" "i")
  1802.           (reg:SI 8)])]
  1803.   ""
  1804.   "")
  1805.  
  1806. (define_insn ""
  1807.   [(set (match_operand 0 "" "=g")
  1808.     (call (match_operand:QI 1 "memory_operand" "m")
  1809.           (match_operand:SI 2 "const_int_operand" "i")))
  1810.    (match_operand:SI 3 "const_int_operand" "i")
  1811.    (match_operand:SI 4 "const_int_operand" "i")
  1812.    (match_operand:SI 5 "" "")]
  1813.   ""
  1814.   "* return output_call (insn, &operands[1]); ")
  1815.  
  1816. ;; Call subroutine returning any type.
  1817.  
  1818. (define_expand "untyped_call"
  1819.   [(parallel [(call (match_operand 0 "" "")
  1820.                   (const_int 0))
  1821.             (match_operand 1 "" "")
  1822.             (match_operand 2 "" "")])]
  1823.   ""
  1824.   "
  1825. {
  1826.   int i;
  1827.  
  1828.   emit_call_insn (gen_call_pop (operands[0], const0_rtx,
  1829.                 const0_rtx, const0_rtx));
  1830.  
  1831.   for (i = 0; i < XVECLEN (operands[2], 0); i++)
  1832.     {
  1833.       rtx set = XVECEXP (operands[2], 0, i);
  1834.       emit_move_insn (SET_DEST (set), SET_SRC (set));
  1835.     }
  1836.  
  1837.   /* The optimizer does not know that the call sets the function value
  1838.      registers we stored in the result block.  We avoid problems by
  1839.      claiming that all hard registers are used and clobbered at this
  1840.      point.  */
  1841.   emit_insn (gen_blockage ());
  1842.  
  1843.   DONE;
  1844. }")
  1845.  
  1846. ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
  1847. ;; all of memory.  This blocks insns from being moved across this point.
  1848.  
  1849. (define_insn "blockage"
  1850.   [(unspec_volatile [(const_int 0)] 0)]
  1851.   ""
  1852.   "")
  1853.  
  1854. (define_expand "return"
  1855.   [(return)]
  1856.   ""
  1857.   " replace_arg_pushes (); ")
  1858.  
  1859. (define_insn ""
  1860.   [(return)]
  1861.   ""
  1862.   "rtn")
  1863.  
  1864. (define_expand "prologue"
  1865.   [(const_int 0)]
  1866.   ""
  1867.   "
  1868. {
  1869.   emit_ap_optimizations ();
  1870.   DONE; 
  1871. }")
  1872.  
  1873. (define_insn "tablejump"
  1874.   [(set (pc) (match_operand:SI 0 "address_operand" "p"))
  1875.    (use (label_ref (match_operand 1 "" "")))]
  1876.   ""
  1877.   "jmp %a0")
  1878.  
  1879. (define_insn "indirect_jump"
  1880.   [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
  1881.   ""
  1882.   "jmp %a0")
  1883.