home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / gccsrc3.lzh / GCCSRC3 / MD < prev    next >
Text File  |  1993-07-23  |  116KB  |  4,103 lines

  1. ;;- Machine description for GNU compiler
  2. ;;- Motorola 68000 Version
  3. ;;   Copyright (C) 1987, 1988 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 1, or (at your option)
  10. ;; any later version.
  11.  
  12. ;; GNU CC is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ;; GNU General Public License for more details.
  16.  
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU CC; see the file COPYING.  If not, write to
  19. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  
  22. ;;- instruction definitions
  23.  
  24. ;;- @@The original PO technology requires these to be ordered by speed,
  25. ;;- @@    so that assigner will pick the fastest.
  26.  
  27. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  28.  
  29. ;;- When naming insn's (operand 0 of define_insn) be careful about using
  30. ;;- names from other targets machine descriptions.
  31.  
  32. ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
  33. ;;- updates for most instructions.
  34.  
  35. ;;- Operand classes for the register allocator:
  36. ;;- 'a' one of the address registers can be used.
  37. ;;- 'd' one of the data registers can be used.
  38. ;;- 'f' one of the m68881 registers can be used
  39. ;;- 'r' either a data or an address register can be used.
  40. ;;- 'x' if one of the Sun FPA registers                    
  41. ;;- 'y' if one of the Low Sun FPA registers (fpa0-fpa15).
  42.  
  43. ;;- Immediate Floating point operator constraints
  44. ;;- 'G' a floating point constant that is *NOT* one of the standard
  45. ;;   68881 constant values (to force calling output_move_const_double
  46. ;;   to get it from rom if it is a 68881 constant).
  47. ;;- 'H' one of the standard FPA constant values
  48. ;;
  49. ;;   See the functions standard_XXX_constant_p in output-m68k.c for more
  50. ;; info.
  51.  
  52. ;;- Immediate integer operand constraints:
  53. ;;- 'I'  1 .. 8
  54. ;;- 'J'  -32768 .. 32767
  55. ;;- 'K'  -128 .. 127
  56. ;;- 'L'  -8 .. -1
  57.  
  58. ;;-         FPA port explanation:
  59.  
  60. ;;-        Usage of the Sun FPA and the 68881 together
  61.  
  62. ;;- The current port of gcc to the sun fpa disallows use of the m68881
  63. ;;- instructions completely if code is targetted for the fpa.  This is
  64. ;;- for the following reasons:
  65.  
  66. ;;- 1) Expressing the preference hierarchy (ie. use the fpa if you
  67. ;;- can, the 68881 otherwise, and data registers only if you are
  68. ;;- forced to it) is a bitch with the current constraint scheme,
  69. ;;- especially since it would have to work for any combination of
  70. ;;- -mfpa, -m68881.
  71.  
  72. ;;- 2) There are no instructions to move between the two types of
  73. ;;- registers; the stack must be used as an intermediary.
  74.  
  75. ;;- It could indeed be done; I think the best way would be to have
  76. ;;- seperate patterns for TARGET_FPA (which implies a 68881),
  77. ;;- TARGET_68881, and no floating point co-processor.  Use
  78. ;;- define_expands for all of the named instruction patterns, and
  79. ;;- include code in the FPA instruction to deal with the 68881 with
  80. ;;- preferences specifically set to favor the fpa.  Some of this has
  81. ;;- already been done:
  82. ;;-
  83. ;;-     1) Separation of most of the patterns out into a TARGET_FPA
  84. ;;- case and a TARGET_68881 case (the exceptions are the patterns
  85. ;;- which would need one define_expand and three define_insn's under
  86. ;;- it (with alot of duplicate code between them) to replace the
  87. ;;- current single define_insn.  These are mov{[ds]f,[ds]i} and the
  88. ;;- first two patterns in the md.
  89. ;;-
  90. ;;- Some would still have to be done:
  91. ;;-
  92. ;;-    1) Add code to the fpa patterns which correspond to 68881
  93. ;;- patterns to deal with the 68881 case (including preferences!).
  94. ;;- What you might actually do here is combine the fpa and 68881 code
  95. ;;- back together into one pattern for those instructions where it's
  96. ;;- absolutely necessary and save yourself some duplicate code.  I'm
  97. ;;- not completely sure as to whether you could get away with doing
  98. ;;- this only for the mov* insns, or if you'd have to do it for all
  99. ;;- named insns.
  100. ;;-     2) Add code to the mov{[ds]f,[ds]i} instructions to handle
  101. ;;- moving between fpa regs and 68881 regs.
  102.  
  103. ;;- Since the fpa is more powerful than the 68881 and also has more
  104. ;;- registers, and since I think the reultant md would be medium ugly
  105. ;;- (lot's of duplicate code, ugly constraint strings), I elected not
  106. ;;- to do this change.
  107.  
  108. ;;- Another reason why someone *might* want to do the change is to
  109. ;;- control which register classes are accessed in a slightly cleaner
  110. ;;- way than I have.  See the blurb on CONDITIONAL_REGISTER_USAGE in
  111. ;;- the internals manual.
  112.  
  113. ;;- Yet another reason why someone might want to do this change is to
  114. ;;- allow use of some of the 68881 insns which have no equivalent on
  115. ;;- the fpa.  The sqrt instruction comes fairly quickly to mind.
  116.  
  117. ;;- If this is ever done, don't forget to change tm-sun3.h so that
  118. ;;- it *will* define __HAVE_68881__ when the FPA is in use.
  119.  
  120. ;;-        Condition code hack
  121.  
  122. ;;- When a floating point compare is done in the fpa, the resulting
  123. ;;- condition codes are left in the fpastatus register.  The values in
  124. ;;- this register must be moved into the 68000 cc register before any
  125. ;;- jump is executed.  Once this has been done, regular jump
  126. ;;- instructions are fine (ie. floating point jumps are not necessary.
  127. ;;- They are only done if the cc is in the 68881).
  128.  
  129. ;;- The instructions that move the fpastatus register to the 68000
  130. ;;- register clobber a data register (the move cannot be done direct).
  131. ;;- These instructions might be bundled either with the compare
  132. ;;- instruction, or the branch instruction.  If we were using both the
  133. ;;- fpa and the 68881 together, we would wish to only mark the
  134. ;;- register clobbered if we were doing the compare in the fpa, but I
  135. ;;- think that that decision (whether to clobber the register or not)
  136. ;;- must be done before register allocation (makes sense) and hence we
  137. ;;- can't know if the floating point compare will be done in the fpa
  138. ;;- or the fp.  So whenever we are asked for code that uses the fpa,
  139. ;;- we will mark a data register as clobbered.  This is reasonable, as
  140. ;;- almost all floating point compare operations done with fpa code
  141. ;;- enabled will be done in the fpa.  It's even more reasonable since
  142. ;;- we decided to make the 68881 and the fpa mutually exclusive.
  143.  
  144. ;;- We place to code to move the fpastatus register inside of a
  145. ;;- define_expand so that we can do it conditionally based on whether
  146. ;;- we are tagetting an fpa or not.
  147.  
  148. ;;- This still leaves us with the question of where we wish to put the
  149. ;;- code to move the fpastatus reg.  If we put it in the compare
  150. ;;- instruction, we can restrict the clobbering of the register to
  151. ;;- floating point compares, but we can't take advantage of floating
  152. ;;- point subtracts & etc. that alter the fpastatus register.  If we
  153. ;;- put it in the branch instruction, all branches compiled with fpa
  154. ;;- code enabled will clobber a data register, but we will be able to
  155. ;;- take advantage of fpa subtracts.  This balance favors putting the
  156. ;;- code in with the compare instruction.
  157.  
  158. ;;- Note that if some enterprising hacker should decide to switch
  159. ;;- this, he'll need to modify the code in NOTICE_UPDATE_CC.
  160.  
  161. ;;-        Usage of the top 16 fpa registers
  162.  
  163. ;;- The only locations which we may transfer fpa registers 16-31 from
  164. ;;- or to are the fpa registers 0-15.  (68000 registers and memory
  165. ;;- locations are impossible).  This causes problems in gcc, which
  166. ;;- assumes that mov?? instructions require no additional registers
  167. ;;- (see section 11.7) and since floating point moves *must* be
  168. ;;- supported into general registers (see section 12.3 under
  169. ;;- HARD_REGNO_OK_FOR_MODE_P) from anywhere.
  170.  
  171. ;;- My solution was to reserve fpa0 for moves into or out of these top
  172. ;;- 16 registers and to disparage the choice to reload into or out of
  173. ;;- these registers as much as I could.  That alternative is always
  174. ;;- last in the list, so it will not be used unless all else fails.  I
  175. ;;- will note that according to my current information, sun's compiler
  176. ;;- doesn't use these top 16 registers at all.
  177.  
  178. ;;- There is another possible way to do it.  I *believe* that if you
  179. ;;- make absolutely sure that the code will not be exectued in the
  180. ;;- reload pass, you can support the mov?? names with define_expands
  181. ;;- which require new registers.  This may be possible by the
  182. ;;- appropriate juggling of constraints.  I may come back to this later.
  183.  
  184. ;;-         Usage of constant RAM
  185.  
  186. ;;- This has been handled correctly (I believe) but the way I've done
  187. ;;- it could use a little explanation.  The constant RAM can only be
  188. ;;- accessed when the instruction is in "command register" mode.
  189. ;;- "command register" mode means that no accessing of memory or the
  190. ;;- 68000 registers is being done.  This can be expressed easily in
  191. ;;- constraints, so generally the mode of the instruction is
  192. ;;- determined by a branch off of which_alternative.  In outputing
  193. ;;- instructions, a 'w' means to output an access to the constant ram
  194. ;;- (if the arg is CONST_DOUBLE and is one of the available
  195. ;;- constants), and 'x' means to output a register pair (if the arg is
  196. ;;- a 68000 register) and a 'y' is the combination of the above two
  197. ;;- processies.  You use a 'y' in two operand DF instructions where you
  198. ;;- *know* the other operand is an fpa register, you use an 'x' in DF
  199. ;;- instructions where the arg might be a 68000 register and the
  200. ;;- instruction is *not* in "command register" mode, and you use a 'w'
  201. ;;- in two situations: 1) The instruction *is* in command register
  202. ;;- mode (and hence won't be accessing 68000 registers), or 2) The
  203. ;;- instruction is a two operand SF instruction where you know the
  204. ;;- other operand is an fpa register.
  205.  
  206. ;;-        Optimization issues
  207.  
  208. ;;- I actually think that I've included all of the fpa instructions
  209. ;;- that should be included.  Note that if someone is interested in
  210. ;;- doing serious floating point work on the sun fpa, I would advise
  211. ;;- the use of the "asm" instruction in gcc to allow you to use the
  212. ;;- sin, cos, and exponential functions on the fpa board.
  213.  
  214. ;;- END FPA Explanation Section.
  215.  
  216.  
  217. ;;- Some of these insn's are composites of several m68000 op codes.
  218. ;;- The assembler (or final @@??) insures that the appropriate one is
  219. ;;- selected.
  220.  
  221. (define_insn ""
  222.   [(set (match_operand:DF 0 "push_operand" "=m")
  223.     (match_operand:DF 1 "general_operand" "ro<>fyF"))]
  224.   ""
  225.   "*
  226. {
  227.   if (FP_REG_P (operands[1]))
  228.     return \"fmove%.d %f1,%0\";
  229.   if (FPA_REG_P (operands[1]))
  230.     return \"fpmove%.d %1, %x0\";
  231.   return output_move_double (operands);
  232. }")
  233.  
  234. (define_insn ""
  235.   [(set (match_operand:DI 0 "push_operand" "=m")
  236.     (match_operand:DI 1 "general_operand" "ro<>Fy"))]
  237.   ""
  238.   "*
  239. {
  240.   return output_move_double (operands);
  241. }")
  242.  
  243. ;; Put tstsi first among test insns so it matches a CONST_INT operand.
  244.  
  245. (define_insn "tstsi"
  246.   [(set (cc0)
  247.     (match_operand:SI 0 "general_operand" "rm"))]
  248.   ""
  249.   "*
  250. {
  251. #ifdef ISI_OV
  252.   /* ISI's assembler fails to handle tstl a0.  */
  253.   if (! ADDRESS_REG_P (operands[0]))
  254. #else
  255.   if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
  256. #endif
  257.     return \"tst%.l %0\";
  258.   /* If you think that the 68020 does not support tstl a0,
  259.      reread page B-167 of the 68020 manual more carefully.  */
  260.   /* On an address reg, cmpw may replace cmpl.  */
  261. #ifdef HPUX_ASM
  262.   return \"cmp%.w %0,%#0\";
  263. #else
  264.   return \"cmp%.w %#0,%0\";
  265. #endif
  266. }")
  267.  
  268. (define_insn "tsthi"
  269.   [(set (cc0)
  270.     (match_operand:HI 0 "general_operand" "rm"))]
  271.   ""
  272.   "*
  273. {
  274. #ifdef ISI_OV
  275.   if (! ADDRESS_REG_P (operands[0]))
  276. #else
  277.   if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
  278. #endif
  279.     return \"tst%.w %0\";
  280. #ifdef HPUX_ASM
  281.   return \"cmp%.w %0,%#0\";
  282. #else
  283.   return \"cmp%.w %#0,%0\";
  284. #endif
  285. }")
  286.  
  287. (define_insn "tstqi"
  288.   [(set (cc0)
  289.     (match_operand:QI 0 "general_operand" "dm"))]
  290.   ""
  291.   "tst%.b %0")
  292.   
  293. (define_expand "tstsf"
  294.   [(set (cc0)
  295.     (match_operand:SF 0 "general_operand" ""))]
  296.   "TARGET_68881 || TARGET_FPA"
  297.   "
  298. {
  299.   if (TARGET_FPA)
  300.     {
  301.       emit_insn (gen_rtx (PARALLEL, VOIDmode,
  302.                   gen_rtvec (2,
  303.                      gen_rtx (SET, VOIDmode,
  304.                           cc0_rtx, operands[0]),
  305.                      gen_rtx (CLOBBER, VOIDmode,
  306.                           gen_reg_rtx (SImode)))));
  307.       DONE;
  308.     }
  309. }")
  310.  
  311. (define_insn ""
  312.   [(set (cc0)
  313.     (match_operand:SF 0 "general_operand" "xmdF"))
  314.    (clobber (match_operand:SI 1 "general_operand" "d"))]
  315.   "TARGET_FPA"
  316.   "fptst%.s %x0\;fpmove fpastatus,%1\;movw %1,cc")
  317.  
  318. (define_insn ""
  319.   [(set (cc0)
  320.     (match_operand:SF 0 "general_operand" "fdm"))]
  321.   "TARGET_68881"
  322.   "*
  323. {
  324.   cc_status.flags = CC_IN_68881;
  325.   if (FP_REG_P (operands[0]))
  326.     return \"ftst%.x %0\";
  327.   return \"ftst%.s %0\";
  328. }")
  329.  
  330. (define_expand "tstdf"
  331.   [(set (cc0)
  332.     (match_operand:DF 0 "general_operand" ""))]
  333.   "TARGET_68881 || TARGET_FPA"
  334.   "
  335. {
  336.   if (TARGET_FPA)
  337.     {
  338.       emit_insn (gen_rtx (PARALLEL, VOIDmode,
  339.               gen_rtvec (2, gen_rtx (SET, VOIDmode,
  340.                          cc0_rtx, operands[0]),
  341.                      gen_rtx (CLOBBER, VOIDmode,
  342.                           gen_reg_rtx (SImode)))));
  343.       DONE;
  344.     }
  345. }")
  346.  
  347. (define_insn ""
  348.   [(set (cc0)
  349.     (match_operand:DF 0 "general_operand" "xrmF"))
  350.    (clobber (match_operand:SI 1 "general_operand" "d"))]
  351.   "TARGET_FPA"
  352.   "fptst%.d %x0\;fpmove fpastatus,%1\;movw %1,cc")
  353.  
  354. (define_insn ""
  355.   [(set (cc0)
  356.     (match_operand:DF 0 "general_operand" "fm"))]
  357.   "TARGET_68881"
  358.   "*
  359. {
  360.   cc_status.flags = CC_IN_68881;
  361.   if (FP_REG_P (operands[0]))
  362.     return \"ftst%.x %0\";
  363.   return \"ftst%.d %0\";
  364. }")
  365.  
  366. ;; compare instructions.
  367.  
  368. ;; Put cmpsi first among compare insns so it matches two CONST_INT operands.
  369.  
  370. ;; A composite of the cmp, cmpa, & cmpi m68000 op codes.
  371. (define_insn "cmpsi"
  372.   [(set (cc0)
  373.     (compare (match_operand:SI 0 "general_operand" "rKs,mr,>")
  374.          (match_operand:SI 1 "general_operand" "mr,Ksr,>")))]
  375.   ""
  376.   "*
  377. {
  378.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  379.     return \"cmpm%.l %1,%0\";
  380.   if (REG_P (operands[1])
  381.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  382.     { cc_status.flags |= CC_REVERSED;
  383. #ifdef HPUX_ASM
  384.       return \"cmp%.l %d1,%d0\";
  385. #else
  386.       return \"cmp%.l %d0,%d1\"; 
  387. #endif
  388.     }
  389. #ifdef HPUX_ASM
  390.   return \"cmp%.l %d0,%d1\";
  391. #else
  392.   return \"cmp%.l %d1,%d0\";
  393. #endif
  394. }")
  395.  
  396. (define_insn "cmphi"
  397.   [(set (cc0)
  398.     (compare (match_operand:HI 0 "general_operand" "rnm,d,n,m")
  399.          (match_operand:HI 1 "general_operand" "d,rnm,m,n")))]
  400.   ""
  401.   "*
  402. {
  403.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  404.     return \"cmpm%.w %1,%0\";
  405.   if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
  406.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  407.     { cc_status.flags |= CC_REVERSED;
  408. #ifdef HPUX_ASM
  409.       return \"cmp%.w %d1,%d0\";
  410. #else
  411.       return \"cmp%.w %d0,%d1\"; 
  412. #endif
  413.     }
  414. #ifdef HPUX_ASM
  415.   return \"cmp%.w %d0,%d1\";
  416. #else
  417.   return \"cmp%.w %d1,%d0\";
  418. #endif
  419. }")
  420.  
  421. (define_insn "cmpqi"
  422.   [(set (cc0)
  423.     (compare (match_operand:QI 0 "general_operand" "dn,md,>")
  424.          (match_operand:QI 1 "general_operand" "dm,nd,>")))]
  425.   ""
  426.   "*
  427. {
  428.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  429.     return \"cmpm%.b %1,%0\";
  430.   if (REG_P (operands[1])
  431.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  432.     { cc_status.flags |= CC_REVERSED;
  433. #ifdef HPUX_ASM
  434.       return \"cmp%.b %d1,%d0\";
  435. #else
  436.       return \"cmp%.b %d0,%d1\";
  437. #endif
  438.     }
  439. #ifdef HPUX_ASM
  440.   return \"cmp%.b %d0,%d1\";
  441. #else
  442.   return \"cmp%.b %d1,%d0\";
  443. #endif
  444. }")
  445.  
  446. (define_expand "cmpdf"
  447.   [(set (cc0)
  448.     (compare (match_operand:DF 0 "general_operand" "")
  449.          (match_operand:DF 1 "general_operand" "")))]
  450.   "TARGET_68881 || TARGET_FPA"
  451.   "
  452. {
  453.   if (TARGET_FPA)
  454.     {
  455.       rtx set = gen_rtx (SET, VOIDmode, cc0_rtx,
  456.              gen_rtx (COMPARE, VOIDmode, operands[0], operands[1]));
  457.       emit_insn (gen_rtx (PARALLEL, VOIDmode,
  458.                   gen_rtvec (2, set,
  459.                      gen_rtx (CLOBBER, VOIDmode,
  460.                           gen_reg_rtx (SImode)))));
  461.       DONE;
  462.     }
  463. }")
  464.  
  465. (define_insn ""
  466.   [(set (cc0)
  467.     (compare (match_operand:DF 0 "general_operand" "x,y")
  468.          (match_operand:DF 1 "general_operand" "xH,rmF")))
  469.    (clobber (match_operand:SI 2 "general_operand" "d,d"))]
  470.   "TARGET_FPA"
  471.   "fpcmp%.d %y1,%0\;fpmove fpastatus,%2\;movw %2,cc")
  472.  
  473. (define_insn ""
  474.   [(set (cc0)
  475.     (compare (match_operand:DF 0 "general_operand" "f,mG")
  476.          (match_operand:DF 1 "general_operand" "fmG,f")))]
  477.   "TARGET_68881"
  478.   "*
  479. {
  480.   cc_status.flags = CC_IN_68881;
  481. #ifdef HPUX_ASM
  482.   if (REG_P (operands[0]))
  483.     {
  484.       if (REG_P (operands[1]))
  485.     return \"fcmp%.x %0,%1\";
  486.       else
  487.         return \"fcmp%.d %0,%f1\";
  488.     }
  489.   cc_status.flags |= CC_REVERSED;
  490.   return \"fcmp%.d %1,%f0\";
  491. #else
  492.   if (REG_P (operands[0]))
  493.     {
  494.       if (REG_P (operands[1]))
  495.     return \"fcmp%.x %1,%0\";
  496.       else
  497.         return \"fcmp%.d %f1,%0\";
  498.     }
  499.   cc_status.flags |= CC_REVERSED;
  500.   return \"fcmp%.d %f0,%1\";
  501. #endif
  502. }")
  503.  
  504. (define_expand "cmpsf"
  505.  [(set (cc0)
  506.        (compare (match_operand:SF 0 "general_operand" "")
  507.         (match_operand:SF 1 "general_operand" "")))]
  508.  "TARGET_68881 || TARGET_FPA"
  509.  "
  510. {
  511.   if (TARGET_FPA)
  512.     {
  513.       rtx set = gen_rtx (SET, VOIDmode, cc0_rtx,
  514.              gen_rtx (COMPARE, VOIDmode, operands[0], operands[1]));
  515.       emit_insn (gen_rtx (PARALLEL, VOIDmode,
  516.               gen_rtvec (2, set,
  517.                      gen_rtx (CLOBBER, VOIDmode,
  518.                           gen_reg_rtx(SImode)))));
  519.       DONE;
  520.     }
  521. }")
  522.  
  523. (define_insn ""
  524.   [(set (cc0)
  525.     (compare (match_operand:SF 0 "general_operand" "x,y")
  526.          (match_operand:SF 1 "general_operand" "xH,rmF")))
  527.    (clobber (match_operand:SI 2 "general_operand" "d,d"))]
  528.   "TARGET_FPA"
  529.   "fpcmp%.s %w1,%x0\;fpmove fpastatus,%2\;movw %2,cc")
  530.  
  531. (define_insn ""
  532.   [(set (cc0)
  533.     (compare (match_operand:SF 0 "general_operand" "f,mdG")
  534.          (match_operand:SF 1 "general_operand" "fmdG,f")))]
  535.   "TARGET_68881"
  536.   "*
  537. {
  538.   cc_status.flags = CC_IN_68881;
  539. #ifdef HPUX_ASM
  540.   if (FP_REG_P (operands[0]))
  541.     {
  542.       if (FP_REG_P (operands[1]))
  543.     return \"fcmp%.x %0,%1\";
  544.       else
  545.         return \"fcmp%.s %0,%f1\";
  546.     }
  547.   cc_status.flags |= CC_REVERSED;
  548.   return \"fcmp%.s %1,%f0\";
  549. #else
  550.   if (FP_REG_P (operands[0]))
  551.     {
  552.       if (FP_REG_P (operands[1]))
  553.     return \"fcmp%.x %1,%0\";
  554.       else
  555.         return \"fcmp%.s %f1,%0\";
  556.     }
  557.   cc_status.flags |= CC_REVERSED;
  558.   return \"fcmp%.s %f0,%1\";
  559. #endif
  560. }")
  561.  
  562. ;; Recognizers for btst instructions.
  563.  
  564. (define_insn ""
  565.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do")
  566.                 (const_int 1)
  567.                 (minus:SI (const_int 7)
  568.                       (match_operand:SI 1 "general_operand" "di"))))]
  569.   ""
  570.   "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
  571.  
  572. (define_insn ""
  573.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d")
  574.                 (const_int 1)
  575.                 (minus:SI (const_int 31)
  576.                       (match_operand:SI 1 "general_operand" "di"))))]
  577.   ""
  578.   "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
  579.  
  580. ;; The following two patterns are like the previous two
  581. ;; except that they use the fact that bit-number operands
  582. ;; are automatically masked to 3 or 5 bits.
  583.  
  584. (define_insn ""
  585.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do")
  586.                 (const_int 1)
  587.                 (minus:SI (const_int 7)
  588.                       (and:SI
  589.                        (match_operand:SI 1 "general_operand" "d")
  590.                        (const_int 7)))))]
  591.   ""
  592.   "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
  593.  
  594. (define_insn ""
  595.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d")
  596.                 (const_int 1)
  597.                 (minus:SI (const_int 31)
  598.                       (and:SI
  599.                        (match_operand:SI 1 "general_operand" "d")
  600.                        (const_int 31)))))]
  601.   ""
  602.   "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
  603.  
  604. ;; Nonoffsettable mem refs are ok in this one pattern
  605. ;; since we don't try to adjust them.
  606. (define_insn ""
  607.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "md")
  608.                 (const_int 1)
  609.                 (match_operand:SI 1 "general_operand" "i")))]
  610.   "GET_CODE (operands[1]) == CONST_INT
  611.    && (unsigned) INTVAL (operands[1]) < 8"
  612.   "*
  613. {
  614.   operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - INTVAL (operands[1]));
  615.   return output_btst (operands, operands[1], operands[0], insn, 7);
  616. }")
  617.  
  618. (define_insn ""
  619.   ;; The constraint "o,d" here means that a nonoffsettable memref
  620.   ;; will match the first alternative, and its address will be reloaded.
  621.   ;; Copying the memory contents into a reg would be incorrect if the
  622.   ;; bit position is over 7.
  623.   [(set (cc0) (zero_extract (match_operand:HI 0 "nonimmediate_operand" "o,d")
  624.                 (const_int 1)
  625.                 (match_operand:SI 1 "general_operand" "i,i")))]
  626.   "GET_CODE (operands[1]) == CONST_INT"
  627.   "*
  628. {
  629.   if (GET_CODE (operands[0]) == MEM)
  630.     {
  631.       operands[0] = adj_offsettable_operand (operands[0],
  632.                          INTVAL (operands[1]) / 8);
  633.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  634.                  7 - INTVAL (operands[1]) % 8);
  635.       return output_btst (operands, operands[1], operands[0], insn, 7);
  636.     }
  637.   operands[1] = gen_rtx (CONST_INT, VOIDmode,
  638.              15 - INTVAL (operands[1]));
  639.   return output_btst (operands, operands[1], operands[0], insn, 15);
  640. }")
  641.  
  642. (define_insn ""
  643.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "do")
  644.                 (const_int 1)
  645.                 (match_operand:SI 1 "general_operand" "i")))]
  646.   "GET_CODE (operands[1]) == CONST_INT"
  647.   "*
  648. {
  649.   if (GET_CODE (operands[0]) == MEM)
  650.     {
  651.       operands[0] = adj_offsettable_operand (operands[0],
  652.                          INTVAL (operands[1]) / 8);
  653.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  654.                  7 - INTVAL (operands[1]) % 8);
  655.       return output_btst (operands, operands[1], operands[0], insn, 7);
  656.     }
  657.   operands[1] = gen_rtx (CONST_INT, VOIDmode,
  658.              31 - INTVAL (operands[1]));
  659.   return output_btst (operands, operands[1], operands[0], insn, 31);
  660. }")
  661.  
  662. (define_insn ""
  663.   [(set (cc0) (subreg:SI (lshiftrt:QI (match_operand:QI 0 "nonimmediate_operand" "dm")
  664.                       (const_int 7))
  665.              0))]
  666.   ""
  667.   "*
  668. {
  669.   cc_status.flags = CC_Z_IN_NOT_N | CC_NOT_NEGATIVE;
  670.   return \"tst%.b %0\";
  671. }")
  672.  
  673. (define_insn ""
  674.   [(set (cc0) (and:SI (sign_extend:SI (sign_extend:HI (match_operand:QI 0 "nonimmediate_operand" "dm")))
  675.               (match_operand:SI 1 "general_operand" "i")))]
  676.   "(GET_CODE (operands[1]) == CONST_INT
  677.     && (unsigned) INTVAL (operands[1]) < 0x100
  678.     && exact_log2 (INTVAL (operands[1])) >= 0)"
  679.   "*
  680. { register int log = exact_log2 (INTVAL (operands[1]));
  681.   operands[1] = gen_rtx (CONST_INT, VOIDmode, log);
  682.   return output_btst (operands, operands[1], operands[0], insn, 7);
  683. }")
  684.  
  685. ;; move instructions
  686.  
  687. ;; A special case in which it is not desirable
  688. ;; to reload the constant into a data register.
  689. (define_insn ""
  690.   [(set (match_operand:SI 0 "push_operand" "=m")
  691.     (match_operand:SI 1 "general_operand" "J"))]
  692.   "GET_CODE (operands[1]) == CONST_INT
  693.    && INTVAL (operands[1]) >= -0x8000
  694.    && INTVAL (operands[1]) < 0x8000"
  695.   "*
  696. {
  697.   if (operands[1] == const0_rtx)
  698.     return \"clr%.l %0\";
  699.   return \"pea %a1\";
  700. }")
  701.  
  702. ;This is never used.
  703. ;(define_insn "swapsi"
  704. ;  [(set (match_operand:SI 0 "general_operand" "r")
  705. ;    (match_operand:SI 1 "general_operand" "r"))
  706. ;   (set (match_dup 1) (match_dup 0))]
  707. ;  ""
  708. ;  "exg %1,%0")
  709.  
  710. ;; Special case of fullword move when source is zero.
  711. ;; The reason this is special is to avoid loading a zero
  712. ;; into a data reg with moveq in order to store it elsewhere.
  713.    
  714. (define_insn ""
  715.   [(set (match_operand:SI 0 "general_operand" "=g")
  716.     (const_int 0))]
  717.   ""
  718.   "*
  719. {
  720.   if (ADDRESS_REG_P (operands[0]))
  721.     return \"sub%.l %0,%0\";
  722.   /* moveq is faster on the 68000.  */
  723.   if (DATA_REG_P (operands[0]) && !TARGET_68020)
  724. #ifdef MOTOROLA
  725.     return \"moveq%.l %#0,%0\";
  726. #else
  727.     return \"moveq %#0,%0\";
  728. #endif
  729.   return \"clr%.l %0\";
  730. }")
  731.  
  732. ;; General case of fullword move.  The register constraints
  733. ;; force integer constants in range for a moveq to be reloaded
  734. ;; if they are headed for memory.
  735. (define_insn "movsi"
  736.   ;; Notes: make sure no alternative allows g vs g.
  737.   ;; We don't allow f-regs since fixed point cannot go in them.
  738.   ;; We do allow y and x regs since fixed point is allowed in them.
  739.   [(set (match_operand:SI 0 "general_operand" "=g,da,y,!*x*r*m")
  740.     (match_operand:SI 1 "general_operand" "daymKs,i,g,*x*r*m"))]
  741.   ""
  742.   "*
  743. {
  744.   if (which_alternative == 3)
  745.     return \"fpmove%.l %x1,fpa0\;fpmove%.l fpa0,%x0\";    
  746.   if (FPA_REG_P (operands[1]) || FPA_REG_P (operands[0]))
  747.     return \"fpmove%.l %x1,%x0\";
  748.   if (GET_CODE (operands[1]) == CONST_INT)
  749.     {
  750.       if (operands[1] == const0_rtx
  751.       && (DATA_REG_P (operands[0])
  752.           || GET_CODE (operands[0]) == MEM))
  753.     return \"clr%.l %0\";
  754.       else if (DATA_REG_P (operands[0])
  755.            && INTVAL (operands[1]) < 128
  756.            && INTVAL (operands[1]) >= -128)
  757.         {
  758. #ifdef MOTOROLA
  759.           return \"moveq%.l %1,%0\";
  760. #else
  761.       return \"moveq %1,%0\";
  762. #endif
  763.     }
  764.       else if (ADDRESS_REG_P (operands[0])
  765.            && INTVAL (operands[1]) < 0x8000
  766.            && INTVAL (operands[1]) >= -0x8000)
  767.     return \"move%.w %1,%0\";
  768.       else if (push_operand (operands[0], SImode)
  769.            && INTVAL (operands[1]) < 0x8000
  770.            && INTVAL (operands[1]) >= -0x8000)
  771.         return \"pea %a1\";
  772.     }
  773.   else if ((GET_CODE (operands[1]) == SYMBOL_REF
  774.         || GET_CODE (operands[1]) == CONST)
  775.        && push_operand (operands[0], SImode))
  776.     return \"pea %a1\";
  777.   else if ((GET_CODE (operands[1]) == SYMBOL_REF
  778.         || GET_CODE (operands[1]) == CONST)
  779.        && ADDRESS_REG_P (operands[0]))
  780.     return \"lea %a1,%0\";
  781.   return \"move%.l %1,%0\";
  782. }")
  783.  
  784. (define_insn "movhi"
  785.   [(set (match_operand:HI 0 "general_operand" "=g")
  786.     (match_operand:HI 1 "general_operand" "g"))]
  787.   ""
  788.   "*
  789. {
  790.   if (GET_CODE (operands[1]) == CONST_INT)
  791.     {
  792.       if (operands[1] == const0_rtx
  793.       && (DATA_REG_P (operands[0])
  794.           || GET_CODE (operands[0]) == MEM))
  795.     return \"clr%.w %0\";
  796.       else if (DATA_REG_P (operands[0])
  797.            && INTVAL (operands[1]) < 128
  798.            && INTVAL (operands[1]) >= -128)
  799.         {
  800. #ifdef MOTOROLA
  801.           return \"moveq%.l %1,%0\";
  802. #else
  803.       return \"moveq %1,%0\";
  804. #endif
  805.     }
  806.       else if (INTVAL (operands[1]) < 0x8000
  807.            && INTVAL (operands[1]) >= -0x8000)
  808.     return \"move%.w %1,%0\";
  809.     }
  810.   else if (CONSTANT_P (operands[1]))
  811.     return \"move%.l %1,%0\";
  812. #ifndef SONY_ASM
  813.   /* Recognize the insn before a tablejump, one that refers
  814.      to a table of offsets.  Such an insn will need to refer
  815.      to a label on the insn.  So output one.  Use the label-number
  816.      of the table of offsets to generate this label.  */
  817.   if (GET_CODE (operands[1]) == MEM
  818.       && GET_CODE (XEXP (operands[1], 0)) == PLUS
  819.       && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
  820.       || GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == LABEL_REF)
  821.       && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS
  822.       && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) != PLUS)
  823.     {
  824.       rtx labelref;
  825.       if (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF)
  826.     labelref = XEXP (XEXP (operands[1], 0), 0);
  827.       else
  828.     labelref = XEXP (XEXP (operands[1], 0), 1);
  829. #if defined (MOTOROLA) && ! defined (SGS_3B1)
  830. #ifdef SGS
  831.       fprintf (asm_out_file, \"\\tset %s%d,.+2\\n\", \"LI\",
  832.            CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  833. #else /* not SGS */
  834.       fprintf (asm_out_file, \"\\t.set %s%d,.+2\\n\", \"LI\",
  835.            CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  836. #endif /* not SGS */
  837. #else /* SGS_3B1 or not MOTOROLA */
  838.       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\",
  839.                  CODE_LABEL_NUMBER (XEXP (labelref, 0)));
  840.       /* For sake of 3b1, set flag saying we need to define the symbol
  841.          LD%n (with value L%n-LI%n) at the end of the switch table.  */
  842.       RTX_INTEGRATED_P (next_real_insn (XEXP (labelref, 0))) = 1;
  843. #endif /* SGS_3B1 or not MOTOROLA */
  844.     }
  845. #endif /* SONY_ASM */
  846.   return \"move%.w %1,%0\";
  847. }")
  848.  
  849. (define_insn "movstricthi"
  850.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  851.     (match_operand:HI 1 "general_operand" "rmn"))]
  852.   ""
  853.   "*
  854. {
  855.   if (GET_CODE (operands[1]) == CONST_INT)
  856.     {
  857.       if (operands[1] == const0_rtx
  858.       && (DATA_REG_P (operands[0])
  859.           || GET_CODE (operands[0]) == MEM))
  860.     return \"clr%.w %0\";
  861.     }
  862.   return \"move%.w %1,%0\";
  863. }")
  864.  
  865. (define_insn "movqi"
  866.   [(set (match_operand:QI 0 "general_operand" "=d,*a,m,m,?*a")
  867.     (match_operand:QI 1 "general_operand" "dmi*a,d*a,dmi,?*a,m"))]
  868.   ""
  869.   "*
  870. {
  871.   rtx xoperands[4];
  872.   if (ADDRESS_REG_P (operands[0]) && GET_CODE (operands[1]) == MEM)
  873.     {
  874.       xoperands[1] = operands[1];
  875.       xoperands[2]
  876.         = gen_rtx (MEM, QImode,
  877.            gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
  878.       xoperands[3] = stack_pointer_rtx;
  879.       /* Just pushing a byte puts it in the high byte of the halfword.  */
  880.       /* We must put it in the low half, the second byte.  */
  881.       output_asm_insn (\"subq%.w %#2,%3\;move%.b %1,%2\", xoperands);
  882.       return \"move%.w %+,%0\";
  883.     }
  884.   if (ADDRESS_REG_P (operands[1]) && GET_CODE (operands[0]) == MEM)
  885.     {
  886.       xoperands[0] = operands[0];
  887.       xoperands[1] = operands[1];
  888.       xoperands[2]
  889.         = gen_rtx (MEM, QImode,
  890.            gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
  891.       xoperands[3] = stack_pointer_rtx;
  892.       output_asm_insn (\"move%.w %1,%-\;move%.b %2,%0\;addq%.w %#2,%3\", xoperands);
  893.       return \"\";
  894.     }
  895.   if (operands[1] == const0_rtx)
  896.     return \"clr%.b %0\";
  897.   if (GET_CODE (operands[1]) == CONST_INT
  898.       && INTVAL (operands[1]) == -1)
  899.     return \"st %0\";
  900.   if (GET_CODE (operands[1]) != CONST_INT && CONSTANT_P (operands[1]))
  901.     return \"move%.l %1,%0\";
  902.   if (ADDRESS_REG_P (operands[0]) || ADDRESS_REG_P (operands[1]))
  903.     return \"move%.w %1,%0\";
  904.   return \"move%.b %1,%0\";
  905. }")
  906.  
  907. (define_insn "movstrictqi"
  908.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  909.     (match_operand:QI 1 "general_operand" "dmn"))]
  910.   ""
  911.   "*
  912. {
  913.   if (operands[1] == const0_rtx)
  914.     return \"clr%.b %0\";
  915.   return \"move%.b %1,%0\";
  916. }")
  917.  
  918. (define_insn "movsf"
  919.   [(set (match_operand:SF 0 "general_operand" "=rmf,x,y,rm,!x,!rm")
  920.     (match_operand:SF 1 "general_operand" "rmfF,xH,rmF,y,rm,x"))]
  921. ;  [(set (match_operand:SF 0 "general_operand" "=rmf")
  922. ;    (match_operand:SF 1 "general_operand" "rmfF"))]
  923.   ""
  924.   "*
  925. {
  926.   if (which_alternative >= 4)
  927.     return \"fpmove%.s %1,fpa0\;fpmove%.s fpa0,%0\";
  928.   if (FPA_REG_P (operands[0]))
  929.     {
  930.       if (FPA_REG_P (operands[1]))
  931.     return \"fpmove%.s %x1,%x0\";
  932.       else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  933.     return output_move_const_single (operands);
  934.       else if (FP_REG_P (operands[1]))
  935.         return \"fmove%.s %1,sp@-\;fpmove%.d sp@+, %0\";
  936.       return \"fpmove%.s %x1,%x0\";
  937.     }
  938.   if (FPA_REG_P (operands[1]))
  939.     {
  940.       if (FP_REG_P (operands[0]))
  941.     return \"fpmove%.s %x1,sp@-\;fmove%.s sp@+,%0\";
  942.       else
  943.     return \"fpmove%.s %x1,%x0\";
  944.     }
  945.   if (FP_REG_P (operands[0]))
  946.     {
  947.       if (FP_REG_P (operands[1]))
  948.     return \"fmove%.x %1,%0\";
  949.       else if (ADDRESS_REG_P (operands[1]))
  950.     return \"move%.l %1,%-\;fmove%.s %+,%0\";
  951.       else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  952.     return output_move_const_single (operands);
  953.       return \"fmove%.s %f1,%0\";
  954.     }
  955.   if (FP_REG_P (operands[1]))
  956.     {
  957.       if (ADDRESS_REG_P (operands[0]))
  958.     return \"fmove%.s %1,%-\;move%.l %+,%0\";
  959.       return \"fmove%.s %f1,%0\";
  960.     }
  961.   return \"move%.l %1,%0\";
  962. }")
  963.  
  964. (define_insn "movdf"
  965.   [(set (match_operand:DF 0 "general_operand" "=rm,&rf,&rof<>,y,rm,x,!x,!rm")
  966.     (match_operand:DF 1 "general_operand" "rf,m,rofF<>,rmF,y,xH,rm,x"))]
  967. ;  [(set (match_operand:DF 0 "general_operand" "=rm,&rf,&rof<>")
  968. ;    (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
  969.   ""
  970.   "*
  971. {
  972.   if (which_alternative == 6)
  973.     return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
  974.   if (FPA_REG_P (operands[0]))
  975.     {
  976.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  977.     return output_move_const_double (operands);
  978.       if (FP_REG_P (operands[1]))
  979.         return \"fmove%.d %1,sp@-\;fpmove%.d sp@+,%x0\";
  980.       return \"fpmove%.d %x1,%x0\";
  981.     }
  982.   else if (FPA_REG_P (operands[1]))
  983.     {
  984.       if (FP_REG_P(operands[0]))
  985.         return \"fpmove%.d %x1,sp@-\;fmoved sp@+,%0\";
  986.       else
  987.         return \"fpmove%.d %x1,%x0\";
  988.     }
  989.   if (FP_REG_P (operands[0]))
  990.     {
  991.       if (FP_REG_P (operands[1]))
  992.     return \"fmove%.x %1,%0\";
  993.       if (REG_P (operands[1]))
  994.     {
  995.       rtx xoperands[2];
  996.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  997.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  998.       output_asm_insn (\"move%.l %1,%-\", operands);
  999.       return \"fmove%.d %+,%0\";
  1000.     }
  1001.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1002.     return output_move_const_double (operands);
  1003.       return \"fmove%.d %f1,%0\";
  1004.     }
  1005.   else if (FP_REG_P (operands[1]))
  1006.     {
  1007.       if (REG_P (operands[0]))
  1008.     {
  1009.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  1010.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1011.       return \"move%.l %+,%0\";
  1012.     }
  1013.       else
  1014.         return \"fmove%.d %f1,%0\";
  1015.     }
  1016.   return output_move_double (operands);
  1017. }
  1018. ")
  1019.  
  1020. ;; movdi can apply to fp regs in some cases
  1021. (define_insn "movdi"
  1022.   ;; Let's see if it really still needs to handle fp regs, and, if so, why.
  1023.   [(set (match_operand:DI 0 "general_operand" "=rm,&r,&ro<>,y,rm,!*x,!rm")
  1024.     (match_operand:DI 1 "general_operand" "rF,m,roi<>F,rmiF,y,rmF,*x"))]
  1025. ;  [(set (match_operand:DI 0 "general_operand" "=rm,&r,&ro<>,!&rm,!&f,y,rm,x,!x,!rm")
  1026. ;    (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfmF,rmi,y,rm,x"))]
  1027. ;  [(set (match_operand:DI 0 "general_operand" "=rm,&rf,&ro<>,!&rm,!&f")
  1028. ;    (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
  1029.   ""
  1030.   "*
  1031. {
  1032.   if (which_alternative == 8)
  1033.     return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
  1034.   if (FPA_REG_P (operands[0]) || FPA_REG_P (operands[1]))
  1035.     return \"fpmove%.d %x1,%x0\";
  1036.   if (FP_REG_P (operands[0]))
  1037.     {
  1038.       if (FP_REG_P (operands[1]))
  1039.     return \"fmove%.x %1,%0\";
  1040.       if (REG_P (operands[1]))
  1041.     {
  1042.       rtx xoperands[2];
  1043.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  1044.       output_asm_insn (\"move%.l %1,%-\", xoperands);
  1045.       output_asm_insn (\"move%.l %1,%-\", operands);
  1046.       return \"fmove%.d %+,%0\";
  1047.     }
  1048.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  1049.     return output_move_const_double (operands);
  1050.       return \"fmove%.d %f1,%0\";
  1051.     }
  1052.   else if (FP_REG_P (operands[1]))
  1053.     {
  1054.       if (REG_P (operands[0]))
  1055.     {
  1056.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  1057.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1058.       return \"move%.l %+,%0\";
  1059.     }
  1060.       else
  1061.         return \"fmove%.d %f1,%0\";
  1062.     }
  1063.   return output_move_double (operands);
  1064. }
  1065. ")
  1066.  
  1067. ;; Thus goes after the move instructions
  1068. ;; because the move instructions are better (require no spilling)
  1069. ;; when they can apply.  It goes before the add/sub insns
  1070. ;; so we will prefer it to them.
  1071.  
  1072. (define_insn "pushasi"
  1073.   [(set (match_operand:SI 0 "push_operand" "=m")
  1074.     (match_operand:SI 1 "address_operand" "p"))]
  1075.   ""
  1076.   "pea %a1")
  1077.  
  1078. ;; truncation instructions
  1079. (define_insn "truncsiqi2"
  1080.   [(set (match_operand:QI 0 "general_operand" "=dm,d")
  1081.     (truncate:QI
  1082.      (match_operand:SI 1 "general_operand" "doJ,i")))]
  1083.   ""
  1084.   "*
  1085. {
  1086.   if (GET_CODE (operands[0]) == REG)
  1087.     return \"move%.l %1,%0\";
  1088.   if (GET_CODE (operands[1]) == MEM)
  1089.     operands[1] = adj_offsettable_operand (operands[1], 3);
  1090.   return \"move%.b %1,%0\";
  1091. }")
  1092.  
  1093. (define_insn "trunchiqi2"
  1094.   [(set (match_operand:QI 0 "general_operand" "=dm,d")
  1095.     (truncate:QI
  1096.      (match_operand:HI 1 "general_operand" "doJ,i")))]
  1097.   ""
  1098.   "*
  1099. {
  1100.   if (GET_CODE (operands[0]) == REG
  1101.       && (GET_CODE (operands[1]) == MEM
  1102.       || GET_CODE (operands[1]) == CONST_INT))
  1103.     return \"move%.w %1,%0\";
  1104.   if (GET_CODE (operands[0]) == REG)
  1105.     return \"move%.l %1,%0\";
  1106.   if (GET_CODE (operands[1]) == MEM)
  1107.     operands[1] = adj_offsettable_operand (operands[1], 1);
  1108.   return \"move%.b %1,%0\";
  1109. }")
  1110.  
  1111. (define_insn "truncsihi2"
  1112.   [(set (match_operand:HI 0 "general_operand" "=dm,d")
  1113.     (truncate:HI
  1114.      (match_operand:SI 1 "general_operand" "roJ,i")))]
  1115.   ""
  1116.   "*
  1117. {
  1118.   if (GET_CODE (operands[0]) == REG)
  1119.     return \"move%.l %1,%0\";
  1120.   if (GET_CODE (operands[1]) == MEM)
  1121.     operands[1] = adj_offsettable_operand (operands[1], 2);
  1122.   return \"move%.w %1,%0\";
  1123. }")
  1124.  
  1125. ;; zero extension instructions
  1126.  
  1127. (define_expand "zero_extendhisi2"
  1128.   [(set (match_operand:SI 0 "register_operand" "")
  1129.     (const_int 0))
  1130.    (set (strict_low_part (subreg:HI (match_dup 0) 0))
  1131.     (match_operand:HI 1 "general_operand" ""))]
  1132.   ""
  1133.   "operands[1] = make_safe_from (operands[1], operands[0]);")
  1134.  
  1135. (define_expand "zero_extendqihi2"
  1136.   [(set (match_operand:HI 0 "register_operand" "")
  1137.     (const_int 0))
  1138.    (set (strict_low_part (subreg:QI (match_dup 0) 0))
  1139.     (match_operand:QI 1 "general_operand" ""))]
  1140.   ""
  1141.   "operands[1] = make_safe_from (operands[1], operands[0]);")
  1142.  
  1143. (define_expand "zero_extendqisi2"
  1144.   [(set (match_operand:SI 0 "register_operand" "")
  1145.     (const_int 0))
  1146.    (set (strict_low_part (subreg:QI (match_dup 0) 0))
  1147.     (match_operand:QI 1 "general_operand" ""))]
  1148.   ""
  1149.   " operands[1] = make_safe_from (operands[1], operands[0]); ")
  1150.  
  1151. ;; Patterns to recognize zero-extend insns produced by the combiner.
  1152.  
  1153. ;; Note that the one starting from HImode comes before those for QImode
  1154. ;; so that a constant operand will match HImode, not QImode.
  1155. (define_insn ""
  1156.   [(set (match_operand:SI 0 "general_operand" "=do<>")
  1157.     (zero_extend:SI
  1158.      (match_operand:HI 1 "general_operand" "rmn")))]
  1159.   ""
  1160.   "*
  1161. {
  1162.   if (DATA_REG_P (operands[0]))
  1163.     {
  1164.       if (GET_CODE (operands[1]) == REG
  1165.       && REGNO (operands[0]) == REGNO (operands[1]))
  1166.     return \"and%.l %#0xFFFF,%0\";
  1167.       if (reg_mentioned_p (operands[0], operands[1]))
  1168.         return \"move%.w %1,%0\;and%.l %#0xFFFF,%0\";
  1169.       return \"clr%.l %0\;move%.w %1,%0\";
  1170.     }
  1171.   else if (GET_CODE (operands[0]) == MEM
  1172.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  1173.     return \"move%.w %1,%0\;clr%.w %0\";
  1174.   else if (GET_CODE (operands[0]) == MEM
  1175.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  1176.     return \"clr%.w %0\;move%.w %1,%0\";
  1177.   else
  1178.     {
  1179.       output_asm_insn (\"clr%.w %0\", operands);
  1180.       operands[0] = adj_offsettable_operand (operands[0], 2);
  1181.       return \"move%.w %1,%0\";
  1182.     }
  1183. }")
  1184.  
  1185. (define_insn ""
  1186.   [(set (match_operand:HI 0 "general_operand" "=do<>")
  1187.     (zero_extend:HI
  1188.      (match_operand:QI 1 "general_operand" "dmn")))]
  1189.   ""
  1190.   "*
  1191. {
  1192.   if (DATA_REG_P (operands[0]))
  1193.     {
  1194.       if (GET_CODE (operands[1]) == REG
  1195.       && REGNO (operands[0]) == REGNO (operands[1]))
  1196.     return \"and%.w %#0xFF,%0\";
  1197.       if (reg_mentioned_p (operands[0], operands[1]))
  1198.         return \"move%.b %1,%0\;and%.w %#0xFF,%0\";
  1199.       return \"clr%.w %0\;move%.b %1,%0\";
  1200.     }
  1201.   else if (GET_CODE (operands[0]) == MEM
  1202.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  1203.     {
  1204.       if (REGNO (XEXP (XEXP (operands[0], 0), 0))
  1205.       == STACK_POINTER_REGNUM)
  1206. #if 0 /* BUG */
  1207.     return \"clr%.w %-\;move%.b %1,%0\";
  1208. #else
  1209.         {
  1210.           operands[0] = XEXP (XEXP (operands[0], 0), 0);
  1211. #ifdef   MOTOROLA
  1212. #ifdef SGS
  1213.           return \"clr.w -(%0)\;move%.b %1,1(%0)\";
  1214. #else
  1215.           return \"clr.w -(%0)\;move%.b %1,(1,%0)\";
  1216. #endif
  1217. #else
  1218.           return \"clrw %0@-\;moveb %1,%0@(1)\";
  1219. #endif
  1220.         }
  1221. #endif
  1222.       else
  1223.     return \"move%.b %1,%0\;clr%.b %0\";
  1224.     }
  1225.   else if (GET_CODE (operands[0]) == MEM
  1226.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  1227.     return \"clr%.b %0\;move%.b %1,%0\";
  1228.   else
  1229.     {
  1230.       output_asm_insn (\"clr%.b %0\", operands);
  1231.       operands[0] = adj_offsettable_operand (operands[0], 1);
  1232.       return \"move%.b %1,%0\";
  1233.     }
  1234. }")
  1235.  
  1236. (define_insn ""
  1237.   [(set (match_operand:SI 0 "general_operand" "=do<>")
  1238.     (zero_extend:SI
  1239.      (match_operand:QI 1 "general_operand" "dmn")))]
  1240.   ""
  1241.   "*
  1242. {
  1243.   if (DATA_REG_P (operands[0]))
  1244.     {
  1245.       if (GET_CODE (operands[1]) == REG
  1246.       && REGNO (operands[0]) == REGNO (operands[1]))
  1247.     return \"and%.l %#0xFF,%0\";
  1248.       if (reg_mentioned_p (operands[0], operands[1]))
  1249.         return \"move%.b %1,%0\;and%.l %#0xFF,%0\";
  1250.       return \"clr%.l %0\;move%.b %1,%0\";
  1251.     }
  1252.   else if (GET_CODE (operands[0]) == MEM
  1253.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  1254.     {
  1255.       operands[0] = XEXP (XEXP (operands[0], 0), 0);
  1256. #ifdef MOTOROLA
  1257. #ifdef SGS
  1258.       return \"clr.l -(%0)\;move%.b %1,3(%0)\";
  1259. #else
  1260.       return \"clr.l -(%0)\;move%.b %1,(3,%0)\";
  1261. #endif
  1262. #else
  1263.       return \"clrl %0@-\;moveb %1,%0@(3)\";
  1264. #endif
  1265.     }
  1266.   else if (GET_CODE (operands[0]) == MEM
  1267.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  1268.     {
  1269.       operands[0] = XEXP (XEXP (operands[0], 0), 0);
  1270. #ifdef MOTOROLA
  1271. #ifdef SGS
  1272.       return \"clr.l (%0)+\;move%.b %1,-1(%0)\";
  1273. #else
  1274.       return \"clr.l (%0)+\;move%.b %1,(-1,%0)\";
  1275. #endif
  1276. #else
  1277.       return \"clrl %0@+\;moveb %1,%0@(-1)\";
  1278. #endif
  1279.     }
  1280.   else
  1281.     {
  1282.       output_asm_insn (\"clr%.l %0\", operands);
  1283.       operands[0] = adj_offsettable_operand (operands[0], 3);
  1284.       return \"move%.b %1,%0\";
  1285.     }
  1286. }")
  1287.  
  1288. ;; sign extension instructions
  1289. ;; Note that the one starting from HImode comes before those for QImode
  1290. ;; so that a constant operand will match HImode, not QImode.
  1291.  
  1292. (define_insn "extendhisi2"
  1293.   [(set (match_operand:SI 0 "general_operand" "=*d,a")
  1294.     (sign_extend:SI
  1295.      (match_operand:HI 1 "general_operand" "0,rmn")))]
  1296.   ""
  1297.   "*
  1298. {
  1299.   if (ADDRESS_REG_P (operands[0]))
  1300.     return \"move%.w %1,%0\";
  1301.   return \"ext%.l %0\";
  1302. }")
  1303.  
  1304. (define_insn "extendqihi2"
  1305.   [(set (match_operand:HI 0 "general_operand" "=d")
  1306.     (sign_extend:HI
  1307.      (match_operand:QI 1 "general_operand" "0")))]
  1308.   ""
  1309.   "ext%.w %0")
  1310.  
  1311. (define_insn "extendqisi2"
  1312.   [(set (match_operand:SI 0 "general_operand" "=d")
  1313.     (sign_extend:SI
  1314.      (match_operand:QI 1 "general_operand" "0")))]
  1315.   "TARGET_68020"
  1316.   "extb%.l %0")
  1317.  
  1318. ;; Conversions between float and double.
  1319.  
  1320. (define_expand "extendsfdf2"
  1321.   [(set (match_operand:DF 0 "general_operand" "")
  1322.     (float_extend:DF
  1323.      (match_operand:SF 1 "general_operand" "")))]
  1324.   "TARGET_68881 || TARGET_FPA"
  1325.   "")
  1326.  
  1327. (define_insn ""
  1328.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  1329.     (float_extend:DF
  1330.      (match_operand:SF 1 "general_operand" "xH,rmF")))]
  1331.   "TARGET_FPA"
  1332.   "fpstod %w1,%0")
  1333.  
  1334. (define_insn ""
  1335.   [(set (match_operand:DF 0 "general_operand" "=*fdm,f")
  1336.     (float_extend:DF
  1337.       (match_operand:SF 1 "general_operand" "f,dmF")))]
  1338.   "TARGET_68881"
  1339.   "*
  1340. {
  1341.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  1342.     {
  1343.       if (REGNO (operands[0]) == REGNO (operands[1]))
  1344.     {
  1345.       /* Extending float to double in an fp-reg is a no-op.
  1346.          NOTICE_UPDATE_CC has already assumed that the
  1347.          cc will be set.  So cancel what it did.  */
  1348.       cc_status = cc_prev_status;
  1349.       return \"\";
  1350.     }
  1351.       return \"fmove%.x %1,%0\";
  1352.     }
  1353.   if (FP_REG_P (operands[0]))
  1354.     return \"fmove%.s %f1,%0\";
  1355.   if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
  1356.     {
  1357.       output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
  1358.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1359.       return \"move%.l %+,%0\";
  1360.     }
  1361.   return \"fmove%.d %f1,%0\";
  1362. }")
  1363.  
  1364. ;; This cannot output into an f-reg because there is no way to be
  1365. ;; sure of truncating in that case.
  1366. ;; But on the Sun FPA, we can be sure.
  1367. (define_expand "truncdfsf2"
  1368.   [(set (match_operand:SF 0 "general_operand" "")
  1369.     (float_truncate:SF
  1370.       (match_operand:DF 1 "general_operand" "")))]
  1371.   "TARGET_68881 || TARGET_FPA"
  1372.   "")
  1373.  
  1374. (define_insn ""
  1375.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  1376.     (float_truncate:SF
  1377.       (match_operand:DF 1 "general_operand" "xH,rmF")))]
  1378.   "TARGET_FPA"
  1379.   "fpdtos %y1,%0")
  1380.  
  1381. (define_insn ""
  1382.   [(set (match_operand:SF 0 "general_operand" "=dm")
  1383.     (float_truncate:SF
  1384.       (match_operand:DF 1 "general_operand" "f")))]
  1385.   "TARGET_68881"
  1386.   "fmove%.s %f1,%0")
  1387.  
  1388. ;; Conversion between fixed point and floating point.
  1389. ;; Note that among the fix-to-float insns
  1390. ;; the ones that start with SImode come first.
  1391. ;; That is so that an operand that is a CONST_INT
  1392. ;; (and therefore lacks a specific machine mode).
  1393. ;; will be recognized as SImode (which is always valid)
  1394. ;; rather than as QImode or HImode.
  1395.  
  1396. (define_expand "floatsisf2"
  1397.   [(set (match_operand:SF 0 "general_operand" "")
  1398.     (float:SF (match_operand:SI 1 "general_operand" "")))]
  1399.   "TARGET_68881 || TARGET_FPA"
  1400.   "")
  1401.  
  1402. (define_insn ""
  1403.   [(set (match_operand:SF 0 "general_operand" "=y,x")
  1404.     (float:SF (match_operand:SI 1 "general_operand" "rmi,x")))]
  1405.   "TARGET_FPA"
  1406.   "fpltos %1,%0")
  1407.  
  1408. (define_insn ""
  1409.   [(set (match_operand:SF 0 "general_operand" "=f")
  1410.     (float:SF (match_operand:SI 1 "general_operand" "dmi")))]
  1411.   "TARGET_68881"
  1412.   "fmove%.l %1,%0")
  1413.  
  1414. (define_expand "floatsidf2"
  1415.   [(set (match_operand:DF 0 "general_operand" "")
  1416.     (float:DF (match_operand:SI 1 "general_operand" "")))]
  1417.   "TARGET_68881 || TARGET_FPA"
  1418.   "")
  1419.  
  1420. (define_insn ""
  1421.   [(set (match_operand:DF 0 "general_operand" "=y,x")
  1422.     (float:DF (match_operand:SI 1 "general_operand" "rmi,x")))]
  1423.   "TARGET_FPA"
  1424.   "fpltod %1,%0")
  1425.  
  1426. (define_insn ""
  1427.   [(set (match_operand:DF 0 "general_operand" "=f")
  1428.     (float:DF (match_operand:SI 1 "general_operand" "dmi")))]
  1429.   "TARGET_68881"
  1430.   "fmove%.l %1,%0")
  1431.  
  1432. (define_insn "floathisf2"
  1433.   [(set (match_operand:SF 0 "general_operand" "=f")
  1434.     (float:SF (match_operand:HI 1 "general_operand" "dmn")))]
  1435.   "TARGET_68881"
  1436.   "fmove%.w %1,%0")
  1437.  
  1438. (define_insn "floathidf2"
  1439.   [(set (match_operand:DF 0 "general_operand" "=f")
  1440.     (float:DF (match_operand:HI 1 "general_operand" "dmn")))]
  1441.   "TARGET_68881"
  1442.   "fmove%.w %1,%0")
  1443.  
  1444. (define_insn "floatqisf2"
  1445.   [(set (match_operand:SF 0 "general_operand" "=f")
  1446.     (float:SF (match_operand:QI 1 "general_operand" "dmn")))]
  1447.   "TARGET_68881"
  1448.   "fmove%.b %1,%0")
  1449.  
  1450. (define_insn "floatqidf2"
  1451.   [(set (match_operand:DF 0 "general_operand" "=f")
  1452.     (float:DF (match_operand:QI 1 "general_operand" "dmn")))]
  1453.   "TARGET_68881"
  1454.   "fmove%.b %1,%0")
  1455.  
  1456. ;; Convert a float to a float whose value is an integer.
  1457. ;; This is the first stage of converting it to an integer type.
  1458.  
  1459. (define_insn "ftruncdf2"
  1460.   [(set (match_operand:DF 0 "general_operand" "=f")
  1461.     (fix:DF (match_operand:DF 1 "general_operand" "fFm")))]
  1462.   "TARGET_68881"
  1463.   "*
  1464. {
  1465.   if (FP_REG_P (operands[1]))
  1466.     return \"fintrz%.x %f1,%0\";
  1467.   return \"fintrz%.d %f1,%0\";
  1468. }")
  1469.  
  1470. (define_insn "ftruncsf2"
  1471.   [(set (match_operand:SF 0 "general_operand" "=f")
  1472.     (fix:SF (match_operand:SF 1 "general_operand" "dfFm")))]
  1473.   "TARGET_68881"
  1474.   "*
  1475. {
  1476.   if (FP_REG_P (operands[1]))
  1477.     return \"fintrz%.x %f1,%0\";
  1478.   return \"fintrz%.s %f1,%0\";
  1479. }")
  1480.  
  1481. ;; Convert a float whose value is an integer
  1482. ;; to an actual integer.  Second stage of converting float to integer type.
  1483. (define_insn "fixsfqi2"
  1484.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1485.     (fix:QI (match_operand:SF 1 "general_operand" "f")))]
  1486.   "TARGET_68881"
  1487.   "fmove%.b %1,%0")
  1488.  
  1489. (define_insn "fixsfhi2"
  1490.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1491.     (fix:HI (match_operand:SF 1 "general_operand" "f")))]
  1492.   "TARGET_68881"
  1493.   "fmove%.w %1,%0")
  1494.  
  1495. (define_insn "fixsfsi2"
  1496.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1497.     (fix:SI (match_operand:SF 1 "general_operand" "f")))]
  1498.   "TARGET_68881"
  1499.   "fmove%.l %1,%0")
  1500.  
  1501. (define_insn "fixdfqi2"
  1502.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1503.     (fix:QI (match_operand:DF 1 "general_operand" "f")))]
  1504.   "TARGET_68881"
  1505.   "fmove%.b %1,%0")
  1506.  
  1507. (define_insn "fixdfhi2"
  1508.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1509.     (fix:HI (match_operand:DF 1 "general_operand" "f")))]
  1510.   "TARGET_68881"
  1511.   "fmove%.w %1,%0")
  1512.  
  1513. (define_insn "fixdfsi2"
  1514.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1515.     (fix:SI (match_operand:DF 1 "general_operand" "f")))]
  1516.   "TARGET_68881"
  1517.   "fmove%.l %1,%0")
  1518.  
  1519. ;; Convert a float to an integer.
  1520. ;; On the Sun FPA, this is done in one step.
  1521.  
  1522. (define_insn "fix_truncsfsi2"
  1523.   [(set (match_operand:SI 0 "general_operand" "=x,y")
  1524.     (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "xH,rmF"))))]
  1525.   "TARGET_FPA"
  1526.   "fpstol %w1,%0")
  1527.  
  1528. (define_insn "fix_truncdfsi2"
  1529.   [(set (match_operand:SI 0 "general_operand" "=x,y")
  1530.     (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "xH,rmF"))))]
  1531.   "TARGET_FPA"
  1532.   "fpdtol %y1,%0")
  1533.  
  1534. ;; add instructions
  1535.  
  1536. ;; Note that the last two alternatives are near-duplicates
  1537. ;; in order to handle insns generated by reload.
  1538. ;; This is needed since they are not themselves reloaded,
  1539. ;; so commutativity won't apply to them.
  1540. (define_insn "addsi3"
  1541.   [(set (match_operand:SI 0 "general_operand" "=m,r,!a,!a")
  1542.     (plus:SI (match_operand:SI 1 "general_operand" "%0,0,a,rJK")
  1543.          (match_operand:SI 2 "general_operand" "dIKLs,mrIKLs,rJK,a")))]
  1544.   ""
  1545.   "*
  1546. {
  1547.   if (! operands_match_p (operands[0], operands[1]))
  1548.     {
  1549.       if (!ADDRESS_REG_P (operands[1]))
  1550.     {
  1551.       rtx tmp = operands[1];
  1552.  
  1553.       operands[1] = operands[2];
  1554.       operands[2] = tmp;
  1555.     }
  1556.  
  1557.       /* These insns can result from reloads to access
  1558.      stack slots over 64k from the frame pointer.  */
  1559.       if (GET_CODE (operands[2]) == CONST_INT
  1560.       && INTVAL (operands[2]) + 0x8000 >= (unsigned) 0x10000)
  1561.         return \"move%.l %2,%0\;add%.l %1,%0\";
  1562. #ifdef SGS
  1563.       if (GET_CODE (operands[2]) == REG)
  1564.     return \"lea 0(%1,%2.l),%0\";
  1565.       else
  1566.     return \"lea %c2(%1),%0\";
  1567. #else /* not SGS */
  1568. #ifdef MOTOROLA
  1569.       if (GET_CODE (operands[2]) == REG)
  1570.     return \"lea (%1,%2.l),%0\";
  1571.       else
  1572.     return \"lea (%c2,%1),%0\";
  1573. #else /* not MOTOROLA (MIT syntax) */
  1574.       if (GET_CODE (operands[2]) == REG)
  1575.     return \"lea %1@(0,%2:l),%0\";
  1576.       else
  1577.     return \"lea %1@(%c2),%0\";
  1578. #endif /* not MOTOROLA */
  1579. #endif /* not SGS */
  1580.     }
  1581.   if (GET_CODE (operands[2]) == CONST_INT)
  1582.     {
  1583. #ifndef NO_ADDSUB_Q
  1584.       if (INTVAL (operands[2]) > 0
  1585.       && INTVAL (operands[2]) <= 8)
  1586.     return (ADDRESS_REG_P (operands[0])
  1587.         ? \"addq%.w %2,%0\"
  1588.         : \"addq%.l %2,%0\");
  1589.       if (INTVAL (operands[2]) < 0
  1590.       && INTVAL (operands[2]) >= -8)
  1591.         {
  1592.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1593.                      - INTVAL (operands[2]));
  1594.       return (ADDRESS_REG_P (operands[0])
  1595.           ? \"subq%.w %2,%0\"
  1596.           : \"subq%.l %2,%0\");
  1597.     }
  1598. #endif
  1599.       if (ADDRESS_REG_P (operands[0])
  1600.       && INTVAL (operands[2]) >= -0x8000
  1601.       && INTVAL (operands[2]) < 0x8000)
  1602.     return \"add%.w %2,%0\";
  1603.     }
  1604.   return \"add%.l %2,%0\";
  1605. }")
  1606.  
  1607. (define_insn ""
  1608.   [(set (match_operand:SI 0 "general_operand" "=a")
  1609.     (plus:SI (match_operand:SI 1 "general_operand" "0")
  1610.          (sign_extend:SI (match_operand:HI 2 "general_operand" "rmn"))))]
  1611.   ""
  1612.   "add%.w %2,%0")
  1613.  
  1614. (define_insn "addhi3"
  1615.   [(set (match_operand:HI 0 "general_operand" "=m,r")
  1616.     (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
  1617.          (match_operand:HI 2 "general_operand" "dn,rmn")))]
  1618.   ""
  1619.   "*
  1620. {
  1621. #ifndef NO_ADDSUB_Q
  1622.   if (GET_CODE (operands[2]) == CONST_INT)
  1623.     {
  1624.       if (INTVAL (operands[2]) > 0
  1625.       && INTVAL (operands[2]) <= 8)
  1626.     return \"addq%.w %2,%0\";
  1627.     }
  1628.   if (GET_CODE (operands[2]) == CONST_INT)
  1629.     {
  1630.       if (INTVAL (operands[2]) < 0
  1631.       && INTVAL (operands[2]) >= -8)
  1632.     {
  1633.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1634.                      - INTVAL (operands[2]));
  1635.       return \"subq%.w %2,%0\";
  1636.     }
  1637.     }
  1638. #endif
  1639.   return \"add%.w %2,%0\";
  1640. }")
  1641.  
  1642. (define_insn ""
  1643.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  1644.     (plus:HI (match_dup 0)
  1645.          (match_operand:HI 1 "general_operand" "dn,rmn")))]
  1646.   ""
  1647.   "add%.w %1,%0")
  1648.  
  1649. (define_insn "addqi3"
  1650.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  1651.     (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
  1652.          (match_operand:QI 2 "general_operand" "dn,dmn")))]
  1653.   ""
  1654.   "*
  1655. {
  1656. #ifndef NO_ADDSUB_Q
  1657.   if (GET_CODE (operands[2]) == CONST_INT)
  1658.     {
  1659.       if (INTVAL (operands[2]) > 0
  1660.       && INTVAL (operands[2]) <= 8)
  1661.     return \"addq%.b %2,%0\";
  1662.     }
  1663.   if (GET_CODE (operands[2]) == CONST_INT)
  1664.     {
  1665.       if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
  1666.        {
  1667.      operands[2] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[2]));
  1668.      return \"subq%.b %2,%0\";
  1669.        }
  1670.     }
  1671. #endif
  1672.   return \"add%.b %2,%0\";
  1673. }")
  1674.  
  1675. (define_insn ""
  1676.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  1677.     (plus:QI (match_dup 0)
  1678.          (match_operand:QI 1 "general_operand" "dn,dmn")))]
  1679.   ""
  1680.   "add%.b %1,%0")
  1681.  
  1682. (define_expand "adddf3"
  1683.   [(set (match_operand:DF 0 "general_operand" "")
  1684.     (plus:DF (match_operand:DF 1 "general_operand" "")
  1685.          (match_operand:DF 2 "general_operand" "")))]
  1686.   "TARGET_68881 || TARGET_FPA"
  1687.   "")
  1688.  
  1689. (define_insn ""
  1690.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  1691.     (plus:DF (match_operand:DF 1 "general_operand" "%xH,y")
  1692.          (match_operand:DF 2 "general_operand" "xH,dmF")))]
  1693.   "TARGET_FPA"
  1694.   "*
  1695. {
  1696.   if (rtx_equal_p (operands[0], operands[1]))
  1697.     return \"fpadd%.d %y2,%0\";
  1698.   if (rtx_equal_p (operands[0], operands[2]))
  1699.     return \"fpadd%.d %y1,%0\";
  1700.   if (which_alternative == 0)
  1701.     return \"fpadd3%.d %w2,%w1,%0\";
  1702.   return \"fpadd3%.d %x2,%x1,%0\";
  1703. }")
  1704.  
  1705. (define_insn ""
  1706.   [(set (match_operand:DF 0 "general_operand" "=f")
  1707.     (plus:DF (match_operand:DF 1 "general_operand" "%0")
  1708.          (match_operand:DF 2 "general_operand" "fmG")))]
  1709.   "TARGET_68881"
  1710.   "*
  1711. {
  1712.   if (REG_P (operands[2]))
  1713.     return \"fadd%.x %2,%0\";
  1714.   return \"fadd%.d %f2,%0\";
  1715. }")
  1716.  
  1717. (define_expand "addsf3"
  1718.   [(set (match_operand:SF 0 "general_operand" "")
  1719.     (plus:SF (match_operand:SF 1 "general_operand" "")
  1720.          (match_operand:SF 2 "general_operand" "")))]
  1721.   "TARGET_68881 || TARGET_FPA"
  1722.   "")
  1723.  
  1724. (define_insn ""
  1725.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  1726.     (plus:SF (match_operand:SF 1 "general_operand" "%xH,y")
  1727.          (match_operand:SF 2 "general_operand" "xH,rmF")))]
  1728.   "TARGET_FPA"
  1729.   "*
  1730. {
  1731.   if (rtx_equal_p (operands[0], operands[1]))
  1732.     return \"fpadd%.s %w2,%0\";
  1733.   if (rtx_equal_p (operands[0], operands[2]))
  1734.     return \"fpadd%.s %w1,%0\";
  1735.   if (which_alternative == 0)
  1736.     return \"fpadd3%.s %w2,%w1,%0\";
  1737.   return \"fpadd3%.s %2,%1,%0\";
  1738. }")
  1739.  
  1740. (define_insn ""
  1741.   [(set (match_operand:SF 0 "general_operand" "=f")
  1742.     (plus:SF (match_operand:SF 1 "general_operand" "%0")
  1743.          (match_operand:SF 2 "general_operand" "fdmF")))]
  1744.   "TARGET_68881"
  1745.   "*
  1746. {
  1747.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  1748.     return \"fadd%.x %2,%0\";
  1749.   return \"fadd%.s %f2,%0\";
  1750. }")
  1751.  
  1752. ;; subtract instructions
  1753.  
  1754. (define_insn "subsi3"
  1755.   [(set (match_operand:SI 0 "general_operand" "=m,r,!a,?d")
  1756.     (minus:SI (match_operand:SI 1 "general_operand" "0,0,a,mrIKs")
  1757.           (match_operand:SI 2 "general_operand" "dIKs,mrIKs,J,0")))]
  1758.   ""
  1759.   "*
  1760. {
  1761.   if (! operands_match_p (operands[0], operands[1]))
  1762.     {
  1763.       if (operands_match_p (operands[0], operands[2]))
  1764.     {
  1765. #ifndef NO_ADDSUB_Q
  1766.       if (GET_CODE (operands[1]) == CONST_INT)
  1767.         {
  1768.           if (INTVAL (operands[1]) > 0
  1769.           && INTVAL (operands[1]) <= 8)
  1770.         return \"subq%.l %1,%0\;neg%.l %0\";
  1771.         }
  1772. #endif
  1773.       return \"sub%.l %1,%0\;neg%.l %0\";
  1774.     }
  1775.       /* This case is matched by J, but negating -0x8000
  1776.          in an lea would give an invalid displacement.
  1777.      So do this specially.  */
  1778.       if (INTVAL (operands[2]) == -0x8000)
  1779.     return \"move%.l %1,%0\;sub%.l %2,%0\";
  1780. #ifdef SGS
  1781.       return \"lea %n2(%1),%0\";
  1782. #else
  1783. #ifdef MOTOROLA
  1784.       return \"lea (%n2,%1),%0\";
  1785. #else /* not MOTOROLA (MIT syntax) */
  1786.       return \"lea %1@(%n2),%0\";
  1787. #endif /* not MOTOROLA */
  1788. #endif /* not SGS */
  1789.     }
  1790.   if (GET_CODE (operands[2]) == CONST_INT)
  1791.     {
  1792. #ifndef NO_ADDSUB_Q
  1793.       if (INTVAL (operands[2]) > 0
  1794.       && INTVAL (operands[2]) <= 8)
  1795.     return \"subq%.l %2,%0\";
  1796. #endif
  1797.       if (ADDRESS_REG_P (operands[0])
  1798.       && INTVAL (operands[2]) >= -0x8000
  1799.       && INTVAL (operands[2]) < 0x8000)
  1800.     return \"sub%.w %2,%0\";
  1801.     }
  1802.   return \"sub%.l %2,%0\";
  1803. }")
  1804.  
  1805. (define_insn ""
  1806.   [(set (match_operand:SI 0 "general_operand" "=a")
  1807.     (minus:SI (match_operand:SI 1 "general_operand" "0")
  1808.           (sign_extend:SI (match_operand:HI 2 "general_operand" "rmn"))))]
  1809.   ""
  1810.   "sub%.w %2,%0")
  1811.  
  1812. (define_insn "subhi3"
  1813.   [(set (match_operand:HI 0 "general_operand" "=m,r")
  1814.     (minus:HI (match_operand:HI 1 "general_operand" "0,0")
  1815.           (match_operand:HI 2 "general_operand" "dn,rmn")))]
  1816.   ""
  1817.   "sub%.w %2,%0")
  1818.  
  1819. (define_insn ""
  1820.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  1821.     (minus:HI (match_dup 0)
  1822.           (match_operand:HI 1 "general_operand" "dn,rmn")))]
  1823.   ""
  1824.   "sub%.w %1,%0")
  1825.  
  1826. (define_insn "subqi3"
  1827.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  1828.     (minus:QI (match_operand:QI 1 "general_operand" "0,0")
  1829.           (match_operand:QI 2 "general_operand" "dn,dmn")))]
  1830.   ""
  1831.   "sub%.b %2,%0")
  1832.  
  1833. (define_insn ""
  1834.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  1835.     (minus:QI (match_dup 0)
  1836.           (match_operand:QI 1 "general_operand" "dn,dmn")))]
  1837.   ""
  1838.   "sub%.b %1,%0")
  1839.  
  1840. (define_expand "subdf3"
  1841.   [(set (match_operand:DF 0 "general_operand" "")
  1842.     (minus:DF (match_operand:DF 1 "general_operand" "")
  1843.           (match_operand:DF 2 "general_operand" "")))]
  1844.   "TARGET_68881 || TARGET_FPA"
  1845.   "")
  1846.  
  1847. (define_insn ""
  1848.   [(set (match_operand:DF 0 "general_operand" "=x,y,y")
  1849.     (minus:DF (match_operand:DF 1 "general_operand" "xH,y,dmF")
  1850.           (match_operand:DF 2 "general_operand" "xH,dmF,0")))]
  1851.   "TARGET_FPA"
  1852.   "*
  1853. {
  1854.   if (rtx_equal_p (operands[0], operands[2]))
  1855.     return \"fprsub%.d %y1,%0\";
  1856.   if (rtx_equal_p (operands[0], operands[1]))
  1857.     return \"fpsub%.d %y2,%0\";
  1858.   if (which_alternative == 0)
  1859.     return \"fpsub3%.d %w2,%w1,%0\";
  1860.   return \"fpsub3%.d %x2,%x1,%0\";
  1861. }")
  1862.  
  1863. (define_insn ""
  1864.   [(set (match_operand:DF 0 "general_operand" "=f")
  1865.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  1866.           (match_operand:DF 2 "general_operand" "fmG")))]
  1867.   "TARGET_68881"
  1868.   "*
  1869. {
  1870.   if (REG_P (operands[2]))
  1871.     return \"fsub%.x %2,%0\";
  1872.   return \"fsub%.d %f2,%0\";
  1873. }")
  1874.  
  1875. (define_expand "subsf3"
  1876.   [(set (match_operand:SF 0 "general_operand" "")
  1877.     (minus:SF (match_operand:SF 1 "general_operand" "")
  1878.           (match_operand:SF 2 "general_operand" "")))]
  1879.   "TARGET_68881 || TARGET_FPA"
  1880.   "")
  1881.  
  1882. (define_insn ""
  1883.   [(set (match_operand:SF 0 "general_operand" "=x,y,y")
  1884.     (minus:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
  1885.           (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
  1886.   "TARGET_FPA"
  1887.   "*
  1888. {
  1889.   if (rtx_equal_p (operands[0], operands[2]))
  1890.     return \"fprsub%.s %w1,%0\";
  1891.   if (rtx_equal_p (operands[0], operands[1]))
  1892.     return \"fpsub%.s %w2,%0\";
  1893.   if (which_alternative == 0)
  1894.     return \"fpsub3%.s %w2,%w1,%0\";
  1895.   return \"fpsub3%.s %2,%1,%0\";
  1896. }")
  1897.  
  1898. (define_insn ""
  1899.   [(set (match_operand:SF 0 "general_operand" "=f")
  1900.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  1901.           (match_operand:SF 2 "general_operand" "fdmF")))]
  1902.   "TARGET_68881"
  1903.   "*
  1904. {
  1905.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  1906.     return \"fsub%.x %2,%0\";
  1907.   return \"fsub%.s %f2,%0\";
  1908. }")
  1909.  
  1910. ;; multiply instructions
  1911.  
  1912. (define_insn "mulhi3"
  1913.   [(set (match_operand:HI 0 "general_operand" "=d")
  1914.     (mult:HI (match_operand:HI 1 "general_operand" "%0")
  1915.          (match_operand:HI 2 "general_operand" "dmn")))]
  1916.   ""
  1917.   "*
  1918. {
  1919. #ifdef MOTOROLA
  1920.   return \"muls.w %2,%0\";
  1921. #else
  1922.   return \"muls %2,%0\";
  1923. #endif
  1924. }")
  1925.  
  1926. (define_insn "mulhisi3"
  1927.   [(set (match_operand:SI 0 "general_operand" "=d")
  1928.     (mult:SI (match_operand:HI 1 "general_operand" "%0")
  1929.          (match_operand:HI 2 "general_operand" "dmn")))]
  1930.   ""
  1931.   "*
  1932. {
  1933. #ifdef MOTOROLA
  1934.   return \"muls.w %2,%0\";
  1935. #else
  1936.   return \"muls %2,%0\";
  1937. #endif
  1938. }")
  1939.  
  1940. (define_insn "mulsi3"
  1941.   [(set (match_operand:SI 0 "general_operand" "=d")
  1942.     (mult:SI (match_operand:SI 1 "general_operand" "%0")
  1943.          (match_operand:SI 2 "general_operand" "dmsK")))]
  1944.   "TARGET_68020"
  1945.   "muls%.l %2,%0")
  1946.  
  1947. (define_insn "umulhi3"
  1948.   [(set (match_operand:HI 0 "general_operand" "=d")
  1949.     (umult:HI (match_operand:HI 1 "general_operand" "%0")
  1950.           (match_operand:HI 2 "general_operand" "dmn")))]
  1951.   ""
  1952.   "*
  1953. {
  1954. #ifdef MOTOROLA
  1955.   return \"mulu.w %2,%0\";
  1956. #else
  1957.   return \"mulu %2,%0\";
  1958. #endif
  1959. }")
  1960.  
  1961. (define_insn "umulhisi3"
  1962.   [(set (match_operand:SI 0 "general_operand" "=d")
  1963.     (umult:SI (match_operand:HI 1 "general_operand" "%0")
  1964.           (match_operand:HI 2 "general_operand" "dmn")))]
  1965.   ""
  1966.   "*
  1967. {
  1968. #ifdef MOTOROLA
  1969.   return \"mulu.w %2,%0\";
  1970. #else
  1971.   return \"mulu %2,%0\";
  1972. #endif
  1973. }")
  1974.  
  1975. (define_insn "umulsi3"
  1976.   [(set (match_operand:SI 0 "general_operand" "=d")
  1977.     (umult:SI (match_operand:SI 1 "general_operand" "%0")
  1978.           (match_operand:SI 2 "general_operand" "dmsK")))]
  1979.   "TARGET_68020"
  1980.   "mulu%.l %2,%0")
  1981.  
  1982. (define_expand "muldf3"
  1983.   [(set (match_operand:DF 0 "general_operand" "")
  1984.     (mult:DF (match_operand:DF 1 "general_operand" "")
  1985.          (match_operand:DF 2 "general_operand" "")))]
  1986.   "TARGET_68881 || TARGET_FPA"
  1987.   "")
  1988.  
  1989. (define_insn ""
  1990.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  1991.     (mult:DF (match_operand:DF 1 "general_operand" "%xH,y")
  1992.          (match_operand:DF 2 "general_operand" "xH,rmF")))]
  1993.   "TARGET_FPA"
  1994.   "*
  1995. {
  1996.   if (rtx_equal_p (operands[1], operands[2]))
  1997.     return \"fpsqr%.d %y1,%0\";
  1998.   if (rtx_equal_p (operands[0], operands[1]))
  1999.     return \"fpmul%.d %y2,%0\";
  2000.   if (rtx_equal_p (operands[0], operands[2]))
  2001.     return \"fpmul%.d %y1,%0\";
  2002.   if (which_alternative == 0)
  2003.     return \"fpmul3%.d %w2,%w1,%0\"; 
  2004.   return \"fpmul3%.d %x2,%x1,%0\";
  2005. }")
  2006.  
  2007. (define_insn ""
  2008.   [(set (match_operand:DF 0 "general_operand" "=f")
  2009.     (mult:DF (match_operand:DF 1 "general_operand" "%0")
  2010.          (match_operand:DF 2 "general_operand" "fmG")))]
  2011.   "TARGET_68881"
  2012.   "*
  2013. {
  2014.   if (REG_P (operands[2]))
  2015.     return \"fmul%.x %2,%0\";
  2016.   return \"fmul%.d %f2,%0\";
  2017. }")
  2018.  
  2019. (define_expand "mulsf3"
  2020.   [(set (match_operand:SF 0 "general_operand" "")
  2021.     (mult:SF (match_operand:SF 1 "general_operand" "")
  2022.          (match_operand:SF 2 "general_operand" "")))]
  2023.   "TARGET_68881 || TARGET_FPA"
  2024.   "")
  2025.  
  2026. (define_insn ""
  2027.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  2028.     (mult:SF (match_operand:SF 1 "general_operand" "%xH,y")
  2029.          (match_operand:SF 2 "general_operand" "xH,rmF")))]
  2030.   "TARGET_FPA"
  2031.   "*
  2032. {
  2033.   if (rtx_equal_p (operands[1], operands[2]))
  2034.     return \"fpsqr%.s %w1,%0\";
  2035.   if (rtx_equal_p (operands[0], operands[1]))
  2036.     return \"fpmul%.s %w2,%0\";
  2037.   if (rtx_equal_p (operands[0], operands[2]))
  2038.     return \"fpmul%.s %w1,%0\";
  2039.   if (which_alternative == 0)
  2040.     return \"fpmul3%.s %w2,%w1,%0\";
  2041.   return \"fpmul3%.s %2,%1,%0\";
  2042. }")
  2043.  
  2044. (define_insn ""
  2045.   [(set (match_operand:SF 0 "general_operand" "=f")
  2046.     (mult:SF (match_operand:SF 1 "general_operand" "%0")
  2047.          (match_operand:SF 2 "general_operand" "fdmF")))]
  2048.   "TARGET_68881"
  2049.   "*
  2050. {
  2051.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2052.     return \"fsglmul%.x %2,%0\";
  2053.   return \"fsglmul%.s %f2,%0\";
  2054. }")
  2055.  
  2056. ;; divide instructions
  2057.  
  2058. (define_insn "divhi3"
  2059.   [(set (match_operand:HI 0 "general_operand" "=d")
  2060.     (div:HI (match_operand:HI 1 "general_operand" "0")
  2061.         (match_operand:HI 2 "general_operand" "dmn")))]
  2062.   ""
  2063.   "*
  2064. {
  2065. #ifdef MOTOROLA
  2066.   return \"ext.l %0\;divs.w %2,%0\";
  2067. #else
  2068.   return \"extl %0\;divs %2,%0\";
  2069. #endif
  2070. }")
  2071.  
  2072. (define_insn "divhisi3"
  2073.   [(set (match_operand:HI 0 "general_operand" "=d")
  2074.     (div:HI (match_operand:SI 1 "general_operand" "0")
  2075.         (match_operand:HI 2 "general_operand" "dmn")))]
  2076.   ""
  2077.   "*
  2078. {
  2079. #ifdef MOTOROLA
  2080.   return \"divs.w %2,%0\";
  2081. #else
  2082.   return \"divs %2,%0\";
  2083. #endif
  2084. }")
  2085.  
  2086. (define_insn "divsi3"
  2087.   [(set (match_operand:SI 0 "general_operand" "=d")
  2088.     (div:SI (match_operand:SI 1 "general_operand" "0")
  2089.         (match_operand:SI 2 "general_operand" "dmsK")))]
  2090.   "TARGET_68020"
  2091.   "divs%.l %2,%0")
  2092.  
  2093. (define_insn "udivhi3"
  2094.   [(set (match_operand:HI 0 "general_operand" "=d")
  2095.     (udiv:HI (match_operand:HI 1 "general_operand" "0")
  2096.          (match_operand:HI 2 "general_operand" "dmn")))]
  2097.   ""
  2098.   "*
  2099. {
  2100. #ifdef MOTOROLA
  2101.   return \"and.l %#0xFFFF,%0\;divu.w %2,%0\";
  2102. #else
  2103.   return \"andl %#0xFFFF,%0\;divu %2,%0\";
  2104. #endif
  2105. }")
  2106.  
  2107. (define_insn "udivhisi3"
  2108.   [(set (match_operand:HI 0 "general_operand" "=d")
  2109.     (udiv:HI (match_operand:SI 1 "general_operand" "0")
  2110.          (match_operand:HI 2 "general_operand" "dmn")))]
  2111.   ""
  2112.   "*
  2113. {
  2114. #ifdef MOTOROLA
  2115.   return \"divu.w %2,%0\";
  2116. #else
  2117.   return \"divu %2,%0\";
  2118. #endif
  2119. }")
  2120.  
  2121. (define_insn "udivsi3"
  2122.   [(set (match_operand:SI 0 "general_operand" "=d")
  2123.     (udiv:SI (match_operand:SI 1 "general_operand" "0")
  2124.          (match_operand:SI 2 "general_operand" "dmsK")))]
  2125.   "TARGET_68020"
  2126.   "divu%.l %2,%0")
  2127.  
  2128. (define_expand "divdf3"
  2129.   [(set (match_operand:DF 0 "general_operand" "")
  2130.     (div:DF (match_operand:DF 1 "general_operand" "")
  2131.         (match_operand:DF 2 "general_operand" "")))]
  2132.   "TARGET_68881 || TARGET_FPA"
  2133.   "")
  2134.  
  2135. (define_insn ""
  2136.   [(set (match_operand:DF 0 "general_operand" "=x,y,y")
  2137.     (div:DF (match_operand:DF 1 "general_operand" "xH,y,rmF")
  2138.         (match_operand:DF 2 "general_operand" "xH,rmF,0")))]
  2139.   "TARGET_FPA"
  2140.   "*
  2141. {
  2142.   if (rtx_equal_p (operands[0], operands[2]))
  2143.     return \"fprdiv%.d %y1,%0\";
  2144.   if (rtx_equal_p (operands[0], operands[1]))
  2145.     return \"fpdiv%.d %y2,%0\";
  2146.   if (which_alternative == 0)
  2147.     return \"fpdiv3%.d %w2,%w1,%0\";
  2148.   return \"fpdiv3%.d %x2,%x1,%x0\";
  2149. }")
  2150.  
  2151. (define_insn ""
  2152.   [(set (match_operand:DF 0 "general_operand" "=f")
  2153.     (div:DF (match_operand:DF 1 "general_operand" "0")
  2154.         (match_operand:DF 2 "general_operand" "fmG")))]
  2155.   "TARGET_68881"
  2156.   "*
  2157. {
  2158.   if (REG_P (operands[2]))
  2159.     return \"fdiv%.x %2,%0\";
  2160.   return \"fdiv%.d %f2,%0\";
  2161. }")
  2162.  
  2163. (define_expand "divsf3"
  2164.   [(set (match_operand:SF 0 "general_operand" "")
  2165.     (div:SF (match_operand:SF 1 "general_operand" "")
  2166.         (match_operand:SF 2 "general_operand" "")))]
  2167.   "TARGET_68881 || TARGET_FPA"
  2168.   "")
  2169.  
  2170. (define_insn ""
  2171.   [(set (match_operand:SF 0 "general_operand" "=x,y,y")
  2172.     (div:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
  2173.         (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
  2174.   "TARGET_FPA"
  2175.   "*
  2176. {
  2177.   if (rtx_equal_p (operands[0], operands[1]))
  2178.     return \"fpdiv%.s %w2,%0\";
  2179.   if (rtx_equal_p (operands[0], operands[2]))
  2180.     return \"fprdiv%.s %w1,%0\";
  2181.   if (which_alternative == 0)
  2182.     return \"fpdiv3%.s %w2,%w1,%0\";
  2183.   return \"fpdiv3%.s %2,%1,%0\";
  2184. }")
  2185.  
  2186. (define_insn ""
  2187.   [(set (match_operand:SF 0 "general_operand" "=f")
  2188.     (div:SF (match_operand:SF 1 "general_operand" "0")
  2189.         (match_operand:SF 2 "general_operand" "fdmF")))]
  2190.   "TARGET_68881"
  2191.   "*
  2192. {
  2193.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2194.     return \"fsgldiv%.x %2,%0\";
  2195.   return \"fsgldiv%.s %f2,%0\";
  2196. }")
  2197.  
  2198. ;; Remainder instructions.
  2199.  
  2200. (define_insn "modhi3"
  2201.   [(set (match_operand:HI 0 "general_operand" "=d")
  2202.     (mod:HI (match_operand:HI 1 "general_operand" "0")
  2203.         (match_operand:HI 2 "general_operand" "dmn")))]
  2204.   ""
  2205.   "*
  2206. {
  2207.   /* The swap insn produces cc's that don't correspond to the result.  */
  2208.   CC_STATUS_INIT;
  2209. #ifdef MOTOROLA
  2210. #ifdef SGS_3B1
  2211.   return \"ext.l %0\;divs.w %2,%0\;swap.w %0\";
  2212. #else
  2213.   return \"ext.l %0\;divs.w %2,%0\;swap %0\";
  2214. #endif
  2215. #else
  2216.   return \"extl %0\;divs %2,%0\;swap %0\";
  2217. #endif
  2218. }")
  2219.  
  2220. (define_insn "modhisi3"
  2221.   [(set (match_operand:HI 0 "general_operand" "=d")
  2222.     (mod:HI (match_operand:SI 1 "general_operand" "0")
  2223.         (match_operand:HI 2 "general_operand" "dmn")))]
  2224.   ""
  2225.   "*
  2226. {
  2227.   /* The swap insn produces cc's that don't correspond to the result.  */
  2228.   CC_STATUS_INIT;
  2229. #ifdef MOTOROLA
  2230. #ifdef SGS_3B1
  2231.   return \"divs.w %2,%0\;swap.w %0\";
  2232. #else
  2233.   return \"divs.w %2,%0\;swap %0\";
  2234. #endif
  2235. #else
  2236.   return \"divs %2,%0\;swap %0\";
  2237. #endif
  2238. }")
  2239.  
  2240. (define_insn "umodhi3"
  2241.   [(set (match_operand:HI 0 "general_operand" "=d")
  2242.     (umod:HI (match_operand:HI 1 "general_operand" "0")
  2243.          (match_operand:HI 2 "general_operand" "dmn")))]
  2244.   ""
  2245.   "*
  2246. {
  2247.   /* The swap insn produces cc's that don't correspond to the result.  */
  2248.   CC_STATUS_INIT;
  2249. #ifdef MOTOROLA
  2250. #ifdef SGS_3B1
  2251.   return \"and.l %#0xFFFF,%0\;divu.w %2,%0\;swap.w %0\";
  2252. #else
  2253.   return \"and.l %#0xFFFF,%0\;divu.w %2,%0\;swap %0\";
  2254. #endif
  2255. #else
  2256.   return \"andl %#0xFFFF,%0\;divu %2,%0\;swap %0\";
  2257. #endif
  2258. }")
  2259.  
  2260. (define_insn "umodhisi3"
  2261.   [(set (match_operand:HI 0 "general_operand" "=d")
  2262.     (umod:HI (match_operand:SI 1 "general_operand" "0")
  2263.          (match_operand:HI 2 "general_operand" "dmn")))]
  2264.   ""
  2265.   "*
  2266. {
  2267.   /* The swap insn produces cc's that don't correspond to the result.  */
  2268.   CC_STATUS_INIT;
  2269. #ifdef MOTOROLA
  2270. #ifdef SGS_3B1
  2271.   return \"divu.w %2,%0\;swap.w %0\";
  2272. #else
  2273.   return \"divu.w %2,%0\;swap %0\";
  2274. #endif
  2275. #else
  2276.   return \"divu %2,%0\;swap %0\";
  2277. #endif
  2278. }")
  2279.  
  2280. (define_insn "divmodsi4"
  2281.   [(set (match_operand:SI 0 "general_operand" "=d")
  2282.     (div:SI (match_operand:SI 1 "general_operand" "0")
  2283.         (match_operand:SI 2 "general_operand" "dmsK")))
  2284.    (set (match_operand:SI 3 "general_operand" "=d")
  2285.     (mod:SI (match_dup 1) (match_dup 2)))]
  2286.   "TARGET_68020"
  2287.   "divsl%.l %2,%3:%0")
  2288.  
  2289. (define_insn "udivmodsi4"
  2290.   [(set (match_operand:SI 0 "general_operand" "=d")
  2291.     (udiv:SI (match_operand:SI 1 "general_operand" "0")
  2292.          (match_operand:SI 2 "general_operand" "dmsK")))
  2293.    (set (match_operand:SI 3 "general_operand" "=d")
  2294.     (umod:SI (match_dup 1) (match_dup 2)))]
  2295.   "TARGET_68020"
  2296.   "divul%.l %2,%3:%0")
  2297.  
  2298. ;; logical-and instructions
  2299.  
  2300. (define_insn "andsi3"
  2301.   [(set (match_operand:SI 0 "general_operand" "=m,d")
  2302.     (and:SI (match_operand:SI 1 "general_operand" "%0,0")
  2303.         (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
  2304.   ""
  2305.   "*
  2306. {
  2307.   if (GET_CODE (operands[2]) == CONST_INT
  2308.       && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
  2309.       && (DATA_REG_P (operands[0])
  2310.       || offsettable_memref_p (operands[0])))
  2311.     { 
  2312.       if (GET_CODE (operands[0]) != REG)
  2313.         operands[0] = adj_offsettable_operand (operands[0], 2);
  2314.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2315.                  INTVAL (operands[2]) & 0xffff);
  2316.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  2317.       CC_STATUS_INIT;
  2318.       if (operands[2] == const0_rtx)
  2319.         return \"clr%.w %0\";
  2320.       return \"and%.w %2,%0\";
  2321.     }
  2322.   return \"and%.l %2,%0\";
  2323. }")
  2324.  
  2325. (define_insn "andhi3"
  2326.   [(set (match_operand:HI 0 "general_operand" "=m,d")
  2327.     (and:HI (match_operand:HI 1 "general_operand" "%0,0")
  2328.         (match_operand:HI 2 "general_operand" "dn,dmn")))]
  2329.   ""
  2330.   "and%.w %2,%0")
  2331.  
  2332. (define_insn "andqi3"
  2333.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  2334.     (and:QI (match_operand:QI 1 "general_operand" "%0,0")
  2335.         (match_operand:QI 2 "general_operand" "dn,dmn")))]
  2336.   ""
  2337.   "and%.b %2,%0")
  2338.  
  2339. (define_insn ""
  2340.   [(set (match_operand:SI 0 "general_operand" "=d")
  2341.     (and:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "dm"))
  2342.         (match_operand:SI 2 "general_operand" "0")))]
  2343.   "GET_CODE (operands[2]) == CONST_INT
  2344.    && (unsigned int) INTVAL (operands[2]) < (1 << GET_MODE_BITSIZE (HImode))"
  2345.   "and%.w %1,%0")
  2346.  
  2347. (define_insn ""
  2348.   [(set (match_operand:SI 0 "general_operand" "=d")
  2349.     (and:SI (zero_extend:SI (match_operand:QI 1 "general_operand" "dm"))
  2350.         (match_operand:SI 2 "general_operand" "0")))]
  2351.   "GET_CODE (operands[2]) == CONST_INT
  2352.    && (unsigned int) INTVAL (operands[2]) < (1 << GET_MODE_BITSIZE (QImode))"
  2353.   "and%.b %1,%0")
  2354.  
  2355. ;; inclusive-or instructions
  2356.  
  2357. (define_insn "iorsi3"
  2358.   [(set (match_operand:SI 0 "general_operand" "=m,d")
  2359.     (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
  2360.         (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
  2361.   ""
  2362.   "*
  2363. {
  2364.   register int logval;
  2365.   if (GET_CODE (operands[2]) == CONST_INT
  2366.       && INTVAL (operands[2]) >> 16 == 0
  2367.       && (DATA_REG_P (operands[0])
  2368.       || offsettable_memref_p (operands[0])))
  2369.     { 
  2370.       if (GET_CODE (operands[0]) != REG)
  2371.         operands[0] = adj_offsettable_operand (operands[0], 2);
  2372.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  2373.       CC_STATUS_INIT;
  2374.       return \"or%.w %2,%0\";
  2375.     }
  2376.   if (GET_CODE (operands[2]) == CONST_INT
  2377.       && (logval = exact_log2 (INTVAL (operands[2]))) >= 0
  2378.       && (DATA_REG_P (operands[0])
  2379.       || offsettable_memref_p (operands[0])))
  2380.     { 
  2381.       if (DATA_REG_P (operands[0]))
  2382.     {
  2383.       operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
  2384.     }
  2385.       else
  2386.         {
  2387.       operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
  2388.       operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
  2389.     }
  2390.       return \"bset %1,%0\";
  2391.     }
  2392.   return \"or%.l %2,%0\";
  2393. }")
  2394.  
  2395. (define_insn "iorhi3"
  2396.   [(set (match_operand:HI 0 "general_operand" "=m,d")
  2397.     (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
  2398.         (match_operand:HI 2 "general_operand" "dn,dmn")))]
  2399.   ""
  2400.   "or%.w %2,%0")
  2401.  
  2402. (define_insn "iorqi3"
  2403.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  2404.     (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
  2405.         (match_operand:QI 2 "general_operand" "dn,dmn")))]
  2406.   ""
  2407.   "or%.b %2,%0")
  2408.  
  2409. ;; xor instructions
  2410.  
  2411. (define_insn "xorsi3"
  2412.   [(set (match_operand:SI 0 "general_operand" "=do,m")
  2413.     (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
  2414.         (match_operand:SI 2 "general_operand" "di,dKs")))]
  2415.   ""
  2416.   "*
  2417. {
  2418.   if (GET_CODE (operands[2]) == CONST_INT
  2419.       && INTVAL (operands[2]) >> 16 == 0
  2420.       && (offsettable_memref_p (operands[0]) || DATA_REG_P (operands[0])))
  2421.     { 
  2422.       if (! DATA_REG_P (operands[0]))
  2423.     operands[0] = adj_offsettable_operand (operands[0], 2);
  2424.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  2425.       CC_STATUS_INIT;
  2426.       return \"eor%.w %2,%0\";
  2427.     }
  2428.   return \"eor%.l %2,%0\";
  2429. }")
  2430.  
  2431. (define_insn "xorhi3"
  2432.   [(set (match_operand:HI 0 "general_operand" "=dm")
  2433.     (xor:HI (match_operand:HI 1 "general_operand" "%0")
  2434.         (match_operand:HI 2 "general_operand" "dn")))]
  2435.   ""
  2436.   "eor%.w %2,%0")
  2437.  
  2438. (define_insn "xorqi3"
  2439.   [(set (match_operand:QI 0 "general_operand" "=dm")
  2440.     (xor:QI (match_operand:QI 1 "general_operand" "%0")
  2441.         (match_operand:QI 2 "general_operand" "dn")))]
  2442.   ""
  2443.   "eor%.b %2,%0")
  2444.  
  2445. ;; negation instructions
  2446.  
  2447. (define_insn "negsi2"
  2448.   [(set (match_operand:SI 0 "general_operand" "=dm")
  2449.     (neg:SI (match_operand:SI 1 "general_operand" "0")))]
  2450.   ""
  2451.   "neg%.l %0")
  2452.  
  2453. (define_insn "neghi2"
  2454.   [(set (match_operand:HI 0 "general_operand" "=dm")
  2455.     (neg:HI (match_operand:HI 1 "general_operand" "0")))]
  2456.   ""
  2457.   "neg%.w %0")
  2458.  
  2459. (define_insn "negqi2"
  2460.   [(set (match_operand:QI 0 "general_operand" "=dm")
  2461.     (neg:QI (match_operand:QI 1 "general_operand" "0")))]
  2462.   ""
  2463.   "neg%.b %0")
  2464.  
  2465. (define_expand "negsf2"
  2466.   [(set (match_operand:SF 0 "general_operand" "")
  2467.     (neg:SF (match_operand:SF 1 "general_operand" "")))]
  2468.   "TARGET_68881 || TARGET_FPA"
  2469.   "")
  2470.  
  2471. (define_insn ""
  2472.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  2473.     (neg:SF (match_operand:SF 1 "general_operand" "xH,rmF")))]
  2474.   "TARGET_FPA"
  2475.   "fpneg%.s %w1,%0")
  2476.  
  2477. (define_insn ""
  2478.   [(set (match_operand:SF 0 "general_operand" "=f")
  2479.     (neg:SF (match_operand:SF 1 "general_operand" "fdmF")))]
  2480.   "TARGET_68881"
  2481.   "*
  2482. {
  2483.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  2484.     return \"fneg%.x %1,%0\";
  2485.   return \"fneg%.s %f1,%0\";
  2486. }")
  2487.  
  2488. (define_expand "negdf2"
  2489.   [(set (match_operand:DF 0 "general_operand" "")
  2490.     (neg:DF (match_operand:DF 1 "general_operand" "")))]
  2491.   "TARGET_68881 || TARGET_FPA"
  2492.   "")
  2493.  
  2494. (define_insn ""
  2495.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  2496.     (neg:DF (match_operand:DF 1 "general_operand" "xH,rmF")))]
  2497.   "TARGET_FPA"
  2498.   "fpneg%.d %y1, %0")
  2499.  
  2500. (define_insn ""
  2501.   [(set (match_operand:DF 0 "general_operand" "=f")
  2502.     (neg:DF (match_operand:DF 1 "general_operand" "fmF")))]
  2503.   "TARGET_68881"
  2504.   "*
  2505. {
  2506.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  2507.     return \"fneg%.x %1,%0\";
  2508.   return \"fneg%.d %f1,%0\";
  2509. }")
  2510.  
  2511. ;; Absolute value instructions
  2512.  
  2513. (define_expand "abssf2"
  2514.   [(set (match_operand:SF 0 "general_operand" "")
  2515.     (abs:SF (match_operand:SF 1 "general_operand" "")))]
  2516.   "TARGET_68881 || TARGET_FPA"
  2517.   "")
  2518.  
  2519. (define_insn ""
  2520.   [(set (match_operand:SF 0 "general_operand" "=x,y")
  2521.     (abs:SF (match_operand:SF 1 "general_operand" "xH,rmF")))]
  2522.   "TARGET_FPA"
  2523.   "fpabs%.s %y1,%0")
  2524.  
  2525. (define_insn ""
  2526.   [(set (match_operand:SF 0 "general_operand" "=f")
  2527.     (abs:SF (match_operand:SF 1 "general_operand" "fdmF")))]
  2528.   "TARGET_68881"
  2529.   "*
  2530. {
  2531.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  2532.     return \"fabs%.x %1,%0\";
  2533.   return \"fabs%.s %f1,%0\";
  2534. }")
  2535.  
  2536. (define_expand "absdf2"
  2537.   [(set (match_operand:DF 0 "general_operand" "")
  2538.     (abs:DF (match_operand:DF 1 "general_operand" "")))]
  2539.   "TARGET_68881 || TARGET_FPA"
  2540.   "")
  2541.  
  2542. (define_insn ""
  2543.   [(set (match_operand:DF 0 "general_operand" "=x,y")
  2544.     (abs:DF (match_operand:DF 1 "general_operand" "xH,rmF")))]
  2545.   "TARGET_FPA"
  2546.   "fpabs%.d %y1,%0")
  2547.  
  2548. (define_insn ""
  2549.   [(set (match_operand:DF 0 "general_operand" "=f")
  2550.     (abs:DF (match_operand:DF 1 "general_operand" "fmF")))]
  2551.   "TARGET_68881"
  2552.   "*
  2553. {
  2554.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  2555.     return \"fabs%.x %1,%0\";
  2556.   return \"fabs%.d %f1,%0\";
  2557. }")
  2558.  
  2559. ;; one complement instructions
  2560.  
  2561. (define_insn "one_cmplsi2"
  2562.   [(set (match_operand:SI 0 "general_operand" "=dm")
  2563.     (not:SI (match_operand:SI 1 "general_operand" "0")))]
  2564.   ""
  2565.   "not%.l %0")
  2566.  
  2567. (define_insn "one_cmplhi2"
  2568.   [(set (match_operand:HI 0 "general_operand" "=dm")
  2569.     (not:HI (match_operand:HI 1 "general_operand" "0")))]
  2570.   ""
  2571.   "not%.w %0")
  2572.  
  2573. (define_insn "one_cmplqi2"
  2574.   [(set (match_operand:QI 0 "general_operand" "=dm")
  2575.     (not:QI (match_operand:QI 1 "general_operand" "0")))]
  2576.   ""
  2577.   "not%.b %0")
  2578.  
  2579. ;; Optimized special case of shifting.
  2580. ;; Must precede the general case.
  2581.  
  2582. (define_insn ""
  2583.   [(set (match_operand:SI 0 "general_operand" "=d")
  2584.     (ashiftrt:SI (match_operand:SI 1 "memory_operand" "m")
  2585.              (const_int 24)))]
  2586.   "GET_CODE (XEXP (operands[1], 0)) != POST_INC
  2587.    && GET_CODE (XEXP (operands[1], 0)) != PRE_DEC"
  2588.   "*
  2589. {
  2590.   if (TARGET_68020)
  2591.     return \"move%.b %1,%0\;extb%.l %0\";
  2592.   return \"move%.b %1,%0\;ext%.w %0\;ext%.l %0\";
  2593. }")
  2594.  
  2595. (define_insn ""
  2596.   [(set (match_operand:SI 0 "general_operand" "=d")
  2597.     (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
  2598.              (const_int 24)))]
  2599.   "GET_CODE (XEXP (operands[1], 0)) != POST_INC
  2600.    && GET_CODE (XEXP (operands[1], 0)) != PRE_DEC"
  2601.   "*
  2602. {
  2603.   if (reg_mentioned_p (operands[0], operands[1]))
  2604.     return \"move%.b %1,%0\;and%.l %#0xFF,%0\";
  2605.   return \"clr%.l %0\;move%.b %1,%0\";
  2606. }")
  2607.  
  2608. (define_insn ""
  2609.   [(set (cc0) (compare (match_operand:QI 0 "general_operand" "i")
  2610.                (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
  2611.                     (const_int 24))))]
  2612.   "(GET_CODE (operands[0]) == CONST_INT
  2613.     && (INTVAL (operands[0]) & ~0xff) == 0)"
  2614.   "* cc_status.flags |= CC_REVERSED;
  2615. #ifdef HPUX_ASM
  2616.   return \"cmp%.b %1,%0\";
  2617. #else
  2618.   return \"cmp%.b %0,%1\";
  2619. #endif
  2620. ")
  2621.  
  2622. (define_insn ""
  2623.   [(set (cc0) (compare (lshiftrt:SI (match_operand:SI 0 "memory_operand" "m")
  2624.                     (const_int 24))
  2625.                (match_operand:QI 1 "general_operand" "i")))]
  2626.   "(GET_CODE (operands[1]) == CONST_INT
  2627.     && (INTVAL (operands[1]) & ~0xff) == 0)"
  2628.   "*
  2629. #ifdef HPUX_ASM
  2630.   return \"cmp%.b %0,%1\";
  2631. #else
  2632.   return \"cmp%.b %1,%0\";
  2633. #endif
  2634. ")
  2635.  
  2636. (define_insn ""
  2637.   [(set (cc0) (compare (match_operand:QI 0 "general_operand" "i")
  2638.                (ashiftrt:SI (match_operand:SI 1 "memory_operand" "m")
  2639.                     (const_int 24))))]
  2640.   "(GET_CODE (operands[0]) == CONST_INT
  2641.     && ((INTVAL (operands[0]) + 0x80) & ~0xff) == 0)"
  2642.   "* cc_status.flags |= CC_REVERSED;
  2643. #ifdef HPUX_ASM
  2644.   return \"cmp%.b %1,%0\";
  2645. #else
  2646.   return \"cmp%.b %0,%1\";
  2647. #endif
  2648. ")
  2649.  
  2650. (define_insn ""
  2651.   [(set (cc0) (compare (ashiftrt:SI (match_operand:SI 0 "memory_operand" "m")
  2652.                     (const_int 24))
  2653.                (match_operand:QI 1 "general_operand" "i")))]
  2654.   "(GET_CODE (operands[1]) == CONST_INT
  2655.     && ((INTVAL (operands[1]) + 0x80) & ~0xff) == 0)"
  2656.   "*
  2657. #ifdef HPUX_ASM
  2658.   return \"cmp%.b %0,%1\";
  2659. #else
  2660.   return \"cmp%.b %1,%0\";
  2661. #endif
  2662. ")
  2663.  
  2664. ;; arithmetic shift instructions
  2665. ;; We don't need the shift memory by 1 bit instruction
  2666.  
  2667. (define_insn "ashlsi3"
  2668.   [(set (match_operand:SI 0 "general_operand" "=d")
  2669.     (ashift:SI (match_operand:SI 1 "general_operand" "0")
  2670.            (match_operand:SI 2 "general_operand" "dI")))]
  2671.   ""
  2672.   "asl%.l %2,%0")
  2673.  
  2674. (define_insn "ashlhi3"
  2675.   [(set (match_operand:HI 0 "general_operand" "=d")
  2676.     (ashift:HI (match_operand:HI 1 "general_operand" "0")
  2677.            (match_operand:HI 2 "general_operand" "dI")))]
  2678.   ""
  2679.   "asl%.w %2,%0")
  2680.  
  2681. (define_insn "ashlqi3"
  2682.   [(set (match_operand:QI 0 "general_operand" "=d")
  2683.     (ashift:QI (match_operand:QI 1 "general_operand" "0")
  2684.            (match_operand:QI 2 "general_operand" "dI")))]
  2685.   ""
  2686.   "asl%.b %2,%0")
  2687.  
  2688. (define_insn "ashrsi3"
  2689.   [(set (match_operand:SI 0 "general_operand" "=d")
  2690.     (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
  2691.              (match_operand:SI 2 "general_operand" "dI")))]
  2692.   ""
  2693.   "asr%.l %2,%0")
  2694.  
  2695. (define_insn "ashrhi3"
  2696.   [(set (match_operand:HI 0 "general_operand" "=d")
  2697.     (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
  2698.              (match_operand:HI 2 "general_operand" "dI")))]
  2699.   ""
  2700.   "asr%.w %2,%0")
  2701.  
  2702. (define_insn "ashrqi3"
  2703.   [(set (match_operand:QI 0 "general_operand" "=d")
  2704.     (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
  2705.              (match_operand:QI 2 "general_operand" "dI")))]
  2706.   ""
  2707.   "asr%.b %2,%0")
  2708.  
  2709. ;; logical shift instructions
  2710.  
  2711. (define_insn "lshlsi3"
  2712.   [(set (match_operand:SI 0 "general_operand" "=d")
  2713.     (lshift:SI (match_operand:SI 1 "general_operand" "0")
  2714.            (match_operand:SI 2 "general_operand" "dI")))]
  2715.   ""
  2716.   "lsl%.l %2,%0")
  2717.  
  2718. (define_insn "lshlhi3"
  2719.   [(set (match_operand:HI 0 "general_operand" "=d")
  2720.     (lshift:HI (match_operand:HI 1 "general_operand" "0")
  2721.            (match_operand:HI 2 "general_operand" "dI")))]
  2722.   ""
  2723.   "lsl%.w %2,%0")
  2724.  
  2725. (define_insn "lshlqi3"
  2726.   [(set (match_operand:QI 0 "general_operand" "=d")
  2727.     (lshift:QI (match_operand:QI 1 "general_operand" "0")
  2728.            (match_operand:QI 2 "general_operand" "dI")))]
  2729.   ""
  2730.   "lsl%.b %2,%0")
  2731.  
  2732. (define_insn "lshrsi3"
  2733.   [(set (match_operand:SI 0 "general_operand" "=d")
  2734.     (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
  2735.              (match_operand:SI 2 "general_operand" "dI")))]
  2736.   ""
  2737.   "lsr%.l %2,%0")
  2738.  
  2739. (define_insn "lshrhi3"
  2740.   [(set (match_operand:HI 0 "general_operand" "=d")
  2741.     (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
  2742.              (match_operand:HI 2 "general_operand" "dI")))]
  2743.   ""
  2744.   "lsr%.w %2,%0")
  2745.  
  2746. (define_insn "lshrqi3"
  2747.   [(set (match_operand:QI 0 "general_operand" "=d")
  2748.     (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
  2749.              (match_operand:QI 2 "general_operand" "dI")))]
  2750.   ""
  2751.   "lsr%.b %2,%0")
  2752.  
  2753. ;; rotate instructions
  2754.  
  2755. (define_insn "rotlsi3"
  2756.   [(set (match_operand:SI 0 "general_operand" "=d")
  2757.     (rotate:SI (match_operand:SI 1 "general_operand" "0")
  2758.            (match_operand:SI 2 "general_operand" "dI")))]
  2759.   ""
  2760.   "rol%.l %2,%0")
  2761.  
  2762. (define_insn "rotlhi3"
  2763.   [(set (match_operand:HI 0 "general_operand" "=d")
  2764.     (rotate:HI (match_operand:HI 1 "general_operand" "0")
  2765.            (match_operand:HI 2 "general_operand" "dI")))]
  2766.   ""
  2767.   "rol%.w %2,%0")
  2768.  
  2769. (define_insn "rotlqi3"
  2770.   [(set (match_operand:QI 0 "general_operand" "=d")
  2771.     (rotate:QI (match_operand:QI 1 "general_operand" "0")
  2772.            (match_operand:QI 2 "general_operand" "dI")))]
  2773.   ""
  2774.   "rol%.b %2,%0")
  2775.  
  2776. (define_insn "rotrsi3"
  2777.   [(set (match_operand:SI 0 "general_operand" "=d")
  2778.     (rotatert:SI (match_operand:SI 1 "general_operand" "0")
  2779.              (match_operand:SI 2 "general_operand" "dI")))]
  2780.   ""
  2781.   "ror%.l %2,%0")
  2782.  
  2783. (define_insn "rotrhi3"
  2784.   [(set (match_operand:HI 0 "general_operand" "=d")
  2785.     (rotatert:HI (match_operand:HI 1 "general_operand" "0")
  2786.              (match_operand:HI 2 "general_operand" "dI")))]
  2787.   ""
  2788.   "ror%.w %2,%0")
  2789.  
  2790. (define_insn "rotrqi3"
  2791.   [(set (match_operand:QI 0 "general_operand" "=d")
  2792.     (rotatert:QI (match_operand:QI 1 "general_operand" "0")
  2793.              (match_operand:QI 2 "general_operand" "dI")))]
  2794.   ""
  2795.   "ror%.b %2,%0")
  2796.  
  2797. ;; Special cases of bit-field insns which we should
  2798. ;; recognize in preference to the general case.
  2799. ;; These handle aligned 8-bit and 16-bit fields,
  2800. ;; which can usually be done with move instructions.
  2801.  
  2802. (define_insn ""
  2803.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+do")
  2804.              (match_operand:SI 1 "immediate_operand" "i")
  2805.              (match_operand:SI 2 "immediate_operand" "i"))
  2806.     (match_operand:SI 3 "general_operand" "d"))]
  2807.   "TARGET_68020 && TARGET_BITFIELD
  2808.    && GET_CODE (operands[1]) == CONST_INT
  2809.    && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
  2810.    && GET_CODE (operands[2]) == CONST_INT
  2811.    && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
  2812.    && (GET_CODE (operands[0]) == REG
  2813.        || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
  2814.   "*
  2815. {
  2816.   if (REG_P (operands[0]))
  2817.     {
  2818.       if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
  2819.         return \"bfins %3,%0{%b2:%b1}\";
  2820.     }
  2821.   else
  2822.     operands[0]
  2823.       = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
  2824.  
  2825.   if (GET_CODE (operands[3]) == MEM)
  2826.     operands[3] = adj_offsettable_operand (operands[3],
  2827.                        (32 - INTVAL (operands[1])) / 8);
  2828.   if (INTVAL (operands[1]) == 8)
  2829.     return \"move%.b %3,%0\";
  2830.   return \"move%.w %3,%0\";
  2831. }")
  2832.  
  2833. (define_insn ""
  2834.   [(set (match_operand:SI 0 "general_operand" "=&d")
  2835.     (zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do")
  2836.              (match_operand:SI 2 "immediate_operand" "i")
  2837.              (match_operand:SI 3 "immediate_operand" "i")))]
  2838.   "TARGET_68020 && TARGET_BITFIELD
  2839.    && GET_CODE (operands[2]) == CONST_INT
  2840.    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
  2841.    && GET_CODE (operands[3]) == CONST_INT
  2842.    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
  2843.    && (GET_CODE (operands[1]) == REG
  2844.        || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
  2845.   "*
  2846. {
  2847.   if (REG_P (operands[1]))
  2848.     {
  2849.       if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
  2850.     return \"bfextu %1{%b3:%b2},%0\";
  2851.     }
  2852.   else
  2853.     operands[1]
  2854.       = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  2855.  
  2856.   output_asm_insn (\"clr%.l %0\", operands);
  2857.   if (GET_CODE (operands[0]) == MEM)
  2858.     operands[0] = adj_offsettable_operand (operands[0],
  2859.                        (32 - INTVAL (operands[1])) / 8);
  2860.   if (INTVAL (operands[2]) == 8)
  2861.     return \"move%.b %1,%0\";
  2862.   return \"move%.w %1,%0\";
  2863. }")
  2864.  
  2865. (define_insn ""
  2866.   [(set (match_operand:SI 0 "general_operand" "=d")
  2867.     (sign_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do")
  2868.              (match_operand:SI 2 "immediate_operand" "i")
  2869.              (match_operand:SI 3 "immediate_operand" "i")))]
  2870.   "TARGET_68020 && TARGET_BITFIELD
  2871.    && GET_CODE (operands[2]) == CONST_INT
  2872.    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
  2873.    && GET_CODE (operands[3]) == CONST_INT
  2874.    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
  2875.    && (GET_CODE (operands[1]) == REG
  2876.        || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
  2877.   "*
  2878. {
  2879.   if (REG_P (operands[1]))
  2880.     {
  2881.       if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
  2882.     return \"bfexts %1{%b3:%b2},%0\";
  2883.     }
  2884.   else
  2885.     operands[1]
  2886.       = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  2887.  
  2888.   if (INTVAL (operands[2]) == 8)
  2889.     return \"move%.b %1,%0\;extb%.l %0\";
  2890.   return \"move%.w %1,%0\;ext%.l %0\";
  2891. }")
  2892.  
  2893. ;; Bit field instructions, general cases.
  2894. ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
  2895. ;; so that its address is reloaded.
  2896.  
  2897. (define_insn "extv"
  2898.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  2899.     (sign_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o,d")
  2900.              (match_operand:SI 2 "general_operand" "di,di")
  2901.              (match_operand:SI 3 "general_operand" "di,di")))]
  2902.   "TARGET_68020 && TARGET_BITFIELD"
  2903.   "bfexts %1{%b3:%b2},%0")
  2904.  
  2905. (define_insn "extzv"
  2906.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  2907.     (zero_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o,d")
  2908.              (match_operand:SI 2 "general_operand" "di,di")
  2909.              (match_operand:SI 3 "general_operand" "di,di")))]
  2910.   "TARGET_68020 && TARGET_BITFIELD"
  2911.   "bfextu %1{%b3:%b2},%0")
  2912.  
  2913. (define_insn ""
  2914.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  2915.              (match_operand:SI 1 "general_operand" "di,di")
  2916.              (match_operand:SI 2 "general_operand" "di,di"))
  2917.         (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
  2918.         (match_operand 3 "immediate_operand" "i,i")))]
  2919.   "TARGET_68020 && TARGET_BITFIELD
  2920.    && GET_CODE (operands[3]) == CONST_INT
  2921.    && (INTVAL (operands[3]) == -1
  2922.        || (GET_CODE (operands[1]) == CONST_INT
  2923.            && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
  2924.   "*
  2925. {
  2926.   CC_STATUS_INIT;
  2927.   return \"bfchg %0{%b2:%b1}\";
  2928. }")
  2929.  
  2930. (define_insn ""
  2931.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  2932.              (match_operand:SI 1 "general_operand" "di,di")
  2933.              (match_operand:SI 2 "general_operand" "di,di"))
  2934.     (const_int 0))]
  2935.   "TARGET_68020 && TARGET_BITFIELD"
  2936.   "*
  2937. {
  2938.   CC_STATUS_INIT;
  2939.   return \"bfclr %0{%b2:%b1}\";
  2940. }")
  2941.  
  2942. (define_insn ""
  2943.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  2944.              (match_operand:SI 1 "general_operand" "di,di")
  2945.              (match_operand:SI 2 "general_operand" "di,di"))
  2946.     (const_int -1))]
  2947.   "TARGET_68020 && TARGET_BITFIELD"
  2948.   "*
  2949. {
  2950.   CC_STATUS_INIT;
  2951.   return \"bfset %0{%b2:%b1}\";
  2952. }")
  2953.  
  2954. (define_insn "insv"
  2955.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  2956.              (match_operand:SI 1 "general_operand" "di,di")
  2957.              (match_operand:SI 2 "general_operand" "di,di"))
  2958.     (match_operand:SI 3 "general_operand" "d,d"))]
  2959.   "TARGET_68020 && TARGET_BITFIELD"
  2960.   "bfins %3,%0{%b2:%b1}")
  2961.  
  2962. ;; Now recognize bit field insns that operate on registers
  2963. ;; (or at least were intended to do so).
  2964.  
  2965. (define_insn ""
  2966.   [(set (match_operand:SI 0 "general_operand" "=d")
  2967.     (sign_extract:SI (match_operand:SI 1 "nonimmediate_operand" "d")
  2968.              (match_operand:SI 2 "general_operand" "di")
  2969.              (match_operand:SI 3 "general_operand" "di")))]
  2970.   "TARGET_68020 && TARGET_BITFIELD"
  2971.   "bfexts %1{%b3:%b2},%0")
  2972.  
  2973. (define_insn ""
  2974.   [(set (match_operand:SI 0 "general_operand" "=d")
  2975.     (zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "d")
  2976.              (match_operand:SI 2 "general_operand" "di")
  2977.              (match_operand:SI 3 "general_operand" "di")))]
  2978.   "TARGET_68020 && TARGET_BITFIELD"
  2979.   "bfextu %1{%b3:%b2},%0")
  2980.  
  2981. (define_insn ""
  2982.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  2983.              (match_operand:SI 1 "general_operand" "di")
  2984.              (match_operand:SI 2 "general_operand" "di"))
  2985.     (const_int 0))]
  2986.   "TARGET_68020 && TARGET_BITFIELD"
  2987.   "*
  2988. {
  2989.   CC_STATUS_INIT;
  2990.   return \"bfclr %0{%b2:%b1}\";
  2991. }")
  2992.  
  2993. (define_insn ""
  2994.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  2995.              (match_operand:SI 1 "general_operand" "di")
  2996.              (match_operand:SI 2 "general_operand" "di"))
  2997.     (const_int -1))]
  2998.   "TARGET_68020 && TARGET_BITFIELD"
  2999.   "*
  3000. {
  3001.   CC_STATUS_INIT;
  3002.   return \"bfset %0{%b2:%b1}\";
  3003. }")
  3004.  
  3005. (define_insn ""
  3006.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  3007.              (match_operand:SI 1 "general_operand" "di")
  3008.              (match_operand:SI 2 "general_operand" "di"))
  3009.     (match_operand:SI 3 "general_operand" "d"))]
  3010.   "TARGET_68020 && TARGET_BITFIELD"
  3011.   "*
  3012. {
  3013. #if 0
  3014.   /* These special cases are now recognized by a specific pattern.  */
  3015.   if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
  3016.       && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
  3017.     return \"move%.w %3,%0\";
  3018.   if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
  3019.       && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
  3020.     return \"move%.b %3,%0\";
  3021. #endif
  3022.   return \"bfins %3,%0{%b2:%b1}\";
  3023. }")
  3024.  
  3025. ;; Special patterns for optimizing bit-field instructions.
  3026.  
  3027. (define_insn ""
  3028.   [(set (cc0)
  3029.     (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
  3030.              (match_operand:SI 1 "general_operand" "di")
  3031.              (match_operand:SI 2 "general_operand" "di")))]
  3032.   "TARGET_68020 && TARGET_BITFIELD
  3033.    && GET_CODE (operands[1]) == CONST_INT"
  3034.   "*
  3035. {
  3036.   if (operands[1] == const1_rtx
  3037.       && GET_CODE (operands[2]) == CONST_INT)
  3038.     {    
  3039.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3040.       return output_btst (operands,
  3041.               gen_rtx (CONST_INT, VOIDmode,
  3042.                    width - INTVAL (operands[2])),
  3043.               operands[0],
  3044.               insn, 1000);
  3045.       /* Pass 1000 as SIGNPOS argument so that btst will
  3046.          not think we are testing the sign bit for an `and'
  3047.      and assume that nonzero implies a negative result.  */
  3048.     }
  3049.   if (INTVAL (operands[1]) != 32)
  3050.     cc_status.flags = CC_NOT_NEGATIVE;
  3051.   return \"bftst %0{%b2:%b1}\";
  3052. }")
  3053.  
  3054. (define_insn ""
  3055.   [(set (cc0)
  3056.     (subreg:QI
  3057.      (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
  3058.               (match_operand:SI 1 "general_operand" "di")
  3059.               (match_operand:SI 2 "general_operand" "di"))
  3060.      0))]
  3061.   "TARGET_68020 && TARGET_BITFIELD
  3062.    && GET_CODE (operands[1]) == CONST_INT"
  3063.   "*
  3064. {
  3065.   if (operands[1] == const1_rtx
  3066.       && GET_CODE (operands[2]) == CONST_INT)
  3067.     {    
  3068.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3069.       return output_btst (operands,
  3070.               gen_rtx (CONST_INT, VOIDmode,
  3071.                    width - INTVAL (operands[2])),
  3072.               operands[0],
  3073.               insn, 1000);
  3074.       /* Pass 1000 as SIGNPOS argument so that btst will
  3075.          not think we are testing the sign bit for an `and'
  3076.      and assume that nonzero implies a negative result.  */
  3077.     }
  3078.   if (INTVAL (operands[1]) != 32)
  3079.     cc_status.flags = CC_NOT_NEGATIVE;
  3080.   return \"bftst %0{%b2:%b1}\";
  3081. }")
  3082.  
  3083. (define_insn ""
  3084.   [(set (cc0)
  3085.     (subreg:HI
  3086.      (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
  3087.               (match_operand:SI 1 "general_operand" "di")
  3088.               (match_operand:SI 2 "general_operand" "di"))
  3089.      0))]
  3090.   "TARGET_68020 && TARGET_BITFIELD
  3091.    && GET_CODE (operands[1]) == CONST_INT"
  3092.   "*
  3093. {
  3094.   if (operands[1] == const1_rtx
  3095.       && GET_CODE (operands[2]) == CONST_INT)
  3096.     {    
  3097.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3098.       return output_btst (operands,
  3099.               gen_rtx (CONST_INT, VOIDmode,
  3100.                    width - INTVAL (operands[2])),
  3101.               operands[0],
  3102.               insn, 1000);
  3103.       /* Pass 1000 as SIGNPOS argument so that btst will
  3104.          not think we are testing the sign bit for an `and'
  3105.      and assume that nonzero implies a negative result.  */
  3106.     }
  3107.   if (INTVAL (operands[1]) != 32)
  3108.     cc_status.flags = CC_NOT_NEGATIVE;
  3109.   return \"bftst %0{%b2:%b1}\";
  3110. }")
  3111.   
  3112. ;;; now handle the register cases
  3113. (define_insn ""
  3114.   [(set (cc0)
  3115.     (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "d")
  3116.              (match_operand:SI 1 "general_operand" "di")
  3117.              (match_operand:SI 2 "general_operand" "di")))]
  3118.   "TARGET_68020 && TARGET_BITFIELD
  3119.    && GET_CODE (operands[1]) == CONST_INT"
  3120.   "*
  3121. {
  3122.   if (operands[1] == const1_rtx
  3123.       && GET_CODE (operands[2]) == CONST_INT)
  3124.     {    
  3125.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3126.       return output_btst (operands,
  3127.               gen_rtx (CONST_INT, VOIDmode,
  3128.                    width - INTVAL (operands[2])),
  3129.               operands[0],
  3130.               insn, 1000);
  3131.       /* Pass 1000 as SIGNPOS argument so that btst will
  3132.          not think we are testing the sign bit for an `and'
  3133.      and assume that nonzero implies a negative result.  */
  3134.     }
  3135.   if (INTVAL (operands[1]) != 32)
  3136.     cc_status.flags = CC_NOT_NEGATIVE;
  3137.   return \"bftst %0{%b2:%b1}\";
  3138. }")
  3139.  
  3140. (define_insn ""
  3141.   [(set (cc0)
  3142.     (subreg:QI
  3143.      (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "d")
  3144.               (match_operand:SI 1 "general_operand" "di")
  3145.               (match_operand:SI 2 "general_operand" "di"))
  3146.      0))]
  3147.   "TARGET_68020 && TARGET_BITFIELD
  3148.    && GET_CODE (operands[1]) == CONST_INT"
  3149.   "*
  3150. {
  3151.   if (operands[1] == const1_rtx
  3152.       && GET_CODE (operands[2]) == CONST_INT)
  3153.     {    
  3154.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3155.       return output_btst (operands,
  3156.               gen_rtx (CONST_INT, VOIDmode,
  3157.                    width - INTVAL (operands[2])),
  3158.               operands[0],
  3159.               insn, 1000);
  3160.       /* Pass 1000 as SIGNPOS argument so that btst will
  3161.          not think we are testing the sign bit for an `and'
  3162.      and assume that nonzero implies a negative result.  */
  3163.     }
  3164.   if (INTVAL (operands[1]) != 32)
  3165.     cc_status.flags = CC_NOT_NEGATIVE;
  3166.   return \"bftst %0{%b2:%b1}\";
  3167. }")
  3168.  
  3169. (define_insn ""
  3170.   [(set (cc0)
  3171.     (subreg:HI
  3172.      (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "d")
  3173.               (match_operand:SI 1 "general_operand" "di")
  3174.               (match_operand:SI 2 "general_operand" "di"))
  3175.      0))]
  3176.   "TARGET_68020 && TARGET_BITFIELD
  3177.    && GET_CODE (operands[1]) == CONST_INT"
  3178.   "*
  3179. {
  3180.   if (operands[1] == const1_rtx
  3181.       && GET_CODE (operands[2]) == CONST_INT)
  3182.     {    
  3183.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3184.       return output_btst (operands,
  3185.               gen_rtx (CONST_INT, VOIDmode,
  3186.                    width - INTVAL (operands[2])),
  3187.               operands[0],
  3188.               insn, 1000);
  3189.       /* Pass 1000 as SIGNPOS argument so that btst will
  3190.          not think we are testing the sign bit for an `and'
  3191.      and assume that nonzero implies a negative result.  */
  3192.     }
  3193.   if (INTVAL (operands[1]) != 32)
  3194.     cc_status.flags = CC_NOT_NEGATIVE;
  3195.   return \"bftst %0{%b2:%b1}\";
  3196. }")
  3197.  
  3198. (define_insn "seq"
  3199.   [(set (match_operand:QI 0 "general_operand" "=d")
  3200.     (eq (cc0) (const_int 0)))]
  3201.   ""
  3202.   "*
  3203.   cc_status = cc_prev_status;
  3204.   OUTPUT_JUMP (\"seq %0\", \"fseq %0\", \"seq %0\");
  3205. ")
  3206.  
  3207. (define_insn "sne"
  3208.   [(set (match_operand:QI 0 "general_operand" "=d")
  3209.     (ne (cc0) (const_int 0)))]
  3210.   ""
  3211.   "*
  3212.   cc_status = cc_prev_status;
  3213.   OUTPUT_JUMP (\"sne %0\", \"fsne %0\", \"sne %0\");
  3214. ")
  3215.  
  3216. (define_insn "sgt"
  3217.   [(set (match_operand:QI 0 "general_operand" "=d")
  3218.     (gt (cc0) (const_int 0)))]
  3219.   ""
  3220.   "*
  3221.   cc_status = cc_prev_status;
  3222.   OUTPUT_JUMP (\"sgt %0\", \"fsgt %0\", 0);
  3223. ")
  3224.  
  3225. (define_insn "sgtu"
  3226.   [(set (match_operand:QI 0 "general_operand" "=d")
  3227.     (gtu (cc0) (const_int 0)))]
  3228.   ""
  3229.   "* cc_status = cc_prev_status;
  3230.      return \"shi %0\"; ")
  3231.  
  3232. (define_insn "slt"
  3233.   [(set (match_operand:QI 0 "general_operand" "=d")
  3234.     (lt (cc0) (const_int 0)))]
  3235.   ""
  3236.   "* cc_status = cc_prev_status;
  3237.      OUTPUT_JUMP (\"slt %0\", \"fslt %0\", \"smi %0\"); ")
  3238.  
  3239. (define_insn "sltu"
  3240.   [(set (match_operand:QI 0 "general_operand" "=d")
  3241.     (ltu (cc0) (const_int 0)))]
  3242.   ""
  3243.   "* cc_status = cc_prev_status;
  3244.      return \"scs %0\"; ")
  3245.  
  3246. (define_insn "sge"
  3247.   [(set (match_operand:QI 0 "general_operand" "=d")
  3248.     (ge (cc0) (const_int 0)))]
  3249.   ""
  3250.   "* cc_status = cc_prev_status;
  3251.      OUTPUT_JUMP (\"sge %0\", \"fsge %0\", \"spl %0\"); ")
  3252.  
  3253. (define_insn "sgeu"
  3254.   [(set (match_operand:QI 0 "general_operand" "=d")
  3255.     (geu (cc0) (const_int 0)))]
  3256.   ""
  3257.   "* cc_status = cc_prev_status;
  3258.      return \"scc %0\"; ")
  3259.  
  3260. (define_insn "sle"
  3261.   [(set (match_operand:QI 0 "general_operand" "=d")
  3262.     (le (cc0) (const_int 0)))]
  3263.   ""
  3264.   "*
  3265.   cc_status = cc_prev_status;
  3266.   OUTPUT_JUMP (\"sle %0\", \"fsle %0\", 0);
  3267. ")
  3268.  
  3269. (define_insn "sleu"
  3270.   [(set (match_operand:QI 0 "general_operand" "=d")
  3271.     (leu (cc0) (const_int 0)))]
  3272.   ""
  3273.   "* cc_status = cc_prev_status;
  3274.      return \"sls %0\"; ")
  3275.  
  3276. ;; Basic conditional jump instructions.
  3277.  
  3278. (define_insn "beq"
  3279.   [(set (pc)
  3280.     (if_then_else (eq (cc0)
  3281.               (const_int 0))
  3282.               (label_ref (match_operand 0 "" ""))
  3283.               (pc)))]
  3284.   ""
  3285.   "*
  3286. {
  3287. #ifdef MOTOROLA
  3288.   OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
  3289. #else
  3290.   OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
  3291. #endif
  3292. }")
  3293.  
  3294. (define_insn "bne"
  3295.   [(set (pc)
  3296.     (if_then_else (ne (cc0)
  3297.               (const_int 0))
  3298.               (label_ref (match_operand 0 "" ""))
  3299.               (pc)))]
  3300.   ""
  3301.   "*
  3302. {
  3303. #ifdef MOTOROLA
  3304.   OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
  3305. #else
  3306.   OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
  3307. #endif
  3308. }")
  3309.  
  3310. (define_insn "bgt"
  3311.   [(set (pc)
  3312.     (if_then_else (gt (cc0)
  3313.               (const_int 0))
  3314.               (label_ref (match_operand 0 "" ""))
  3315.               (pc)))]
  3316.   ""
  3317.   "*
  3318. #ifdef MOTOROLA
  3319.   OUTPUT_JUMP (\"jbgt %l0\", \"fbgt %l0\", 0);
  3320. #else
  3321.   OUTPUT_JUMP (\"jgt %l0\", \"fjgt %l0\", 0);
  3322. #endif
  3323. ")
  3324.  
  3325. (define_insn "bgtu"
  3326.   [(set (pc)
  3327.     (if_then_else (gtu (cc0)
  3328.                (const_int 0))
  3329.               (label_ref (match_operand 0 "" ""))
  3330.               (pc)))]
  3331.   ""
  3332.   "*
  3333. #ifdef MOTOROLA
  3334.   return \"jbhi %l0\";
  3335. #else
  3336.   return \"jhi %l0\";
  3337. #endif
  3338. ")
  3339.  
  3340. (define_insn "blt"
  3341.   [(set (pc)
  3342.     (if_then_else (lt (cc0)
  3343.               (const_int 0))
  3344.               (label_ref (match_operand 0 "" ""))
  3345.               (pc)))]
  3346.   ""
  3347.   "*
  3348. #ifdef MOTOROLA
  3349.   OUTPUT_JUMP (\"jblt %l0\", \"fblt %l0\", \"jbmi %l0\");
  3350. #else
  3351.   OUTPUT_JUMP (\"jlt %l0\", \"fjlt %l0\", \"jmi %l0\");
  3352. #endif
  3353. ")
  3354.  
  3355. (define_insn "bltu"
  3356.   [(set (pc)
  3357.     (if_then_else (ltu (cc0)
  3358.                (const_int 0))
  3359.               (label_ref (match_operand 0 "" ""))
  3360.               (pc)))]
  3361.   ""
  3362.   "*
  3363. #ifdef MOTOROLA
  3364.   return \"jbcs %l0\";
  3365. #else
  3366.   return \"jcs %l0\";
  3367. #endif
  3368. ")
  3369.  
  3370. (define_insn "bge"
  3371.   [(set (pc)
  3372.     (if_then_else (ge (cc0)
  3373.               (const_int 0))
  3374.               (label_ref (match_operand 0 "" ""))
  3375.               (pc)))]
  3376.   ""
  3377.   "*
  3378. #ifdef MOTOROLA
  3379.   OUTPUT_JUMP (\"jbge %l0\", \"fbge %l0\", \"jbpl %l0\");
  3380. #else
  3381.   OUTPUT_JUMP (\"jge %l0\", \"fjge %l0\", \"jpl %l0\");
  3382. #endif
  3383. ")
  3384.  
  3385. (define_insn "bgeu"
  3386.   [(set (pc)
  3387.     (if_then_else (geu (cc0)
  3388.                (const_int 0))
  3389.               (label_ref (match_operand 0 "" ""))
  3390.               (pc)))]
  3391.   ""
  3392.   "*
  3393. #ifdef MOTOROLA
  3394.   return \"jbcc %l0\";
  3395. #else
  3396.   return \"jcc %l0\";
  3397. #endif
  3398. ")
  3399.  
  3400. (define_insn "ble"
  3401.   [(set (pc)
  3402.     (if_then_else (le (cc0)
  3403.               (const_int 0))
  3404.               (label_ref (match_operand 0 "" ""))
  3405.               (pc)))]
  3406.   ""
  3407.   "*
  3408. #ifdef MOTOROLA
  3409.   OUTPUT_JUMP (\"jble %l0\", \"fble %l0\", 0);
  3410. #else
  3411.   OUTPUT_JUMP (\"jle %l0\", \"fjle %l0\", 0);
  3412. #endif
  3413. ")
  3414.  
  3415. (define_insn "bleu"
  3416.   [(set (pc)
  3417.     (if_then_else (leu (cc0)
  3418.                (const_int 0))
  3419.               (label_ref (match_operand 0 "" ""))
  3420.               (pc)))]
  3421.   ""
  3422.   "*
  3423. #ifdef MOTOROLA
  3424.   return \"jbls %l0\";
  3425. #else
  3426.   return \"jls %l0\";
  3427. #endif
  3428. ")
  3429.  
  3430. ;; Negated conditional jump instructions.
  3431.  
  3432. (define_insn ""
  3433.   [(set (pc)
  3434.     (if_then_else (eq (cc0)
  3435.               (const_int 0))
  3436.               (pc)
  3437.               (label_ref (match_operand 0 "" ""))))]
  3438.   ""
  3439.   "*
  3440. {
  3441. #ifdef MOTOROLA
  3442.   OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
  3443. #else
  3444.   OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
  3445. #endif
  3446. }")
  3447.  
  3448. (define_insn ""
  3449.   [(set (pc)
  3450.     (if_then_else (ne (cc0)
  3451.               (const_int 0))
  3452.               (pc)
  3453.               (label_ref (match_operand 0 "" ""))))]
  3454.   ""
  3455.   "*
  3456. {
  3457. #ifdef MOTOROLA
  3458.   OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
  3459. #else
  3460.   OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
  3461. #endif
  3462. }")
  3463.  
  3464. (define_insn ""
  3465.   [(set (pc)
  3466.     (if_then_else (gt (cc0)
  3467.               (const_int 0))
  3468.               (pc)
  3469.               (label_ref (match_operand 0 "" ""))))]
  3470.   ""
  3471.   "*
  3472. #ifdef MOTOROLA
  3473.   OUTPUT_JUMP (\"jble %l0\", \"fbngt %l0\", 0);
  3474. #else
  3475.   OUTPUT_JUMP (\"jle %l0\", \"fjngt %l0\", 0);
  3476. #endif
  3477. ")
  3478.  
  3479. (define_insn ""
  3480.   [(set (pc)
  3481.     (if_then_else (gtu (cc0)
  3482.                (const_int 0))
  3483.               (pc)
  3484.               (label_ref (match_operand 0 "" ""))))]
  3485.   ""
  3486.   "*
  3487. #ifdef MOTOROLA
  3488.   return \"jbls %l0\";
  3489. #else
  3490.   return \"jls %l0\";
  3491. #endif
  3492. ")
  3493.  
  3494. (define_insn ""
  3495.   [(set (pc)
  3496.     (if_then_else (lt (cc0)
  3497.               (const_int 0))
  3498.               (pc)
  3499.               (label_ref (match_operand 0 "" ""))))]
  3500.   ""
  3501.   "*
  3502. #ifdef MOTOROLA
  3503.   OUTPUT_JUMP (\"jbge %l0\", \"fbnlt %l0\", \"jbpl %l0\");
  3504. #else
  3505.   OUTPUT_JUMP (\"jge %l0\", \"fjnlt %l0\", \"jpl %l0\");
  3506. #endif
  3507. ")
  3508.  
  3509. (define_insn ""
  3510.   [(set (pc)
  3511.     (if_then_else (ltu (cc0)
  3512.                (const_int 0))
  3513.               (pc)
  3514.               (label_ref (match_operand 0 "" ""))))]
  3515.   ""
  3516.   "*
  3517. #ifdef MOTOROLA
  3518.   return \"jbcc %l0\";
  3519. #else
  3520.   return \"jcc %l0\";
  3521. #endif
  3522. ")
  3523.  
  3524. (define_insn ""
  3525.   [(set (pc)
  3526.     (if_then_else (ge (cc0)
  3527.               (const_int 0))
  3528.               (pc)
  3529.               (label_ref (match_operand 0 "" ""))))]
  3530.   ""
  3531.   "*
  3532. #ifdef MOTOROLA
  3533.   OUTPUT_JUMP (\"jblt %l0\", \"fbnge %l0\", \"jbmi %l0\");
  3534. #else
  3535.   OUTPUT_JUMP (\"jlt %l0\", \"fjnge %l0\", \"jmi %l0\");
  3536. #endif
  3537. ")
  3538.  
  3539. (define_insn ""
  3540.   [(set (pc)
  3541.     (if_then_else (geu (cc0)
  3542.                (const_int 0))
  3543.               (pc)
  3544.               (label_ref (match_operand 0 "" ""))))]
  3545.   ""
  3546.   "*
  3547. #ifdef MOTOROLA
  3548.   return \"jbcs %l0\";
  3549. #else
  3550.   return \"jcs %l0\";
  3551. #endif
  3552. ")
  3553.  
  3554. (define_insn ""
  3555.   [(set (pc)
  3556.     (if_then_else (le (cc0)
  3557.               (const_int 0))
  3558.               (pc)
  3559.               (label_ref (match_operand 0 "" ""))))]
  3560.   ""
  3561.   "*
  3562. #ifdef MOTOROLA
  3563.   OUTPUT_JUMP (\"jbgt %l0\", \"fbnle %l0\", 0);
  3564. #else
  3565.   OUTPUT_JUMP (\"jgt %l0\", \"fjnle %l0\", 0);
  3566. #endif
  3567. ")
  3568.  
  3569. (define_insn ""
  3570.   [(set (pc)
  3571.     (if_then_else (leu (cc0)
  3572.                (const_int 0))
  3573.               (pc)
  3574.               (label_ref (match_operand 0 "" ""))))]
  3575.   ""
  3576.   "*
  3577. #ifdef MOTOROLA
  3578.   return \"jbhi %l0\";
  3579. #else
  3580.   return \"jhi %l0\";
  3581. #endif
  3582. ")
  3583.  
  3584. ;; Subroutines of "casesi".
  3585.  
  3586. (define_expand "casesi_1"
  3587.   [(set (match_operand:SI 3 "general_operand" "")
  3588.     (plus:SI (match_operand:SI 0 "general_operand" "")
  3589.          ;; Note operand 1 has been negated!
  3590.          (match_operand:SI 1 "immediate_operand" "")))
  3591.    (set (cc0) (compare (match_operand:SI 2 "general_operand" "")
  3592.                (match_dup 3)))
  3593.    (set (pc) (if_then_else (ltu (cc0) (const_int 0))
  3594.                (label_ref (match_operand 4 "" "")) (pc)))]
  3595.   ""
  3596.   "")
  3597.  
  3598. (define_expand "casesi_2"
  3599.   [(set (match_operand:SI 0 "" "") (mem:HI (match_operand:SI 1 "" "")))
  3600.    ;; The USE here is so that at least one jump-insn will refer to the label,
  3601.    ;; to keep it alive in jump_optimize.
  3602.    (parallel [(set (pc)
  3603.            (plus:SI (pc) (match_dup 0)))
  3604.           (use (label_ref (match_operand 2 "" "")))])]
  3605.   ""
  3606.   "")
  3607.  
  3608. ;; Operand 0 is index (in bytes); operand 1 is minimum, operand 2 themaximum;
  3609. ;; operand 3 is CODE_LABEL for the table;
  3610. ;; operand 4 is the CODE_LABEL to go to if index out of range.
  3611. (define_expand "casesi"
  3612.   ;; We don't use these for generating the RTL, but we must describe
  3613.   ;; the operands here.
  3614.   [(match_operand:SI 0 "general_operand" "")
  3615.    (match_operand:SI 1 "immediate_operand" "")
  3616.    (match_operand:SI 2 "general_operand" "")
  3617.    (match_operand 3 "" "")
  3618.    (match_operand 4 "" "")]
  3619.   ""
  3620.   "
  3621. {
  3622.   rtx table_elt_addr;
  3623.   rtx index_diff;
  3624.  
  3625.   operands[1] = negate_rtx (SImode, operands[1]);
  3626.   index_diff = gen_reg_rtx (SImode);
  3627.   /* Emit the first few insns.  */
  3628.   emit_insn (gen_casesi_1 (operands[0], operands[1], operands[2],
  3629.                index_diff, operands[4]));
  3630.   /* Construct a memory address.  This may emit some insns.  */
  3631.   table_elt_addr
  3632.     = memory_address_noforce
  3633.         (HImode,
  3634.      gen_rtx (PLUS, Pmode,
  3635.           gen_rtx (MULT, Pmode, index_diff,
  3636.                gen_rtx (CONST_INT, VOIDmode, 2)),
  3637.           gen_rtx (LABEL_REF, VOIDmode, operands[3])));
  3638.   /* Emit the last few insns.  */
  3639.   emit_insn (gen_casesi_2 (gen_reg_rtx (HImode), table_elt_addr, operands[3]));
  3640.   DONE;
  3641. }")
  3642.  
  3643. ;; Recognize one of the insns resulting from casesi_2.
  3644. (define_insn ""
  3645.   [(set (pc)
  3646.     (plus:SI (pc) (match_operand:HI 0 "general_operand" "r")))
  3647.    (use (label_ref (match_operand 1 "" "")))]
  3648.   ""
  3649.   "*
  3650. #ifdef SGS
  3651. #ifdef ASM_OUTPUT_CASE_LABEL
  3652.   return \"jmp 6(%%pc,%0.w)\";
  3653. #else
  3654.   return \"jmp 2(%%pc,%0.w)\";
  3655. #endif
  3656. #else /* not SGS */
  3657. #ifdef MOTOROLA
  3658.   return \"jmp (2,pc,%0.w)\";
  3659. #else
  3660.   return \"jmp pc@(2,%0:w)\";
  3661. #endif
  3662. #endif
  3663. ")
  3664.  
  3665. ;; Unconditional and other jump instructions
  3666. (define_insn "jump"
  3667.   [(set (pc)
  3668.     (label_ref (match_operand 0 "" "")))]
  3669.   ""
  3670.   "*
  3671. #ifdef MOTOROLA
  3672.   return \"jbra %l0\";
  3673. #else
  3674.   return \"jra %l0\";
  3675. #endif
  3676. ")
  3677.  
  3678. (define_insn ""
  3679.   [(set (pc)
  3680.     (if_then_else
  3681.      (ne (compare (plus:HI (match_operand:HI 0 "general_operand" "g")
  3682.                    (const_int -1))
  3683.               (const_int -1))
  3684.          (const_int 0))
  3685.      (label_ref (match_operand 1 "" ""))
  3686.      (pc)))
  3687.    (set (match_dup 0)
  3688.     (plus:HI (match_dup 0)
  3689.          (const_int -1)))]
  3690.   ""
  3691.   "*
  3692. {
  3693.   CC_STATUS_INIT;
  3694.   if (DATA_REG_P (operands[0]))
  3695.     return \"dbra %0,%l1\";
  3696.   if (GET_CODE (operands[0]) == MEM)
  3697.     {
  3698. #ifdef MOTOROLA
  3699. #ifdef NO_ADDSUB_Q
  3700.       return \"sub%.w %#1,%0\;jbcc %l1\";
  3701. #else
  3702.       return \"subq%.w %#1,%0\;jbcc %l1\";
  3703. #endif
  3704. #else /* not MOTOROLA */
  3705.       return \"subqw %#1,%0\;jcc %l1\";
  3706. #endif
  3707.     }
  3708. #ifdef MOTOROLA
  3709. #ifdef HPUX_ASM
  3710. #ifndef NO_ADDSUB_Q
  3711.   return \"sub%.w %#1,%0\;cmp%.w %0,%#-1\;jbne %l1\";
  3712. #else
  3713.   return \"subq%.w %#1,%0\;cmp%.w %0,%#-1\;jbne %l1\";
  3714. #endif
  3715. #else /* not HPUX_ASM */
  3716.   return \"subq%.w %#1,%0\;cmp%.w %#-1,%0\;jbne %l1\";
  3717. #endif
  3718. #else /* not MOTOROLA */
  3719.   return \"subqw %#1,%0\;cmpw %#-1,%0\;jne %l1\";
  3720. #endif
  3721. }")
  3722.  
  3723. (define_insn ""
  3724.   [(set (pc)
  3725.     (if_then_else
  3726.      (ne (compare (plus:SI (match_operand:SI 0 "general_operand" "g")
  3727.                    (const_int -1))
  3728.               (const_int -1))
  3729.          (const_int 0))
  3730.      (label_ref (match_operand 1 "" ""))
  3731.      (pc)))
  3732.    (set (match_dup 0)
  3733.     (plus:SI (match_dup 0)
  3734.          (const_int -1)))]
  3735.   ""
  3736.   "*
  3737. {
  3738.   CC_STATUS_INIT;
  3739. #ifdef MOTOROLA
  3740. #ifndef NO_ADDSUB_Q
  3741.   if (DATA_REG_P (operands[0]))
  3742.     return \"dbra %0,%l1\;clr.w %0\;sub.l %#1,%0\;jbcc %l1\";
  3743.   if (GET_CODE (operands[0]) == MEM)
  3744.     return \"sub.l %#1,%0\;jbcc %l1\";
  3745. #else
  3746.   if (DATA_REG_P (operands[0]))
  3747.     return \"dbra %0,%l1\;clr.w %0\;subq.l %#1,%0\;jbcc %l1\";
  3748.   if (GET_CODE (operands[0]) == MEM)
  3749.     return \"subq.l %#1,%0\;jbcc %l1\";
  3750. #endif /* not NO_ADDSUB_Q */
  3751. #ifdef HPUX_ASM
  3752. #ifndef NO_ADDSUB_Q
  3753.   return \"sub.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  3754. #else
  3755.   return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  3756. #endif
  3757. #else
  3758.   return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
  3759. #endif
  3760. #else
  3761.   if (DATA_REG_P (operands[0]))
  3762.     return \"dbra %0,%l1\;clrw %0\;subql %#1,%0\;jcc %l1\";
  3763.   if (GET_CODE (operands[0]) == MEM)
  3764.     return \"subql %#1,%0\;jcc %l1\";
  3765.   return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
  3766. #endif
  3767. }")
  3768.  
  3769. ;; dbra patterns that use REG_NOTES info generated by strength_reduce.
  3770.  
  3771. (define_insn ""
  3772.   [(set (pc)
  3773.     (if_then_else
  3774.       (ge (plus:SI (match_operand:SI 0 "general_operand" "g")
  3775.             (const_int -1))
  3776.           (const_int 0))
  3777.       (label_ref (match_operand 1 "" ""))
  3778.       (pc)))
  3779.    (set (match_dup 0)
  3780.     (plus:SI (match_dup 0)
  3781.          (const_int -1)))]
  3782.   "find_reg_note (insn, REG_NONNEG, 0)"
  3783.   "*
  3784. {
  3785.   CC_STATUS_INIT;
  3786. #ifdef MOTOROLA
  3787. #ifndef NO_ADDSUB_Q
  3788.   if (DATA_REG_P (operands[0]))
  3789.     return \"dbra %0,%l1\;clr.w %0\;sub.l %#1,%0\;jbcc %l1\";
  3790.   if (GET_CODE (operands[0]) == MEM)
  3791.     return \"sub.l %#1,%0\;jbcc %l1\";
  3792. #else
  3793.   if (DATA_REG_P (operands[0]))
  3794.     return \"dbra %0,%l1\;clr.w %0\;subq.l %#1,%0\;jbcc %l1\";
  3795.   if (GET_CODE (operands[0]) == MEM)
  3796.     return \"subq.l %#1,%0\;jbcc %l1\";
  3797. #endif
  3798. #ifdef HPUX_ASM
  3799. #ifndef NO_ADDSUB_Q
  3800.   return \"sub.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  3801. #else
  3802.   return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
  3803. #endif
  3804. #else
  3805.   return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
  3806. #endif
  3807. #else
  3808.   if (DATA_REG_P (operands[0]))
  3809.     return \"dbra %0,%l1\;clrw %0\;subql %#1,%0\;jcc %l1\";
  3810.   if (GET_CODE (operands[0]) == MEM)
  3811.     return \"subql %#1,%0\;jcc %l1\";
  3812.   return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
  3813. #endif
  3814. }")
  3815.  
  3816. ;; Call subroutine with no return value.
  3817. (define_insn "call"
  3818.   [(call (match_operand:QI 0 "general_operand" "o")
  3819.      (match_operand:SI 1 "general_operand" "g"))]
  3820.   ;; Operand 1 not really used on the m68000.
  3821.  
  3822.   ""
  3823.   "*
  3824. #ifdef MOTOROLA
  3825.   return \"jsr %0\";
  3826. #else
  3827.   return \"jbsr %0\";
  3828. #endif
  3829. ")
  3830.  
  3831. ;; Call subroutine, returning value in operand 0
  3832. ;; (which must be a hard register).
  3833. (define_insn "call_value"
  3834.   [(set (match_operand 0 "" "=rf")
  3835.     (call (match_operand:QI 1 "general_operand" "o")
  3836.           (match_operand:SI 2 "general_operand" "g")))]
  3837.   ;; Operand 2 not really used on the m68000.
  3838.   ""
  3839.   "*
  3840. #ifdef MOTOROLA
  3841.   return \"jsr %1\";
  3842. #else
  3843.   return \"jbsr %1\";
  3844. #endif
  3845. ")
  3846.  
  3847. (define_insn "nop"
  3848.   [(const_int 0)]
  3849.   ""
  3850.   "nop")
  3851.  
  3852. ;; This should not be used unless the add/sub insns can't be.
  3853.  
  3854. (define_insn ""
  3855.   [(set (match_operand:SI 0 "general_operand" "=a")
  3856.     (match_operand:QI 1 "address_operand" "p"))]
  3857.   ""
  3858.   "lea %a1,%0")
  3859.  
  3860. ;; This is the first machine-dependent peephole optimization.
  3861. ;; It is useful when a floating value is returned from a function call
  3862. ;; and then is moved into an FP register.
  3863. ;; But it is mainly intended to test the support for these optimizations.
  3864.  
  3865. (define_peephole
  3866.   [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
  3867.    (set (match_operand:DF 0 "register_operand" "f")
  3868.     (match_operand:DF 1 "register_operand" "ad"))]
  3869.   "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
  3870.   "*
  3871. {
  3872.   rtx xoperands[2];
  3873.   xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  3874.   output_asm_insn (\"move%.l %1,%@\", xoperands);
  3875.   output_asm_insn (\"move%.l %1,%-\", operands);
  3876.   return \"fmove%.d %+,%0\";
  3877. }
  3878. ")
  3879.  
  3880. ;; FPA multiply and add.
  3881. (define_insn ""
  3882.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  3883.     (plus:DF (mult:DF (match_operand:DF 1 "general_operand" "%x,dmF,y")
  3884.               (match_operand:DF 2 "general_operand" "xH,y,y"))
  3885.          (match_operand:DF 3 "general_operand" "xH,y,dmF")))]
  3886.   "TARGET_FPA"
  3887.   "*
  3888. {
  3889.   if (which_alternative == 0)
  3890.     return \"fpma%.d %1,%w2,%w3,%0\";
  3891.   return \"fpma%.d %x1,%x2,%x3,%0\";
  3892. }")
  3893.  
  3894. (define_insn ""
  3895.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  3896.     (plus:DF (match_operand:DF 1 "general_operand" "xH,y,dmF")
  3897.          (mult:DF (match_operand:DF 2 "general_operand" "%x,dmF,y")
  3898.               (match_operand:DF 3 "general_operand" "xH,y,y"))))]
  3899.    "TARGET_FPA"
  3900.    "*
  3901. {
  3902.   if (which_alternative == 0)
  3903.     return \"fpma%.d %2,%w3,%w1,%0\";
  3904.   return \"fpma%.d %x2,%x3,%x1,%0\";
  3905. }")
  3906.  
  3907. (define_insn ""
  3908.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  3909.     (plus:SF (mult:SF (match_operand:SF 1 "general_operand" "%x,ydmF,y")
  3910.               (match_operand:SF 2 "general_operand" "xH,y,ydmF"))
  3911.          (match_operand:SF 3 "general_operand" "xH,ydmF,ydmF")))]
  3912.   "TARGET_FPA"
  3913.   "*
  3914. {
  3915.   if (which_alternative == 0)
  3916.     return \"fpma%.s %1,%w2,%w3,%0\";
  3917.   return \"fpma%.s %1,%2,%3,%0\";
  3918. }")
  3919.  
  3920. (define_insn ""
  3921.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  3922.     (plus:SF (match_operand:SF 1 "general_operand" "xH,ydmF,ydmF")
  3923.          (mult:SF (match_operand:SF 2 "general_operand" "%x,ydmF,y")
  3924.               (match_operand:SF 3 "general_operand" "xH,y,ydmF"))))]
  3925.    "TARGET_FPA"
  3926.    "*
  3927. {
  3928.   if (which_alternative == 0)
  3929.     return \"fpma%.s %2,%w3,%w1,%0\";
  3930.   return \"fpma%.s %2,%3,%1,%0\";
  3931. }")
  3932.  
  3933. ;; FPA Multiply and subtract
  3934. (define_insn ""
  3935.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  3936.     (minus:DF (match_operand:DF 1 "general_operand" "xH,rmF,y")
  3937.           (mult:DF (match_operand:DF 2 "register_operand" "%xH,y,y")
  3938.                (match_operand:DF 3 "general_operand" "x,y,rmF"))))]
  3939.   "TARGET_FPA"
  3940.   "*
  3941. {
  3942.   if (which_alternative == 0)
  3943.     return \"fpms%.d %3,%w2,%w1,%0\";
  3944.   return \"fpms%.d %x3,%2,%x1,%0\";
  3945. }")
  3946.  
  3947. (define_insn ""
  3948.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  3949.     (minus:SF (match_operand:SF 1 "general_operand" "xH,rmF,yrmF")
  3950.           (mult:SF (match_operand:SF 2 "register_operand" "%xH,rmF,y")
  3951.                (match_operand:SF 3 "general_operand" "x,y,yrmF"))))]
  3952.   "TARGET_FPA"
  3953.   "*
  3954. {
  3955.   if (which_alternative == 0)
  3956.     return \"fpms%.s %3,%w2,%w1,%0\";
  3957.   return \"fpms%.s %3,%2,%1,%0\";
  3958. }")
  3959.  
  3960. (define_insn ""
  3961.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  3962.     (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "%xH,y,y")
  3963.                (match_operand:DF 2 "general_operand" "x,y,rmF"))
  3964.           (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
  3965.   "TARGET_FPA"
  3966.   "*
  3967. {
  3968.   if (which_alternative == 0)
  3969.     return \"fpmr%.d %2,%w1,%w3,%0\";
  3970.   return \"fpmr%.d %x2,%1,%x3,%0\";
  3971. }")
  3972.  
  3973. (define_insn ""
  3974.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  3975.     (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "%xH,rmF,y")
  3976.                (match_operand:SF 2 "general_operand" "x,y,yrmF"))
  3977.           (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
  3978.   "TARGET_FPA"
  3979.   "*
  3980. {
  3981.   if (which_alternative == 0)
  3982.     return \"fpmr%.s %2,%w1,%w3,%0\";
  3983.   return \"fpmr%.s %x2,%1,%x3,%0\";
  3984. }")
  3985.  
  3986. ;; FPA Add and multiply
  3987. (define_insn ""
  3988.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  3989.     (mult:DF (plus:DF (match_operand:DF 1 "register_operand" "%xH,y,y")
  3990.               (match_operand:DF 2 "general_operand" "x,y,rmF"))
  3991.          (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
  3992.   "TARGET_FPA"
  3993.   "*
  3994. {
  3995.   if (which_alternative == 0)
  3996.     return \"fpam%.d %2,%w1,%w3,%0\";
  3997.   return \"fpam%.d %x2,%1,%x3,%0\";
  3998. }")
  3999.  
  4000. (define_insn ""
  4001.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  4002.     (mult:DF (match_operand:DF 1 "general_operand" "xH,rmF,y")
  4003.          (plus:DF (match_operand:DF 2 "register_operand" "%xH,y,y")
  4004.               (match_operand:DF 3 "general_operand" "x,y,rmF"))))]
  4005.   "TARGET_FPA"
  4006.   "*
  4007. {
  4008.   if (which_alternative == 0)
  4009.     return \"fpam%.d %3,%w2,%w1,%0\";
  4010.   return \"fpam%.d %x3,%2,%x1,%0\";
  4011. }")
  4012.  
  4013. (define_insn ""
  4014.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  4015.     (mult:SF (plus:SF (match_operand:SF 1 "register_operand" "%xH,rmF,y")
  4016.               (match_operand:SF 2 "general_operand" "x,y,yrmF"))
  4017.          (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
  4018.   "TARGET_FPA"
  4019.   "*
  4020. {
  4021.   if (which_alternative == 0)
  4022.     return \"fpam%.s %2,%w1,%w3,%0\";
  4023.   return \"fpam%.s %x2,%1,%x3,%0\";
  4024. }")
  4025.  
  4026. (define_insn ""
  4027.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  4028.     (mult:SF (match_operand:SF 1 "general_operand" "xH,rmF,yrmF")
  4029.          (plus:SF (match_operand:SF 2 "register_operand" "%xH,rmF,y")
  4030.               (match_operand:SF 3 "general_operand" "x,y,yrmF"))))]
  4031.   "TARGET_FPA"
  4032.   "*
  4033. {
  4034.   if (which_alternative == 0)
  4035.     return \"fpam%.s %3,%w2,%w1,%0\";
  4036.   return \"fpam%.s %x3,%2,%x1,%0\";
  4037. }")
  4038.  
  4039. ;;FPA Subtract and multiply
  4040. (define_insn ""
  4041.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  4042.     (mult:DF (minus:DF (match_operand:DF 1 "register_operand" "xH,y,y")
  4043.                (match_operand:DF 2 "general_operand" "x,y,rmF"))
  4044.          (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
  4045.   "TARGET_FPA"
  4046.   "*
  4047. {
  4048.   if (which_alternative == 0)
  4049.     return \"fpsm%.d %2,%w1,%w3,%0\";
  4050.   return \"fpsm%.d %x2,%1,%x3,%0\";
  4051. }")
  4052.  
  4053. (define_insn ""
  4054.   [(set (match_operand:DF 0 "register_operand" "=x,y,y")
  4055.     (mult:DF (match_operand:DF 1 "general_operand" "xH,rmF,y")
  4056.          (minus:DF (match_operand:DF 2 "register_operand" "xH,y,y")
  4057.                (match_operand:DF 3 "general_operand" "x,y,rmF"))))]
  4058.   "TARGET_FPA"
  4059.   "*
  4060. {
  4061.   if (which_alternative == 0)
  4062.     return \"fpsm%.d %3,%w2,%w1,%0\";
  4063.   return \"fpsm%.d %x3,%2,%x1,%0\";
  4064. }")
  4065.  
  4066. (define_insn ""
  4067.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  4068.     (mult:SF (minus:SF (match_operand:SF 1 "register_operand" "xH,rmF,y")
  4069.                (match_operand:SF 2 "general_operand" "x,y,yrmF"))
  4070.          (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
  4071.   "TARGET_FPA"
  4072.   "*
  4073. {
  4074.   if (which_alternative == 0)
  4075.     return \"fpsm%.s %2,%w1,%w3,%0\";
  4076.   return \"fpsm%.s %x2,%1,%x3,%0\";
  4077. }")
  4078.  
  4079. (define_insn ""
  4080.   [(set (match_operand:SF 0 "register_operand" "=x,y,y")
  4081.     (mult:SF (match_operand:SF 1 "general_operand" "xH,rmF,yrmF")
  4082.          (minus:SF (match_operand:SF 2 "register_operand" "xH,rmF,y")
  4083.                (match_operand:SF 3 "general_operand" "x,y,yrmF"))))]
  4084.   "TARGET_FPA"
  4085.   "*
  4086. {
  4087.   if (which_alternative == 0)
  4088.     return \"fpsm%.s %3,%w2,%w1,%0\";
  4089.   return \"fpsm%.s %x3,%2,%x1,%0\";
  4090. }")
  4091.  
  4092.  
  4093. ;;- Local variables:
  4094. ;;- mode:emacs-lisp
  4095. ;;- comment-start: ";;- "
  4096. ;;- comment-start-skip: ";+- *"
  4097. ;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
  4098. ;;- eval: (modify-syntax-entry ?[ "(]")
  4099. ;;- eval: (modify-syntax-entry ?] ")[")
  4100. ;;- eval: (modify-syntax-entry ?{ "(}")
  4101. ;;- eval: (modify-syntax-entry ?} "){")
  4102. ;;- End:
  4103.