home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Compilers⁄Interps / GCC-2.3.3r12 / Sources-Targets / convex.md < prev    next >
Encoding:
Text File  |  1993-02-05  |  36.1 KB  |  1,352 lines  |  [TEXT/MPS ]

  1. ;;- Machine description for GNU compiler
  2. ;;- Convex Version
  3. ;;   Copyright (C) 1991 Free Software Foundation, Inc.
  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. ;; Scheduling defs
  22. ;;
  23. ;; Insn scheduling is not used at present.  Scheduling increases
  24. ;; register pressure so much that many spills are generated
  25. ;; even for very small functions.
  26.  
  27. ;; Compares
  28.  
  29. (define_insn "tstsi"
  30.   [(set (cc0)
  31.     (match_operand:SI 0 "register_operand" "r"))]
  32.   ""
  33.   "* return set_cmp (operands[0], const0_rtx, 'w');")
  34.  
  35. (define_insn "tsthi"
  36.   [(set (cc0)
  37.     (match_operand:HI 0 "register_operand" "r"))]
  38.   ""
  39.   "* return set_cmp (operands[0], const0_rtx, 'h');")
  40.  
  41. (define_expand "tstqi"
  42.   [(set (match_dup 1)
  43.     (sign_extend:SI (match_operand:QI 0 "register_operand" "r")))
  44.    (set (cc0)
  45.     (match_dup 1))]
  46.   ""
  47.   "operands[1] = gen_reg_rtx (SImode);")
  48.  
  49. (define_expand "tstdi"
  50.   [(parallel [(set (cc0) (match_operand:DI 0 "register_operand" "d"))
  51.           (use (match_dup 1))])]
  52.   ""
  53.   "operands[1] = force_reg (DImode, const0_rtx);")
  54.  
  55. (define_insn ""
  56.   [(set (cc0) (match_operand:DI 0 "register_operand" "d"))
  57.    (use (match_operand:DI 1 "register_operand" "d"))]
  58.   ""
  59.   "* return set_cmp (operands[0], operands[1], 'l');")
  60.  
  61. (define_expand "tstdf"
  62.   [(set (cc0)
  63.     (compare (match_operand:DF 0 "register_operand" "d")
  64.          (match_dup 1)))]
  65.   ""
  66.   "operands[1] = force_reg (DFmode, CONST0_RTX (DFmode));")
  67.  
  68. (define_insn "tstsf"
  69.   [(set (cc0)
  70.     (match_operand:SF 0 "register_operand" "d"))]
  71.   ""
  72.   "* return set_cmp (operands[0], CONST0_RTX (SFmode), 's');")
  73.  
  74. (define_insn "cmpsi"
  75.   [(set (cc0)
  76.     (compare (match_operand:SI 0 "register_operand" "d,a,i,r")
  77.          (match_operand:SI 1 "nonmemory_operand" "d,a,r,i")))]
  78.   ""
  79.   "* return set_cmp (operands[0], operands[1], 'w');")
  80.  
  81. (define_insn "cmphi"
  82.   [(set (cc0)
  83.     (compare (match_operand:HI 0 "register_operand" "d,a,r,i")
  84.          (match_operand:HI 1 "nonmemory_operand" "d,a,i,r")))]
  85.   ""
  86.   "* return set_cmp (operands[0], operands[1], 'h');")
  87.  
  88. (define_insn "cmpqi"
  89.   [(set (cc0)
  90.     (compare (match_operand:QI 0 "register_operand" "d")
  91.          (match_operand:QI 1 "register_operand" "d")))]
  92.   ""
  93.   "* return set_cmp (operands[0], operands[1], 'b');")
  94.  
  95. (define_insn "cmpdi"
  96.   [(set (cc0)
  97.     (compare (match_operand:DI 0 "register_operand" "d")
  98.          (match_operand:DI 1 "register_operand" "d")))]
  99.   ""
  100.   "* return set_cmp (operands[0], operands[1], 'l');")
  101.  
  102. (define_insn "cmpdf"
  103.   [(set (cc0)
  104.     (compare (match_operand:DF 0 "register_operand" "d")
  105.          (match_operand:DF 1 "register_operand" "d")))]
  106.   ""
  107.   "* return set_cmp (operands[0], operands[1], 'd');")
  108.  
  109. (define_insn "cmpsf"
  110.   [(set (cc0)
  111.     (compare (match_operand:SF 0 "nonmemory_operand" "dF,d")
  112.          (match_operand:SF 1 "nonmemory_operand" "d,F")))]
  113.   ""
  114.   "* return set_cmp (operands[0], operands[1], 's');")
  115.  
  116. ;; Moves
  117.  
  118. ;(define_insn "movtf"
  119. ;  [(set (match_operand:TF 0 "general_operand" "=g,d")
  120. ;    (match_operand:TF 1 "general_operand" "d,g"))]
  121. ;  ""
  122. ;  "*
  123. ;{
  124. ;  rtx opaddr = 0;
  125. ;  rtx xoperands[4];
  126. ;  xoperands[0] = operands[0];
  127. ;  xoperands[2] = operands[1];
  128. ;
  129. ;  if (REG_P (operands[0]))
  130. ;    xoperands[1] = gen_rtx (REG, TFmode, REGNO (operands[0]) + 1);
  131. ;  else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  132. ;    xoperands[1] = 0;
  133. ;  else if (offsettable_memref_p (operands[0]))
  134. ;    xoperands[1] = adj_offsettable_operand (operands[0], 8);
  135. ;  else
  136. ;    {
  137. ;      opaddr = XEXP (operands[0], 0);
  138. ;      xoperands[0] = gen_rtx (MEM, TFmode, gen_rtx (REG, SImode, 13));
  139. ;      xoperands[1] = adj_offsettable_operand (xoperands[0], 8);
  140. ;    }
  141. ;
  142. ;  if (REG_P (operands[1]))
  143. ;    xoperands[3] = gen_rtx (REG, TFmode, REGNO (operands[1]) + 1);
  144. ;  else if (offsettable_memref_p (operands[1]))
  145. ;    xoperands[3] = adj_offsettable_operand (operands[1], 8);
  146. ;  else
  147. ;    {
  148. ;      opaddr = XEXP (operands[1], 0);
  149. ;      xoperands[2] = gen_rtx (MEM, TFmode, gen_rtx (REG, SImode, 13));
  150. ;      xoperands[3] = adj_offsettable_operand (xoperands[2], 8);
  151. ;    }
  152. ;
  153. ;  if (opaddr)
  154. ;    output_asm_insn (\"psh.w a5\;ld.w %0,a5\", &opaddr);
  155. ;  if (push_operand (operands[0], TFmode))
  156. ;    output_asm_insn (\"psh.l %3\;psh.l %2\", xoperands);
  157. ;  else if (GET_CODE (operands[0]) == MEM)
  158. ;    output_asm_insn (\"st.l %2,%0\;st.l %3,%1\", xoperands);
  159. ;  else if (GET_CODE (operands[1]) == REG)
  160. ;    output_asm_insn (\"mov %2,%0\;mov %3,%1\", xoperands);
  161. ;  else
  162. ;    output_asm_insn (\"ld.l %2,%0\;ld.l %3,%1\", xoperands);
  163. ;  if (opaddr)
  164. ;    output_asm_insn (\"pop.w a5\");
  165. ;  return \"\";
  166. ;}")
  167.  
  168. (define_insn "movdf"
  169.   [(set (match_operand:DF 0 "general_operand" "=g,d")
  170.     (match_operand:DF 1 "general_operand" "d,dmG"))]
  171.   ""
  172.   "*
  173. {
  174.   if (push_operand (operands[0], DFmode))
  175.     return \"psh.l %1\";
  176.   else if (GET_CODE (operands[0]) == MEM)
  177.     return \"st.l %1,%0\";
  178.   else if (GET_CODE (operands[1]) == REG)
  179.     return \"mov %1,%0\";
  180.   else if (GET_CODE (operands[1]) == CONST_DOUBLE && LD_D_P (operands[1]))
  181.     {
  182.       operands[1] = gen_rtx (CONST_INT, VOIDmode,
  183.                  const_double_high_int (operands[1]));
  184.       return \"ld.d %1,%0\";
  185.     }
  186.   else if (GET_CODE (operands[1]) == CONST_DOUBLE && LD_L_P (operands[1]))
  187.     {
  188.       operands[1] = gen_rtx (CONST_INT, VOIDmode,
  189.                  const_double_low_int (operands[1]));
  190.       return \"ld.l %1,%0\";
  191.     }
  192.   else
  193.     return \"ld.l %1,%0\";
  194. }")
  195.  
  196. (define_insn "movsf"
  197.   [(set (match_operand:SF 0 "general_operand" "=g,d")
  198.     (match_operand:SF 1 "general_operand" "d,gF"))]
  199.   ""
  200.   "*
  201. {
  202.   if (push_operand (operands[0], SFmode))
  203.     return \"psh.w %1\";
  204.   else if (GET_CODE (operands[0]) == MEM)
  205.     return \"st.s %1,%0\";
  206.   else if (GET_CODE (operands[1]) == REG)
  207.     return \"mov.s %1,%0\";
  208.   else
  209.     return \"ld.s %1,%0\";
  210. }")
  211.  
  212. (define_insn "movdi"
  213.   [(set (match_operand:DI 0 "general_operand" "=g,d")
  214.     (match_operand:DI 1 "general_operand" "d,dmiG"))]
  215.   ""
  216.   "*
  217. {
  218.   if (push_operand (operands[0], DImode))
  219.     return \"psh.l %1\";
  220.   else if (GET_CODE (operands[0]) == MEM)
  221.     return \"st.l %1,%0\";
  222.   else if (GET_CODE (operands[1]) == REG)
  223.     return \"mov %1,%0\";
  224.   else if (GET_CODE (operands[1]) == CONST_DOUBLE && LD_D_P (operands[1]))
  225.     {
  226.       operands[1] = gen_rtx (CONST_INT, VOIDmode,
  227.                  const_double_high_int (operands[1]));
  228.       return \"ld.d %1,%0\";
  229.     }
  230.   else
  231.     return \"ld.l %1,%0\";
  232. }")
  233.  
  234. ;; Special case of movsi, needed to express A-reg preference.
  235.  
  236. (define_insn ""
  237.   [(set (match_operand:SI 0 "push_operand" "=<")
  238.     (plus:SI (match_operand:SI 1 "register_operand" "a")
  239.          (match_operand:SI 2 "immediate_operand" "i")))]
  240.   "operands[1] != stack_pointer_rtx"
  241.   "pshea %a2(%1)")
  242.  
  243. ;; General movsi.  Constraints will be selected based on TARGET_INDIRECTS
  244. ;; to avoid indirect addressing on C3, where it is slow.
  245.  
  246. (define_expand "movsi"
  247.   [(set (match_operand:SI 0 "general_operand" "")
  248.     (match_operand:SI 1 "general_operand" ""))]
  249.   ""
  250.   "")
  251.  
  252. (define_insn ""
  253.   [(set (match_operand:SI 0 "push_operand" "=<,<")
  254.     (match_operand:SI 1 "general_operand" "Ad,io"))]
  255.   ""
  256.   "@
  257.    psh.w %1
  258.    pshea %a1")
  259.  
  260. (define_insn ""
  261.   [(set (match_operand:SI 0 "general_operand" "=g,r,<")
  262.     (match_operand:SI 1 "general_operand" "r,g,io"))]
  263.   "TARGET_INDIRECTS"
  264.   "*
  265.   if (push_operand (operands[0], SImode))
  266.     {
  267.       if (GET_CODE (operands[1]) == REG)
  268.     return \"psh.w %1\";
  269.       else
  270.         return \"pshea %a1\";
  271.     }
  272.   if (GET_CODE (operands[0]) == MEM)
  273.     return \"st.w %1,%0\";
  274.   if (GET_CODE (operands[1]) != REG)
  275.     return \"ld.w %1,%0\";
  276.   if (S_REG_P (operands[0]) && S_REG_P (operands[1]))
  277.     return \"mov.w %1,%0\";
  278.   return \"mov %1,%0\";
  279. }")
  280.  
  281. (define_insn ""
  282.   [(set (match_operand:SI 0 "general_operand" "=g,r,<")
  283.     (match_operand:SI 1 "general_operand" "r,g,i"))]
  284.   "! TARGET_INDIRECTS"
  285.   "*
  286.   if (push_operand (operands[0], SImode))
  287.     {
  288.       if (GET_CODE (operands[1]) == REG)
  289.     return \"psh.w %1\";
  290.       else
  291.         return \"pshea %a1\";
  292.     }
  293.   if (GET_CODE (operands[0]) == MEM)
  294.     return \"st.w %1,%0\";
  295.   if (GET_CODE (operands[1]) != REG)
  296.     return \"ld.w %1,%0\";
  297.   if (S_REG_P (operands[0]) && S_REG_P (operands[1]))
  298.     return \"mov.w %1,%0\";
  299.   return \"mov %1,%0\";
  300. }")
  301.  
  302. (define_insn "movstrictsi"
  303.   [(set (strict_low_part (match_operand:SI 0 "general_operand" "+g,r"))
  304.     (match_operand:SI 1 "general_operand" "r,g"))]
  305.   ""
  306.   "*
  307.   if (GET_CODE (operands[0]) == MEM)
  308.     return \"st.w %1,%0\";
  309.   if (GET_CODE (operands[1]) != REG)
  310.     return \"ld.w %1,%0\";
  311.   if (S_REG_P (operands[0]) && S_REG_P (operands[1]))
  312.     return \"mov.w %1,%0\";
  313.   return \"mov %1,%0\";
  314. }")
  315.  
  316. (define_insn "movhi"
  317.   [(set (match_operand:HI 0 "general_operand" "=g,r")
  318.     (match_operand:HI 1 "general_operand" "r,g"))]
  319.   ""
  320.   "*
  321. {
  322.   if (push_operand (operands[0], HImode))
  323.     abort ();
  324.   else if (GET_CODE (operands[0]) == MEM)
  325.     return \"st.h %1,%0\";
  326.   else if (GET_CODE (operands[1]) == REG) 
  327.     {
  328.       if (S_REG_P (operands[0]) && S_REG_P (operands[1]))
  329.     return \"mov.w %1,%0\";
  330.       else
  331.         return \"mov %1,%0\";
  332.     }
  333.   else if (GET_CODE (operands[1]) == CONST_INT)
  334.     return \"ld.w %1,%0\";
  335.   else
  336.     return \"ld.h %1,%0\";
  337. }")
  338.  
  339. (define_insn "movqi"
  340.   [(set (match_operand:QI 0 "general_operand" "=g,r")
  341.     (match_operand:QI 1 "general_operand" "r,g"))]
  342.   ""
  343.   "*
  344. {
  345.   if (push_operand (operands[0], QImode))
  346.     abort ();
  347.   else if (GET_CODE (operands[0]) == MEM)
  348.     return \"st.b %1,%0\";
  349.   else if (GET_CODE (operands[1]) == REG)
  350.     {
  351.       if (S_REG_P (operands[0]) && S_REG_P (operands[1]))
  352.     return \"mov.w %1,%0\";
  353.       else
  354.         return \"mov %1,%0\";
  355.     }
  356.   else if (GET_CODE (operands[1]) == CONST_INT)
  357.     return \"ld.w %1,%0\";
  358.   else
  359.     return \"ld.b %1,%0\";
  360. }")
  361.  
  362. ;; Extension and truncation insns.
  363. ;; Those for integer source operand
  364. ;; are ordered widest source type first.
  365.  
  366. (define_insn "truncsiqi2"
  367.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  368.     (truncate:QI (match_operand:SI 1 "register_operand" "d,a")))]
  369.   ""
  370.   "cvtw.b %1,%0")
  371.  
  372. (define_insn "truncsihi2"
  373.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  374.     (truncate:HI (match_operand:SI 1 "register_operand" "d,a")))]
  375.   ""
  376.   "cvtw.h %1,%0")
  377.  
  378. (define_insn "trunchiqi2"
  379.   [(set (match_operand:QI 0 "register_operand" "=r")
  380.     (truncate:QI (match_operand:HI 1 "register_operand" "0")))]
  381.   ""
  382.   "")
  383.  
  384. (define_insn "truncdisi2"
  385.   [(set (match_operand:SI 0 "register_operand" "=d")
  386.     (truncate:SI (match_operand:DI 1 "register_operand" "d")))]
  387.   ""
  388.   "cvtl.w %1,%0")
  389.  
  390. (define_insn "extendsidi2"
  391.   [(set (match_operand:DI 0 "register_operand" "=d")
  392.     (sign_extend:DI (match_operand:SI 1 "register_operand" "d")))]
  393.   ""
  394.   "cvtw.l %1,%0")
  395.  
  396. (define_insn "extendhisi2"
  397.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  398.     (sign_extend:SI (match_operand:HI 1 "register_operand" "d,a")))]
  399.   ""
  400.   "cvth.w %1,%0")
  401.  
  402. (define_insn "extendqihi2"
  403.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  404.     (sign_extend:HI (match_operand:QI 1 "register_operand" "d,a")))]
  405.   ""
  406.   "cvtb.w %1,%0")
  407.  
  408. (define_insn "extendqisi2"
  409.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  410.     (sign_extend:SI (match_operand:QI 1 "register_operand" "d,a")))]
  411.   ""
  412.   "cvtb.w %1,%0")
  413.  
  414. (define_insn "extendsfdf2"
  415.   [(set (match_operand:DF 0 "register_operand" "=d")
  416.     (float_extend:DF (match_operand:SF 1 "register_operand" "d")))]
  417.   ""
  418.   "cvts.d %1,%0")
  419.  
  420. (define_insn "truncdfsf2"
  421.   [(set (match_operand:SF 0 "register_operand" "=d")
  422.     (float_truncate:SF (match_operand:DF 1 "register_operand" "d")))]
  423.   ""
  424.   "cvtd.s %1,%0")
  425.  
  426. (define_insn "zero_extendhisi2"
  427.   [(set (match_operand:SI 0 "register_operand" "=r")
  428.     (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))]
  429.   ""
  430.   "and #0xffff,%0")
  431.  
  432. (define_insn "zero_extendqihi2"
  433.   [(set (match_operand:HI 0 "register_operand" "=r")
  434.     (zero_extend:HI (match_operand:QI 1 "register_operand" "0")))]
  435.   ""
  436.   "and #0xff,%0")
  437.  
  438. (define_insn "zero_extendqisi2"
  439.   [(set (match_operand:SI 0 "register_operand" "=r")
  440.     (zero_extend:SI (match_operand:QI 1 "register_operand" "0")))]
  441.   ""
  442.   "and #0xff,%0")
  443.  
  444. (define_insn "zero_extendsidi2"
  445.   [(set (match_operand:DI 0 "register_operand" "=d")
  446.     (zero_extend:DI (match_operand:SI 1 "register_operand" "0")))]
  447.   ""
  448.   "ld.u #0,%0")
  449.  
  450. ;; Fix-to-float conversion insns.
  451. ;; Note that the ones that start with SImode come first.
  452. ;; That is so that an operand that is a CONST_INT
  453. ;; (and therefore lacks a specific machine mode).
  454. ;; will be recognized as SImode (which is always valid)
  455. ;; rather than as QImode or HImode.
  456.  
  457. (define_insn "floatsisf2"
  458.   [(set (match_operand:SF 0 "register_operand" "=d")
  459.     (float:SF (match_operand:SI 1 "register_operand" "d")))]
  460.   ""
  461.   "cvtw.s %1,%0")
  462.  
  463. (define_insn "floatdisf2"
  464.   [(set (match_operand:SF 0 "register_operand" "=d")
  465.     (float:SF (match_operand:DI 1 "register_operand" "d")))]
  466.   ""
  467.   "cvtl.s %1,%0")
  468.  
  469. (define_insn "floatsidf2"
  470.   [(set (match_operand:DF 0 "register_operand" "=d")
  471.     (float:DF (match_operand:SI 1 "register_operand" "d")))]
  472.   "TARGET_C2"
  473.   "cvtw.d %1,%0")
  474.  
  475. (define_insn "floatdidf2"
  476.   [(set (match_operand:DF 0 "register_operand" "=d")
  477.     (float:DF (match_operand:DI 1 "register_operand" "d")))]
  478.   ""
  479.   "cvtl.d %1,%0")
  480.  
  481. ;; Float-to-fix conversion insns.
  482.  
  483. (define_insn "fix_truncsfsi2"
  484.   [(set (match_operand:SI 0 "register_operand" "=d")
  485.     (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "d"))))]
  486.   ""
  487.   "cvts.w %1,%0")
  488.  
  489. (define_insn "fix_truncsfdi2"
  490.   [(set (match_operand:DI 0 "register_operand" "=d")
  491.     (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "d"))))]
  492.   ""
  493.   "cvts.l %1,%0")
  494.  
  495. (define_insn "fix_truncdfsi2"
  496.   [(set (match_operand:SI 0 "register_operand" "=d")
  497.     (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "d"))))]
  498.   ""
  499.   "*
  500. {
  501.   if (TARGET_C2)
  502.     return \"cvtd.w %1,%0\";
  503.   return \"cvtd.l %1,%0\";
  504. }")
  505.  
  506. (define_insn "fix_truncdfdi2"
  507.   [(set (match_operand:DI 0 "register_operand" "=d")
  508.     (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "d"))))]
  509.   ""
  510.   "cvtd.l %1,%0")
  511.  
  512. ;;- All kinds of add instructions.
  513.  
  514. (define_insn "adddf3"
  515.   [(set (match_operand:DF 0 "register_operand" "=d")
  516.     (plus:DF (match_operand:DF 1 "register_operand" "%0")
  517.          (match_operand:DF 2 "register_operand" "d")))]
  518.   ""
  519.   "add.d %2,%0")
  520.  
  521. (define_insn "addsf3"
  522.   [(set (match_operand:SF 0 "register_operand" "=d")
  523.     (plus:SF (match_operand:SF 1 "register_operand" "%0")
  524.          (match_operand:SF 2 "nonmemory_operand" "dF")))]
  525.   ""
  526.   "add.s %2,%0")
  527.  
  528. (define_insn "adddi3"
  529.   [(set (match_operand:DI 0 "register_operand" "=d")
  530.     (plus:DI (match_operand:DI 1 "register_operand" "%0")
  531.          (match_operand:DI 2 "register_operand" "d")))]
  532.   ""
  533.   "add.l %2,%0")
  534.  
  535. ;; special case of addsi3, needed to specify an A reg for the destination 
  536. ;; when the source is a sum involving FP or AP.
  537.  
  538. (define_insn ""
  539.   [(set (match_operand:SI 0 "register_operand" "=a")
  540.     (plus:SI (match_operand:SI 1 "register_operand" "%a")
  541.          (match_operand:SI 2 "immediate_operand" "i")))]
  542.   "operands[1] == frame_pointer_rtx || operands[1] == arg_pointer_rtx"
  543.   "ldea %a2(%1),%0")
  544.  
  545. (define_insn "addsi3"
  546.   [(set (match_operand:SI 0 "register_operand" "=d,a,a")
  547.     (plus:SI (match_operand:SI 1 "nonmemory_operand" "%0,0,a")
  548.          (match_operand:SI 2 "nonmemory_operand" "di,ri,i")))]
  549.   ""
  550.   "* switch (which_alternative) 
  551. {
  552.  case 0:
  553.  case 1: 
  554.    return \"add.w %2,%0\";
  555.  case 2:
  556.    if ((TARGET_C2 || A_REG_P (operands[0]))
  557.        && operands[1] != stack_pointer_rtx)
  558.      return \"ldea %a2(%1),%0\";
  559.    else
  560.      return \"mov %1,%0\;add.w %2,%0\";
  561. }")
  562.  
  563. (define_insn "addhi3"
  564.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  565.     (plus:HI (match_operand:HI 1 "register_operand" "%0,0")
  566.          (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  567.   ""
  568.   "add.h %2,%0")
  569.  
  570. (define_insn "addqi3"
  571.   [(set (match_operand:QI 0 "register_operand" "=d")
  572.     (plus:QI (match_operand:QI 1 "register_operand" "%0")
  573.          (match_operand:QI 2 "register_operand" "d")))]
  574.   ""
  575.   "add.b %2,%0")
  576.  
  577. ;;- All kinds of subtract instructions.
  578.  
  579. (define_insn "subdf3"
  580.   [(set (match_operand:DF 0 "register_operand" "=d")
  581.     (minus:DF (match_operand:DF 1 "register_operand" "0")
  582.           (match_operand:DF 2 "register_operand" "d")))]
  583.   ""
  584.   "sub.d %2,%0")
  585.  
  586. (define_insn "subsf3"
  587.   [(set (match_operand:SF 0 "register_operand" "=d")
  588.     (minus:SF (match_operand:SF 1 "register_operand" "0")
  589.           (match_operand:SF 2 "nonmemory_operand" "dF")))]
  590.   ""
  591.   "sub.s %2,%0")
  592.  
  593. (define_insn "subdi3"
  594.   [(set (match_operand:DI 0 "register_operand" "=d")
  595.     (minus:DI (match_operand:DI 1 "register_operand" "0")
  596.           (match_operand:DI 2 "register_operand" "d")))]
  597.   ""
  598.   "sub.l %2,%0")
  599.  
  600. (define_insn "subsi3"
  601.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  602.     (minus:SI (match_operand:SI 1 "register_operand" "0,0")
  603.           (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  604.   ""
  605.   "sub.w %2,%0")
  606.  
  607. (define_insn "subhi3"
  608.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  609.     (minus:HI (match_operand:HI 1 "register_operand" "0,0")
  610.           (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  611.   ""
  612.   "sub.h %2,%0")
  613.  
  614. (define_insn "subqi3"
  615.   [(set (match_operand:QI 0 "register_operand" "=d")
  616.     (minus:QI (match_operand:QI 1 "register_operand" "0")
  617.           (match_operand:QI 2 "register_operand" "d")))]
  618.   ""
  619.   "sub.b %2,%0")
  620.  
  621. ;;- Multiply instructions.
  622.  
  623. (define_insn "muldf3"
  624.   [(set (match_operand:DF 0 "register_operand" "=d")
  625.     (mult:DF (match_operand:DF 1 "register_operand" "%0")
  626.          (match_operand:DF 2 "register_operand" "d")))]
  627.   ""
  628.   "mul.d %2,%0")
  629.  
  630. (define_insn "mulsf3"
  631.   [(set (match_operand:SF 0 "register_operand" "=d")
  632.     (mult:SF (match_operand:SF 1 "register_operand" "%0")
  633.          (match_operand:SF 2 "nonmemory_operand" "dF")))]
  634.   ""
  635.   "mul.s %2,%0")
  636.  
  637. (define_insn "muldi3"
  638.   [(set (match_operand:DI 0 "register_operand" "=d")
  639.     (mult:DI (match_operand:DI 1 "register_operand" "%0")
  640.          (match_operand:DI 2 "register_operand" "d")))]
  641.   ""
  642.   "mul.l %2,%0")
  643.  
  644. (define_insn "mulsi3"
  645.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  646.     (mult:SI (match_operand:SI 1 "register_operand" "%0,0")
  647.          (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  648.   ""
  649.   "mul.w %2,%0")
  650.  
  651. (define_insn "mulhi3"
  652.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  653.     (mult:HI (match_operand:HI 1 "register_operand" "%0,0")
  654.          (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  655.   ""
  656.   "mul.h %2,%0")
  657.  
  658. (define_insn "mulqi3"
  659.   [(set (match_operand:QI 0 "register_operand" "=d")
  660.     (mult:QI (match_operand:QI 1 "register_operand" "%0")
  661.          (match_operand:QI 2 "register_operand" "d")))]
  662.   ""
  663.   "mul.b %2,%0")
  664.  
  665. ;;- Divide instructions.
  666.  
  667. (define_insn "divdf3"
  668.   [(set (match_operand:DF 0 "register_operand" "=d")
  669.     (div:DF (match_operand:DF 1 "register_operand" "0")
  670.         (match_operand:DF 2 "register_operand" "d")))]
  671.   ""
  672.   "div.d %2,%0")
  673.  
  674. (define_insn "divsf3"
  675.   [(set (match_operand:SF 0 "register_operand" "=d")
  676.     (div:SF (match_operand:SF 1 "register_operand" "0")
  677.         (match_operand:SF 2 "nonmemory_operand" "dF")))]
  678.   ""
  679.   "div.s %2,%0")
  680.  
  681. (define_insn "divdi3"
  682.   [(set (match_operand:DI 0 "register_operand" "=d")
  683.     (div:DI (match_operand:DI 1 "register_operand" "0")
  684.         (match_operand:DI 2 "register_operand" "d")))]
  685.   ""
  686.   "div.l %2,%0")
  687.  
  688. (define_insn "udivdi3"
  689.   [(set (match_operand:DI 0 "register_operand" "=d")
  690.     (udiv:DI (match_operand:DI 1 "register_operand" "d")
  691.          (match_operand:DI 2 "register_operand" "d")))]
  692.   ""
  693.   "psh.l %2\;psh.l %1\;callq udiv64\;pop.l %0\;add.w #8,sp")
  694.  
  695. (define_insn "divsi3"
  696.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  697.     (div:SI (match_operand:SI 1 "register_operand" "0,0")
  698.         (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  699.   ""
  700.   "div.w %2,%0")
  701.  
  702. (define_insn "divhi3"
  703.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  704.     (div:HI (match_operand:HI 1 "register_operand" "0,0")
  705.         (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  706.   ""
  707.   "div.h %2,%0")
  708.  
  709. (define_insn "divqi3"
  710.   [(set (match_operand:QI 0 "register_operand" "=d")
  711.     (div:QI (match_operand:QI 1 "register_operand" "0")
  712.         (match_operand:QI 2 "register_operand" "d")))]
  713.   ""
  714.   "div.b %2,%0")
  715.  
  716. ;; - and, or, xor
  717.  
  718. (define_insn ""
  719.   [(set (match_operand:DI 0 "register_operand" "=d")
  720.     (and:DI (match_operand:DI 1 "register_operand" "%0")
  721.         (match_operand:DI 2 "immediate_operand" "Fn")))]
  722.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
  723.    || (GET_CODE (operands[2]) == CONST_DOUBLE
  724.        && CONST_DOUBLE_HIGH (operands[2]) == -1)"
  725.   "and %2,%0")
  726.  
  727. (define_insn "anddi3"
  728.   [(set (match_operand:DI 0 "register_operand" "=d")
  729.     (and:DI (match_operand:DI 1 "register_operand" "%0")
  730.         (match_operand:DI 2 "register_operand" "d")))]
  731.   ""
  732.   "and %2,%0")
  733.  
  734. (define_insn "andsi3"
  735.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  736.     (and:SI (match_operand:SI 1 "register_operand" "%0,0")
  737.         (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  738.   ""
  739.   "and %2,%0")
  740.  
  741. (define_insn "andhi3"
  742.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  743.     (and:HI (match_operand:HI 1 "register_operand" "%0,0")
  744.         (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  745.   ""
  746.   "and %2,%0")
  747.  
  748. (define_insn "andqi3"
  749.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  750.     (and:QI (match_operand:QI 1 "register_operand" "%0,0")
  751.         (match_operand:QI 2 "nonmemory_operand" "di,ai")))]
  752.   ""
  753.   "and %2,%0")
  754.  
  755. ;;- Bit set instructions.
  756.  
  757. (define_insn ""
  758.   [(set (match_operand:DI 0 "register_operand" "=d")
  759.     (ior:DI (match_operand:DI 1 "register_operand" "%0")
  760.         (match_operand:DI 2 "immediate_operand" "Fn")))]
  761.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0)
  762.    || (GET_CODE (operands[2]) == CONST_DOUBLE
  763.        && CONST_DOUBLE_HIGH (operands[2]) == 0)"
  764.   "or %2,%0")
  765.  
  766. (define_insn "iordi3"
  767.   [(set (match_operand:DI 0 "register_operand" "=d")
  768.     (ior:DI (match_operand:DI 1 "register_operand" "%0")
  769.         (match_operand:DI 2 "register_operand" "d")))]
  770.   ""
  771.   "or %2,%0")
  772.  
  773. (define_insn "iorsi3"
  774.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  775.     (ior:SI (match_operand:SI 1 "register_operand" "%0,0")
  776.         (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  777.   ""
  778.   "or %2,%0")
  779.  
  780. (define_insn "iorhi3"
  781.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  782.     (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
  783.         (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  784.   ""
  785.   "or %2,%0")
  786.  
  787. (define_insn "iorqi3"
  788.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  789.     (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
  790.         (match_operand:QI 2 "nonmemory_operand" "di,ai")))]
  791.   ""
  792.   "or %2,%0")
  793.  
  794. ;;- xor instructions.
  795.  
  796. (define_insn ""
  797.   [(set (match_operand:DI 0 "register_operand" "=d")
  798.     (xor:DI (match_operand:DI 1 "register_operand" "%0")
  799.         (match_operand:DI 2 "immediate_operand" "Fn")))]
  800.   "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0)
  801.    || (GET_CODE (operands[2]) == CONST_DOUBLE
  802.        && CONST_DOUBLE_HIGH (operands[2]) == 0)"
  803.   "xor %2,%0")
  804.  
  805. (define_insn "xordi3"
  806.   [(set (match_operand:DI 0 "register_operand" "=d")
  807.     (xor:DI (match_operand:DI 1 "register_operand" "%0")
  808.         (match_operand:DI 2 "register_operand" "d")))]
  809.   ""
  810.   "xor %2,%0")
  811.  
  812. (define_insn "xorsi3"
  813.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  814.     (xor:SI (match_operand:SI 1 "register_operand" "%0,0")
  815.         (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  816.   ""
  817.   "xor %2,%0")
  818.  
  819. (define_insn "xorhi3"
  820.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  821.     (xor:HI (match_operand:HI 1 "register_operand" "%0,0")
  822.         (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
  823.   ""
  824.   "xor %2,%0")
  825.  
  826. (define_insn "xorqi3"
  827.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  828.     (xor:QI (match_operand:QI 1 "register_operand" "%0,0")
  829.         (match_operand:QI 2 "nonmemory_operand" "di,ai")))]
  830.   ""
  831.   "xor %2,%0")
  832.  
  833. (define_insn "negdf2"
  834.   [(set (match_operand:DF 0 "register_operand" "=d")
  835.     (neg:DF (match_operand:DF 1 "register_operand" "d")))]
  836.   ""
  837.   "neg.d %1,%0")
  838.  
  839. (define_insn "negsf2"
  840.   [(set (match_operand:SF 0 "register_operand" "=d")
  841.     (neg:SF (match_operand:SF 1 "register_operand" "d")))]
  842.   ""
  843.   "neg.s %1,%0")
  844.  
  845. (define_insn "negdi2"
  846.   [(set (match_operand:DI 0 "register_operand" "=d")
  847.     (neg:DI (match_operand:DI 1 "register_operand" "d")))]
  848.   ""
  849.   "neg.l %1,%0")
  850.  
  851. (define_insn "negsi2"
  852.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  853.     (neg:SI (match_operand:SI 1 "register_operand" "d,a")))]
  854.   ""
  855.   "neg.w %1,%0")
  856.  
  857. (define_insn "neghi2"
  858.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  859.     (neg:HI (match_operand:HI 1 "register_operand" "d,a")))]
  860.   ""
  861.   "neg.h %1,%0")
  862.  
  863. (define_insn "negqi2"
  864.   [(set (match_operand:QI 0 "register_operand" "=d")
  865.     (neg:QI (match_operand:QI 1 "register_operand" "d")))]
  866.   ""
  867.   "neg.b %1,%0")
  868.  
  869. (define_insn "one_cmpldi2"
  870.   [(set (match_operand:DI 0 "register_operand" "=d")
  871.     (not:DI (match_operand:DI 1 "register_operand" "d")))]
  872.   ""
  873.   "not %1,%0")
  874.  
  875. (define_insn "one_cmplsi2"
  876.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  877.     (not:SI (match_operand:SI 1 "register_operand" "d,a")))]
  878.   ""
  879.   "not %1,%0")
  880.  
  881. (define_insn "one_cmplhi2"
  882.   [(set (match_operand:HI 0 "register_operand" "=d,a")
  883.     (not:HI (match_operand:HI 1 "register_operand" "d,a")))]
  884.   ""
  885.   "not %1,%0")
  886.  
  887. (define_insn "one_cmplqi2"
  888.   [(set (match_operand:QI 0 "register_operand" "=d,a")
  889.     (not:QI (match_operand:QI 1 "register_operand" "d,a")))]
  890.   ""
  891.   "not %1,%0")
  892.  
  893. ;;- shifts
  894. ;;
  895. ;; Convex shift instructions are logical shifts.
  896. ;; To make signed right shifts:
  897. ;; for SImode, sign extend to DImode and shift, works for 0..32
  898. ;; for DImode, shift and then extend the sign, works for 0..63 -- but not 64
  899.  
  900. (define_insn "lshlsi3"
  901.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  902.     (lshift:SI (match_operand:SI 1 "register_operand" "0,0")
  903.            (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  904.   ""
  905.   "*
  906. {
  907.   if (operands[2] == const1_rtx)
  908.     return \"add.w %0,%0\";
  909.   else if (TARGET_C2 && S_REG_P (operands[0]))
  910.     return \"shf.w %2,%0\";
  911.   else
  912.     return \"shf %2,%0\";
  913. }")
  914.  
  915. (define_insn "ashlsi3"
  916.   [(set (match_operand:SI 0 "register_operand" "=d,a")
  917.     (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
  918.            (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
  919.   ""
  920.   "*
  921. {
  922.   if (operands[2] == const1_rtx)
  923.     return \"add.w %0,%0\";
  924.   else if (TARGET_C2 && S_REG_P (operands[0]))
  925.     return \"shf.w %2,%0\";
  926.   else
  927.     return \"shf %2,%0\";
  928. }")
  929.  
  930. (define_expand "lshrsi3"
  931.   [(set (match_operand:SI 0 "register_operand" "")
  932.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
  933.              (neg:SI (match_operand:SI 2 "nonmemory_operand" ""))))]
  934.   ""
  935.   "operands[2] = negate_rtx (SImode, operands[2]);")
  936.  
  937. (define_insn ""
  938.   [(set
  939.     (match_operand:SI 0 "register_operand" "=d,a")
  940.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
  941.          (neg:SI (match_operand:SI 2 "nonmemory_operand" "di,ai"))))]
  942.   ""
  943.   "*
  944. {
  945.   if (A_REG_P (operands[0]))
  946.     return \"shf %2,%0\";
  947.   else if (TARGET_C2)
  948.     return \"shf.w %2,%0\";
  949.   else
  950.     return \"ld.u #0,%0\;shf %2,%0\";
  951. }")
  952.  
  953. (define_insn ""
  954.   [(set
  955.     (match_operand:SI 0 "register_operand" "=r")
  956.     (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
  957.          (match_operand:SI 2 "immediate_operand" "i")))]
  958.   ""
  959.   "*
  960. {
  961.   if (A_REG_P (operands[0]))
  962.     return \"shf #%n2,%0\";
  963.   else if (TARGET_C2)
  964.     return \"shf.w #%n2,%0\";
  965.   else
  966.     return \"ld.u #0,%0\;shf #%n2,%0\";
  967. }")
  968.  
  969. (define_expand "ashrsi3"
  970.   [(set (match_operand:SI 0 "register_operand" "=d")
  971.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
  972.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "di"))))]
  973.   ""
  974.   "operands[2] = negate_rtx (SImode, operands[2]);")
  975.  
  976. (define_insn ""
  977.   [(set (match_operand:SI 0 "register_operand" "=&d")
  978.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
  979.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "di"))))]
  980.   ""
  981.   "cvtw.l %1,%0\;shf %2,%0")
  982.  
  983. (define_insn ""
  984.   [(set (match_operand:SI 0 "register_operand" "=&d")
  985.     (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
  986.              (match_operand:SI 2 "immediate_operand" "i")))]
  987.   ""
  988.   "cvtw.l %1,%0\;shf #%n2,%0")
  989.  
  990. (define_insn "lshldi3"
  991.   [(set (match_operand:DI 0 "register_operand" "=d")
  992.     (lshift:DI (match_operand:DI 1 "register_operand" "0")
  993.            (match_operand:SI 2 "nonmemory_operand" "di")))]
  994.   ""
  995.   "shf %2,%0")
  996.  
  997. (define_insn "ashldi3"
  998.   [(set (match_operand:DI 0 "register_operand" "=d")
  999.     (ashift:DI (match_operand:DI 1 "register_operand" "0")
  1000.            (match_operand:SI 2 "nonmemory_operand" "di")))]
  1001.   ""
  1002.   "shf %2,%0")
  1003.  
  1004. (define_expand "lshrdi3"
  1005.   [(set (match_operand:DI 0 "register_operand" "=d")
  1006.     (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
  1007.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "di"))))]
  1008.   ""
  1009.   "operands[2] = negate_rtx (SImode, operands[2]);")
  1010.  
  1011. (define_insn ""
  1012.   [(set (match_operand:DI 0 "register_operand" "=d")
  1013.     (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
  1014.              (neg:SI (match_operand:SI 2 "nonmemory_operand" "di"))))]
  1015.   ""
  1016.   "shf %2,%0")
  1017.  
  1018. (define_insn ""
  1019.   [(set (match_operand:DI 0 "register_operand" "=d")
  1020.     (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
  1021.              (match_operand:SI 2 "immediate_operand" "i")))]
  1022.   ""
  1023.   "shf #%n2,%0")
  1024.  
  1025. ;; signed  a >> b  is
  1026. ;;     ((a >> b) ^ signbit) - signbit
  1027. ;; where signbit is (1 << 63) >> b
  1028.  
  1029. (define_expand "ashrdi3"
  1030.   [(match_operand:DI 0 "register_operand" "")
  1031.    (match_operand:DI 1 "register_operand" "")
  1032.    (match_operand:SI 2 "nonmemory_operand" "")
  1033.    (match_dup 3)]
  1034.   ""
  1035.   "
  1036. {
  1037.   if (GET_CODE (operands[2]) == CONST_INT)
  1038.     {
  1039.       int rshift = INTVAL (operands[2]);
  1040.       if (rshift < 0)
  1041.     operands[3] = force_reg (DImode, immed_double_const (0, 0, DImode));
  1042.       else if (rshift < 32)
  1043.     operands[3] =
  1044.       force_reg (DImode,
  1045.              immed_double_const (0, 1 << (31 - rshift), DImode));
  1046.       else if (rshift < 64)
  1047.     operands[3] =
  1048.       force_reg (DImode,
  1049.              immed_double_const (1 << (63 - rshift), 0, DImode));
  1050.       else
  1051.     operands[3] = force_reg (DImode, immed_double_const (0, 0, DImode));
  1052.     }
  1053.   else
  1054.     {
  1055.       operands[3] =
  1056.       force_reg (DImode, immed_double_const (0, 1 << 31, DImode));
  1057.       emit_insn (gen_lshrdi3 (operands[3], operands[3], operands[2]));
  1058.     }
  1059.  
  1060.   emit_insn (gen_lshrdi3 (operands[0], operands[1], operands[2]));
  1061.   emit_insn (gen_rtx (SET, VOIDmode, operands[0],
  1062.               gen_rtx (XOR, DImode, operands[0], operands[3])));
  1063.   emit_insn (gen_rtx (SET, VOIDmode, operands[0],
  1064.               gen_rtx (MINUS, DImode, operands[0], operands[3])));
  1065.   DONE;
  1066. }")
  1067.  
  1068. ;; __builtin instructions
  1069.  
  1070. (define_insn "sqrtdf2"
  1071.   [(set (match_operand:DF 0 "register_operand" "=d")
  1072.     (sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
  1073.   "TARGET_C2"
  1074.   "sqrt.d %0")
  1075.  
  1076. (define_insn "sqrtsf2"
  1077.   [(set (match_operand:SF 0 "register_operand" "=d")
  1078.     (sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
  1079.   "TARGET_C2"
  1080.   "sqrt.s %0")
  1081.  
  1082. ;(define_insn ""
  1083. ;  [(set (match_operand:SI 0 "register_operand" "=d")
  1084. ;    (minus:SI (ffs:SI (match_operand:SI 1 "register_operand" "d"))
  1085. ;          (const_int 1)))]
  1086. ;  ""
  1087. ;  "tzc %1,%0\;le.w #32,%0\;jbrs.f .+6\;ld.w #-1,%0")
  1088. ;
  1089. ;(define_expand "ffssi2"
  1090. ;  [(set (match_operand:SI 0 "register_operand" "=d")
  1091. ;    (minus:SI (ffs:SI (match_operand:SI 1 "register_operand" "d"))
  1092. ;          (const_int 1)))
  1093. ;   (set (match_dup 0)
  1094. ;    (plus:SI (match_dup 0)
  1095. ;         (const_int 1)))]
  1096. ;  ""
  1097. ;  "")
  1098.  
  1099. (define_insn "abssf2"
  1100.   [(set (match_operand:SF 0 "register_operand" "=d")
  1101.     (abs:SF (match_operand:SF 1 "register_operand" "0")))]
  1102.   ""
  1103.   "and #0x7fffffff,%0")
  1104.  
  1105. (define_expand "absdf2"
  1106.   [(set (subreg:DI (match_operand:DF 0 "register_operand" "=d") 0)
  1107.     (and:DI (subreg:DI (match_operand:DF 1 "register_operand" "d") 0)
  1108.         (match_dup 2)))]
  1109.   ""
  1110.   "operands[2] = force_reg (DImode,
  1111.                 immed_double_const (-1, 0x7fffffff, DImode));")
  1112.  
  1113. ;; Jumps
  1114.  
  1115. (define_insn "jump"
  1116.   [(set (pc)
  1117.     (label_ref (match_operand 0 "" "")))]
  1118.   ""
  1119.   "jbr %l0")
  1120.  
  1121. (define_insn "beq"
  1122.   [(set (pc)
  1123.     (if_then_else (eq (cc0)
  1124.               (const_int 0))
  1125.               (label_ref (match_operand 0 "" ""))
  1126.               (pc)))]
  1127.   ""
  1128.   "* return gen_cmp (operands[0], \"eq\", 't'); ")
  1129.  
  1130. (define_insn "bne"
  1131.   [(set (pc)
  1132.     (if_then_else (ne (cc0)
  1133.               (const_int 0))
  1134.               (label_ref (match_operand 0 "" ""))
  1135.               (pc)))]
  1136.   ""
  1137.   "* return gen_cmp (operands[0], \"eq\", 'f'); ")
  1138.  
  1139. (define_insn "bgt"
  1140.   [(set (pc)
  1141.     (if_then_else (gt (cc0)
  1142.               (const_int 0))
  1143.               (label_ref (match_operand 0 "" ""))
  1144.               (pc)))]
  1145.   ""
  1146.   "* return gen_cmp (operands[0], \"le\", 'f'); ")
  1147.  
  1148. (define_insn "bgtu"
  1149.   [(set (pc)
  1150.     (if_then_else (gtu (cc0)
  1151.                (const_int 0))
  1152.               (label_ref (match_operand 0 "" ""))
  1153.               (pc)))]
  1154.   ""
  1155.   "* return gen_cmp (operands[0], \"leu\", 'f'); ")
  1156.  
  1157. (define_insn "blt"
  1158.   [(set (pc)
  1159.     (if_then_else (lt (cc0)
  1160.               (const_int 0))
  1161.               (label_ref (match_operand 0 "" ""))
  1162.               (pc)))]
  1163.   ""
  1164.   "* return gen_cmp (operands[0], \"lt\", 't'); ")
  1165.  
  1166. (define_insn "bltu"
  1167.   [(set (pc)
  1168.     (if_then_else (ltu (cc0)
  1169.                (const_int 0))
  1170.               (label_ref (match_operand 0 "" ""))
  1171.               (pc)))]
  1172.   ""
  1173.   "* return gen_cmp (operands[0], \"ltu\", 't'); ")
  1174.  
  1175. (define_insn "bge"
  1176.   [(set (pc)
  1177.     (if_then_else (ge (cc0)
  1178.               (const_int 0))
  1179.               (label_ref (match_operand 0 "" ""))
  1180.               (pc)))]
  1181.   ""
  1182.   "* return gen_cmp (operands[0], \"lt\", 'f'); ")
  1183.  
  1184. (define_insn "bgeu"
  1185.   [(set (pc)
  1186.     (if_then_else (geu (cc0)
  1187.                (const_int 0))
  1188.               (label_ref (match_operand 0 "" ""))
  1189.               (pc)))]
  1190.   ""
  1191.   "* return gen_cmp (operands[0], \"ltu\", 'f'); ")
  1192.  
  1193. (define_insn "ble"
  1194.   [(set (pc)
  1195.     (if_then_else (le (cc0)
  1196.               (const_int 0))
  1197.               (label_ref (match_operand 0 "" ""))
  1198.               (pc)))]
  1199.   ""
  1200.   "* return gen_cmp (operands[0], \"le\", 't'); ")
  1201.  
  1202. (define_insn "bleu"
  1203.   [(set (pc)
  1204.     (if_then_else (leu (cc0)
  1205.                (const_int 0))
  1206.               (label_ref (match_operand 0 "" ""))
  1207.               (pc)))]
  1208.   ""
  1209.   "* return gen_cmp (operands[0], \"leu\", 't'); ")
  1210.  
  1211. (define_insn ""
  1212.   [(set (pc)
  1213.     (if_then_else (eq (cc0)
  1214.               (const_int 0))
  1215.               (pc)
  1216.               (label_ref (match_operand 0 "" ""))))]
  1217.   ""
  1218.   "* return gen_cmp (operands[0], \"eq\", 'f'); ")
  1219.  
  1220. (define_insn ""
  1221.   [(set (pc)
  1222.     (if_then_else (ne (cc0)
  1223.               (const_int 0))
  1224.               (pc)
  1225.               (label_ref (match_operand 0 "" ""))))]
  1226.   ""
  1227.   "* return gen_cmp (operands[0], \"eq\", 't'); ")
  1228.  
  1229. (define_insn ""
  1230.   [(set (pc)
  1231.     (if_then_else (gt (cc0)
  1232.               (const_int 0))
  1233.               (pc)
  1234.               (label_ref (match_operand 0 "" ""))))]
  1235.   ""
  1236.   "* return gen_cmp (operands[0], \"le\", 't'); ")
  1237.  
  1238. (define_insn ""
  1239.   [(set (pc)
  1240.     (if_then_else (gtu (cc0)
  1241.                (const_int 0))
  1242.               (pc)
  1243.               (label_ref (match_operand 0 "" ""))))]
  1244.   ""
  1245.   "* return gen_cmp (operands[0], \"leu\", 't'); ")
  1246.  
  1247. (define_insn ""
  1248.   [(set (pc)
  1249.     (if_then_else (lt (cc0)
  1250.               (const_int 0))
  1251.               (pc)
  1252.               (label_ref (match_operand 0 "" ""))))]
  1253.   ""
  1254.   "* return gen_cmp (operands[0], \"lt\", 'f'); ")
  1255.  
  1256. (define_insn ""
  1257.   [(set (pc)
  1258.     (if_then_else (ltu (cc0)
  1259.                (const_int 0))
  1260.               (pc)
  1261.               (label_ref (match_operand 0 "" ""))))]
  1262.   ""
  1263.   "* return gen_cmp (operands[0], \"ltu\", 'f'); ")
  1264.  
  1265. (define_insn ""
  1266.   [(set (pc)
  1267.     (if_then_else (ge (cc0)
  1268.               (const_int 0))
  1269.               (pc)
  1270.               (label_ref (match_operand 0 "" ""))))]
  1271.   ""
  1272.   "* return gen_cmp (operands[0], \"lt\", 't'); ")
  1273.  
  1274. (define_insn ""
  1275.   [(set (pc)
  1276.     (if_then_else (geu (cc0)
  1277.                (const_int 0))
  1278.               (pc)
  1279.               (label_ref (match_operand 0 "" ""))))]
  1280.   ""
  1281.   "* return gen_cmp (operands[0], \"ltu\", 't'); ")
  1282.  
  1283. (define_insn ""
  1284.   [(set (pc)
  1285.     (if_then_else (le (cc0)
  1286.               (const_int 0))
  1287.               (pc)
  1288.               (label_ref (match_operand 0 "" ""))))]
  1289.   ""
  1290.   "* return gen_cmp (operands[0], \"le\", 'f'); ")
  1291.  
  1292. (define_insn ""
  1293.   [(set (pc)
  1294.     (if_then_else (leu (cc0)
  1295.                (const_int 0))
  1296.               (pc)
  1297.               (label_ref (match_operand 0 "" ""))))]
  1298.   ""
  1299.   "* return gen_cmp (operands[0], \"leu\", 'f'); ")
  1300.  
  1301. ;;  - Calls
  1302. ;;
  1303. ;; arg count word may be omitted to save a push and let gcc try to
  1304. ;; combine the arg list pop.  RETURN_POPS_ARGS from tm.h decides this.
  1305.  
  1306. (define_insn "call"
  1307.   [(call (match_operand:QI 0 "memory_operand" "m")
  1308.      (match_operand 1 "" "g"))]
  1309.   ""
  1310.   "* return output_call (insn, operands[0], operands[1]);")
  1311.  
  1312. (define_insn "call_value"
  1313.   [(set (match_operand 0 "" "=g")
  1314.     (call (match_operand:QI 1 "memory_operand" "m")
  1315.           (match_operand 2 "" "g")))]
  1316.   ""
  1317.   "* return output_call (insn, operands[1], operands[2]);")
  1318.  
  1319. (define_insn "return"
  1320.   [(return)]
  1321.   ""
  1322.   "rtn")
  1323.  
  1324. (define_insn "nop"
  1325.   [(const_int 0)]
  1326.   ""
  1327.   "nop")
  1328.  
  1329. (define_insn "tablejump"
  1330.   [(set (pc) (match_operand:SI 0 "address_operand" "p"))
  1331.    (use (label_ref (match_operand 1 "" "")))]
  1332.   ""
  1333.   "jmp %a0")
  1334.  
  1335. (define_insn "indirect_jump"
  1336.   [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
  1337.   ""
  1338.   "jmp %a0")
  1339.  
  1340. ;;- Local variables:
  1341. ;;- mode:emacs-lisp
  1342. ;;- comment-start: ";;- "
  1343. ;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
  1344. ;;- eval: (modify-syntax-entry ?[ "(]")
  1345. ;;- eval: (modify-syntax-entry ?] ")[")
  1346. ;;- eval: (modify-syntax-entry ?{ "(}")
  1347. ;;- eval: (modify-syntax-entry ?} "){")
  1348. ;;- End:
  1349.