home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gcc-2.6.0-src.lha / GNU / src / amiga / gcc-2.6.0 / config / ns32k / ns32k.md < prev    next >
Encoding:
Text File  |  1994-05-18  |  70.7 KB  |  2,732 lines

  1. ;;- Machine description for GNU compiler, ns32000 Version
  2. ;;  Copyright (C) 1988, 1994 Free Software Foundation, Inc.
  3. ;;  Contributed by Michael Tiemann (tiemann@cygnus.com)
  4.  
  5. ;; This file is part of GNU CC.
  6.  
  7. ;; GNU CC is free software; you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation; either version 2, or (at your option)
  10. ;; any later version.
  11.  
  12. ;; GNU CC is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ;; GNU General Public License for more details.
  16.  
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU CC; see the file COPYING.  If not, write to
  19. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  
  22. ; BUGS:
  23. ;; Insert no-op between an insn with memory read-write operands
  24. ;;   following by a scale-indexing operation.
  25. ;; The Sequent assembler does not allow addresses to be used
  26. ;;   except in insns which explicitly compute an effective address.
  27. ;;   I.e., one cannot say "cmpd _p,@_x"
  28. ;; Implement unsigned multiplication??
  29.  
  30. ;;- Instruction patterns.  When multiple patterns apply,
  31. ;;- the first one in the file is chosen.
  32. ;;-
  33. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  34. ;;-
  35. ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
  36. ;;- updates for most instructions.
  37.  
  38. ;; We don't want to allow a constant operand for test insns because
  39. ;; (set (cc0) (const_int foo)) has no mode information.  Such insns will
  40. ;; be folded while optimizing anyway.
  41.  
  42. (define_insn "tstsi"
  43.   [(set (cc0)
  44.     (match_operand:SI 0 "nonimmediate_operand" "rm"))]
  45.   ""
  46.   "*
  47. { cc_status.flags |= CC_REVERSED;
  48.   operands[1] = const0_rtx;
  49.   return \"cmpqd %1,%0\"; }")
  50.  
  51. (define_insn "tsthi"
  52.   [(set (cc0)
  53.     (match_operand:HI 0 "nonimmediate_operand" "g"))]
  54.   ""
  55.   "*
  56. { cc_status.flags |= CC_REVERSED;
  57.   operands[1] = const0_rtx;
  58.   return \"cmpqw %1,%0\"; }")
  59.  
  60. (define_insn "tstqi"
  61.   [(set (cc0)
  62.     (match_operand:QI 0 "nonimmediate_operand" "g"))]
  63.   ""
  64.   "*
  65. { cc_status.flags |= CC_REVERSED;
  66.   operands[1] = const0_rtx;
  67.   return \"cmpqb %1,%0\"; }")
  68.  
  69. (define_insn "tstdf"
  70.   [(set (cc0)
  71.     (match_operand:DF 0 "general_operand" "fmF"))]
  72.   "TARGET_32081"
  73.   "*
  74. { cc_status.flags |= CC_REVERSED;
  75.   operands[1] = CONST0_RTX (DFmode);
  76.   return \"cmpl %1,%0\"; }")
  77.  
  78. (define_insn "tstsf"
  79.   [(set (cc0)
  80.     (match_operand:SF 0 "general_operand" "fmF"))]
  81.   "TARGET_32081"
  82.   "*
  83. { cc_status.flags |= CC_REVERSED;
  84.   operands[1] = CONST0_RTX (SFmode);
  85.   return \"cmpf %1,%0\"; }")
  86.  
  87. (define_insn "cmpsi"
  88.   [(set (cc0)
  89.     (compare (match_operand:SI 0 "nonimmediate_operand" "rmn")
  90.          (match_operand:SI 1 "general_operand" "rmn")))]
  91.   ""
  92.   "*
  93. {
  94.   if (GET_CODE (operands[1]) == CONST_INT)
  95.     {
  96.       int i = INTVAL (operands[1]);
  97.       if (i <= 7 && i >= -8)
  98.     {
  99.       cc_status.flags |= CC_REVERSED;
  100.       return \"cmpqd %1,%0\";
  101.     }
  102.     }
  103.   cc_status.flags &= ~CC_REVERSED;
  104.   if (GET_CODE (operands[0]) == CONST_INT)
  105.     {
  106.       int i = INTVAL (operands[0]);
  107.       if (i <= 7 && i >= -8)
  108.     return \"cmpqd %0,%1\";
  109.     }
  110.   return \"cmpd %0,%1\";
  111. }")
  112.  
  113. (define_insn "cmphi"
  114.   [(set (cc0)
  115.     (compare (match_operand:HI 0 "nonimmediate_operand" "g")
  116.          (match_operand:HI 1 "general_operand" "g")))]
  117.   ""
  118.   "*
  119. {
  120.   if (GET_CODE (operands[1]) == CONST_INT)
  121.     {
  122.       short i = INTVAL (operands[1]);
  123.     if (i <= 7 && i >= -8)
  124.       {
  125.     cc_status.flags |= CC_REVERSED;
  126.     if (INTVAL (operands[1]) > 7)
  127.       operands[1] = gen_rtx(CONST_INT, VOIDmode, i);
  128.     return \"cmpqw %1,%0\";
  129.       }
  130.     }
  131.   cc_status.flags &= ~CC_REVERSED;
  132.   if (GET_CODE (operands[0]) == CONST_INT)
  133.     {
  134.       short i = INTVAL (operands[0]);
  135.       if (i <= 7 && i >= -8)
  136.     {
  137.       if (INTVAL (operands[0]) > 7)
  138.         operands[0] = gen_rtx(CONST_INT, VOIDmode, i);
  139.       return \"cmpqw %0,%1\";
  140.     }
  141.     }
  142.   return \"cmpw %0,%1\";
  143. }")
  144.  
  145. (define_insn "cmpqi"
  146.   [(set (cc0)
  147.     (compare (match_operand:QI 0 "nonimmediate_operand" "g")
  148.          (match_operand:QI 1 "general_operand" "g")))]
  149.   ""
  150.   "*
  151. {
  152.   if (GET_CODE (operands[1]) == CONST_INT)
  153.     {
  154.       char i = INTVAL (operands[1]);
  155.       if (i <= 7 && i >= -8)
  156.     {
  157.       cc_status.flags |= CC_REVERSED;
  158.       if (INTVAL (operands[1]) > 7)
  159.         operands[1] = gen_rtx(CONST_INT, VOIDmode, i);
  160.       return \"cmpqb %1,%0\";
  161.     }
  162.     }
  163.   cc_status.flags &= ~CC_REVERSED;
  164.   if (GET_CODE (operands[0]) == CONST_INT)
  165.     {
  166.       char i = INTVAL (operands[0]);
  167.       if (i <= 7 && i >= -8)
  168.     {
  169.       if (INTVAL (operands[0]) > 7)
  170.         operands[0] = gen_rtx(CONST_INT, VOIDmode, i);
  171.       return \"cmpqb %0,%1\";
  172.     }
  173.     }
  174.   return \"cmpb %0,%1\";
  175. }")
  176.  
  177. (define_insn "cmpdf"
  178.   [(set (cc0)
  179.     (compare (match_operand:DF 0 "general_operand" "fmF")
  180.          (match_operand:DF 1 "general_operand" "fmF")))]
  181.   "TARGET_32081"
  182.   "cmpl %0,%1")
  183.  
  184. (define_insn "cmpsf"
  185.   [(set (cc0)
  186.     (compare (match_operand:SF 0 "general_operand" "fmF")
  187.          (match_operand:SF 1 "general_operand" "fmF")))]
  188.   "TARGET_32081"
  189.   "cmpf %0,%1")
  190.  
  191. (define_insn "movdf"
  192.   [(set (match_operand:DF 0 "general_operand" "=fg<")
  193.     (match_operand:DF 1 "general_operand" "fFg"))]
  194.   ""
  195.   "*
  196. {
  197.   if (FP_REG_P (operands[0]))
  198.     {
  199.       if (FP_REG_P (operands[1]) || GET_CODE (operands[1]) == CONST_DOUBLE)
  200.     return \"movl %1,%0\";
  201.       if (REG_P (operands[1]))
  202.     {
  203.       rtx xoperands[2];
  204.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  205.       output_asm_insn (\"movd %1,tos\", xoperands);
  206.       output_asm_insn (\"movd %1,tos\", operands);
  207.       return \"movl tos,%0\";
  208.     }
  209.       return \"movl %1,%0\";
  210.     }
  211.   else if (FP_REG_P (operands[1]))
  212.     {
  213.       if (REG_P (operands[0]))
  214.     {
  215.       output_asm_insn (\"movl %1,tos\;movd tos,%0\", operands);
  216.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  217.       return \"movd tos,%0\";
  218.     }
  219.       else
  220.         return \"movl %1,%0\";
  221.     }
  222.   return output_move_double (operands);
  223. }")
  224.  
  225. (define_insn "movsf"
  226.   [(set (match_operand:SF 0 "general_operand" "=fg<")
  227.     (match_operand:SF 1 "general_operand" "fFg"))]
  228.   ""
  229.   "*
  230. {
  231.   if (FP_REG_P (operands[0]))
  232.     {
  233.       if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 8)
  234.     return \"movd %1,tos\;movf tos,%0\";
  235.       else
  236.     return \"movf %1,%0\";
  237.     }
  238.   else if (FP_REG_P (operands[1]))
  239.     {
  240.       if (REG_P (operands[0]))
  241.     return \"movf %1,tos\;movd tos,%0\";
  242.       return \"movf %1,%0\";
  243.     }
  244. #if 0 /* Someone suggested this for the Sequent.  Is it needed?  */
  245.   else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  246.     return \"movf %1,%0\";
  247. #endif
  248. /* There was a #if 0 around this, but that was erroneous
  249.    for many machines -- rms.  */
  250. #ifndef MOVD_FLOAT_OK
  251.   /* GAS understands floating constants in ordinary movd instructions
  252.      but other assemblers might object.  */
  253.   else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  254.     {
  255.       union {int i[2]; float f; double d;} convrt;
  256.       convrt.i[0] = CONST_DOUBLE_LOW (operands[1]);
  257.       convrt.i[1] = CONST_DOUBLE_HIGH (operands[1]);
  258.       convrt.f = convrt.d;
  259.  
  260.       /* Is there a better machine-independent way to to this?  */
  261.       operands[1] = gen_rtx (CONST_INT, VOIDmode, convrt.i[0]);
  262.       return \"movd %1,%0\";
  263.     }
  264. #endif
  265.   else return \"movd %1,%0\";
  266. }")
  267.  
  268. (define_insn ""
  269.   [(set (match_operand:TI 0 "memory_operand" "=m")
  270.     (match_operand:TI 1 "memory_operand" "m"))]
  271.   ""
  272.   "movmd %1,%0,4")
  273.  
  274. (define_insn "movdi"
  275.   [(set (match_operand:DI 0 "general_operand" "=g<,*f,g")
  276.     (match_operand:DI 1 "general_operand" "gF,g,*f"))]
  277.   ""
  278.   "*
  279. {
  280.   if (FP_REG_P (operands[0]))
  281.     {
  282.       if (FP_REG_P (operands[1]) || GET_CODE (operands[1]) == CONST_DOUBLE)
  283.     return \"movl %1,%0\";
  284.       if (REG_P (operands[1]))
  285.     {
  286.       rtx xoperands[2];
  287.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  288.       output_asm_insn (\"movd %1,tos\", xoperands);
  289.       output_asm_insn (\"movd %1,tos\", operands);
  290.       return \"movl tos,%0\";
  291.     }
  292.       return \"movl %1,%0\";
  293.     }
  294.   else if (FP_REG_P (operands[1]))
  295.     {
  296.       if (REG_P (operands[0]))
  297.     {
  298.       output_asm_insn (\"movl %1,tos\;movd tos,%0\", operands);
  299.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  300.       return \"movd tos,%0\";
  301.     }
  302.       else
  303.         return \"movl %1,%0\";
  304.     }
  305.   return output_move_double (operands);
  306. }")
  307.  
  308. ;; This special case must precede movsi.
  309. (define_insn ""
  310.   [(set (reg:SI 17)
  311.     (match_operand:SI 0 "general_operand" "rmn"))]
  312.   ""
  313.   "lprd sp,%0")
  314.  
  315. (define_insn "movsi"
  316.   [(set (match_operand:SI 0 "general_operand" "=g<,g<,*f,g,x")
  317.     (match_operand:SI 1 "general_operand" "g,?xy,g,*f,rmn"))]
  318.   ""
  319.   "*
  320. {
  321.   if (FP_REG_P (operands[0]))
  322.     {
  323.       if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 8)
  324.     return \"movd %1,tos\;movf tos,%0\";
  325.       else
  326.     return \"movf %1,%0\";
  327.     }
  328.   else if (FP_REG_P (operands[1]))
  329.     {
  330.       if (REG_P (operands[0]))
  331.     return \"movf %1,tos\;movd tos,%0\";
  332.       return \"movf %1,%0\";
  333.     }
  334.   if (GET_CODE (operands[0]) == REG
  335.       && REGNO (operands[0]) == FRAME_POINTER_REGNUM)
  336.     return \"lprd fp,%1\";
  337.   if (GET_CODE (operands[1]) == CONST_DOUBLE)
  338.     operands[1]
  339.       = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (operands[1]));
  340.   if (GET_CODE (operands[1]) == CONST_INT)
  341.     {
  342.       int i = INTVAL (operands[1]);
  343.       if (! TARGET_32532)
  344.     {
  345.       if (i <= 7 && i >= -8)
  346.         return \"movqd %1,%0\";
  347.       if (i < 0x4000 && i >= -0x4000)
  348. #if defined (GNX_V3) || defined (UTEK_ASM)
  349.         return \"addr %c1,%0\";
  350. #else
  351.         return \"addr @%c1,%0\";
  352. #endif
  353.     }
  354.       else
  355.         return output_move_dconst(i, \"%$%1,%0\");
  356.     }
  357.   else if (GET_CODE (operands[1]) == REG)
  358.     {
  359.       if (REGNO (operands[1]) < 16)
  360.         return \"movd %1,%0\";
  361.       else if (REGNO (operands[1]) == FRAME_POINTER_REGNUM)
  362.     {
  363.       if (GET_CODE(operands[0]) == REG)
  364.         return \"sprd fp,%0\";
  365.       else
  366.         return \"addr 0(fp),%0\" ;
  367.     }
  368.       else if (REGNO (operands[1]) == STACK_POINTER_REGNUM)
  369.     {
  370.       if (GET_CODE(operands[0]) == REG)
  371.         return \"sprd sp,%0\";
  372.       else
  373.         return \"addr 0(sp),%0\" ;
  374.     }
  375.       else abort ();
  376.     }
  377.   else if (GET_CODE (operands[1]) == MEM)
  378.     return \"movd %1,%0\";
  379.  
  380.   /* Check if this effective address can be
  381.      calculated faster by pulling it apart.  */
  382.   if (REG_P (operands[0])
  383.       && GET_CODE (operands[1]) == MULT
  384.       && GET_CODE (XEXP (operands[1], 1)) == CONST_INT
  385.       && (INTVAL (XEXP (operands[1], 1)) == 2
  386.       || INTVAL (XEXP (operands[1], 1)) == 4))
  387.     {
  388.       rtx xoperands[3];
  389.       xoperands[0] = operands[0];
  390.       xoperands[1] = XEXP (operands[1], 0);
  391.       xoperands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (XEXP (operands[1], 1)) >> 1);
  392.       return output_shift_insn (xoperands);
  393.     }
  394.   return \"addr %a1,%0\";
  395. }")
  396.  
  397. (define_insn "movhi"
  398.   [(set (match_operand:HI 0 "general_operand" "=g<,*f,g")
  399.     (match_operand:HI 1 "general_operand" "g,g,*f"))]
  400.   ""
  401.   "*
  402. {
  403.   if (GET_CODE (operands[1]) == CONST_INT)
  404.     {
  405.       short i = INTVAL (operands[1]);
  406.       if (i <= 7 && i >= -8)
  407.     {
  408.       if (INTVAL (operands[1]) > 7)
  409.         operands[1] =
  410.           gen_rtx (CONST_INT, VOIDmode, i);
  411.       return \"movqw %1,%0\";
  412.     }
  413.     return \"movw %1,%0\";
  414.     }
  415.   else if (FP_REG_P (operands[0]))
  416.     {
  417.       if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 8)
  418.     return \"movwf %1,tos\;movf tos,%0\";
  419.       else
  420.     return \"movwf %1,%0\";
  421.     }
  422.   else if (FP_REG_P (operands[1]))
  423.     {
  424.       if (REG_P (operands[0]))
  425.     return \"movf %1,tos\;movd tos,%0\";
  426.       return \"movf %1,%0\";
  427.     }
  428.   else
  429.      return \"movw %1,%0\";
  430. }")
  431.  
  432. (define_insn "movstricthi"
  433.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+r"))
  434.     (match_operand:HI 1 "general_operand" "g"))]
  435.   ""
  436.   "*
  437. {
  438.   if (GET_CODE (operands[1]) == CONST_INT
  439.       && INTVAL(operands[1]) <= 7 && INTVAL(operands[1]) >= -8)
  440.     return \"movqw %1,%0\";
  441.   return \"movw %1,%0\";
  442. }")
  443.  
  444. (define_insn "movqi"
  445.   [(set (match_operand:QI 0 "general_operand" "=g<,*f,g")
  446.     (match_operand:QI 1 "general_operand" "g,g,*f"))]
  447.   ""
  448.   "*
  449. { if (GET_CODE (operands[1]) == CONST_INT)
  450.     {
  451.       char char_val = (char)INTVAL (operands[1]);
  452.       if (char_val <= 7 && char_val >= -8)
  453.     {
  454.       if (INTVAL (operands[1]) > 7)
  455.         operands[1] =
  456.           gen_rtx (CONST_INT, VOIDmode, char_val);
  457.       return \"movqb %1,%0\";
  458.     }
  459.     return \"movb %1,%0\";
  460.     }
  461.   else if (FP_REG_P (operands[0]))
  462.     {
  463.       if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 8)
  464.     return \"movbf %1,tos\;movf tos,%0\";
  465.       else
  466.     return \"movbf %1,%0\";
  467.     }
  468.   else if (FP_REG_P (operands[1]))
  469.     {
  470.       if (REG_P (operands[0]))
  471.     return \"movf %1,tos\;movd tos,%0\";
  472.       return \"movf %1,%0\";
  473.     }
  474.   else
  475.      return \"movb %1,%0\";
  476. }")
  477.  
  478. (define_insn "movstrictqi"
  479.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+r"))
  480.     (match_operand:QI 1 "general_operand" "g"))]
  481.   ""
  482.   "*
  483. {
  484.   if (GET_CODE (operands[1]) == CONST_INT
  485.       && INTVAL(operands[1]) < 8 && INTVAL(operands[1]) > -9)
  486.     return \"movqb %1,%0\";
  487.   return \"movb %1,%0\";
  488. }")
  489.  
  490. ;; This is here to accept 4 arguments and pass the first 3 along
  491. ;; to the movstrsi1 pattern that really does the work.
  492. (define_expand "movstrsi"
  493.   [(set (match_operand:BLK 0 "general_operand" "=g")
  494.     (match_operand:BLK 1 "general_operand" "g"))
  495.    (use (match_operand:SI 2 "general_operand" "rmn"))
  496.    (match_operand 3 "" "")]
  497.   ""
  498.   "
  499.   emit_insn (gen_movstrsi1 (operands[0], operands[1], operands[2]));
  500.   DONE;
  501. ")
  502.  
  503. ;; The definition of this insn does not really explain what it does,
  504. ;; but it should suffice
  505. ;; that anything generated as this insn will be recognized as one
  506. ;; and that it won't successfully combine with anything.
  507. (define_insn "movstrsi1"
  508.   [(set (match_operand:BLK 0 "general_operand" "=g")
  509.     (match_operand:BLK 1 "general_operand" "g"))
  510.    (use (match_operand:SI 2 "general_operand" "rmn"))
  511.    (clobber (reg:SI 0))
  512.    (clobber (reg:SI 1))
  513.    (clobber (reg:SI 2))]
  514.   ""
  515.   "*
  516. {
  517.   if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
  518.     abort ();
  519.   operands[0] = XEXP (operands[0], 0);
  520.   operands[1] = XEXP (operands[1], 0);
  521.   if (GET_CODE (operands[0]) == MEM)
  522.     if (GET_CODE (operands[1]) == MEM)
  523.       output_asm_insn (\"movd %0,r2\;movd %1,r1\", operands);
  524.     else
  525.       output_asm_insn (\"movd %0,r2\;addr %a1,r1\", operands);
  526.   else if (GET_CODE (operands[1]) == MEM)
  527.     output_asm_insn (\"addr %a0,r2\;movd %1,r1\", operands);
  528.   else
  529.     output_asm_insn (\"addr %a0,r2\;addr %a1,r1\", operands);
  530.  
  531. #ifdef UTEK_ASM
  532.   if (GET_CODE (operands[2]) == CONST_INT && (INTVAL (operands[2]) & 0x3) == 0)
  533.     {
  534.       operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) >> 2);
  535.       if ((unsigned) INTVAL (operands[2]) <= 7)
  536.     return \"movqd %2,r0\;movsd $0\";
  537.       else 
  538.     return \"movd %2,r0\;movsd $0\";
  539.     }
  540.   else
  541.     {
  542.       return \"movd %2,r0\;movsb $0\";
  543.     }
  544. #else
  545.   if (GET_CODE (operands[2]) == CONST_INT && (INTVAL (operands[2]) & 0x3) == 0)
  546.     {
  547.       operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) >> 2);
  548.       if ((unsigned) INTVAL (operands[2]) <= 7)
  549.     return \"movqd %2,r0\;movsd\";
  550.       else 
  551.     return \"movd %2,r0\;movsd\";
  552.     }
  553.   else
  554.     {
  555.       return \"movd %2,r0\;movsb\";
  556.     }
  557. #endif
  558. }")
  559.  
  560. ;; Extension and truncation insns.
  561. ;; Those for integer source operand
  562. ;; are ordered widest source type first.
  563.  
  564. (define_insn "truncsiqi2"
  565.   [(set (match_operand:QI 0 "general_operand" "=g<")
  566.     (truncate:QI (match_operand:SI 1 "nonimmediate_operand" "rmn")))]
  567.   ""
  568.   "movb %1,%0")
  569.  
  570. (define_insn "truncsihi2"
  571.   [(set (match_operand:HI 0 "general_operand" "=g<")
  572.     (truncate:HI (match_operand:SI 1 "nonimmediate_operand" "rmn")))]
  573.   ""
  574.   "movw %1,%0")
  575.  
  576. (define_insn "trunchiqi2"
  577.   [(set (match_operand:QI 0 "general_operand" "=g<")
  578.     (truncate:QI (match_operand:HI 1 "nonimmediate_operand" "g")))]
  579.   ""
  580.   "movb %1,%0")
  581.  
  582. (define_insn "extendhisi2"
  583.   [(set (match_operand:SI 0 "general_operand" "=g<")
  584.     (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
  585.   ""
  586.   "movxwd %1,%0")
  587.  
  588. (define_insn "extendqihi2"
  589.   [(set (match_operand:HI 0 "general_operand" "=g<")
  590.     (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
  591.   ""
  592.   "movxbw %1,%0")
  593.  
  594. (define_insn "extendqisi2"
  595.   [(set (match_operand:SI 0 "general_operand" "=g<")
  596.     (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
  597.   ""
  598.   "movxbd %1,%0")
  599.  
  600. (define_insn "extendsfdf2"
  601.   [(set (match_operand:DF 0 "general_operand" "=fm<")
  602.     (float_extend:DF (match_operand:SF 1 "general_operand" "fmF")))]
  603.   "TARGET_32081"
  604.   "movfl %1,%0")
  605.  
  606. (define_insn "truncdfsf2"
  607.   [(set (match_operand:SF 0 "general_operand" "=fm<")
  608.     (float_truncate:SF (match_operand:DF 1 "general_operand" "fmF")))]
  609.   "TARGET_32081"
  610.   "movlf %1,%0")
  611.  
  612. (define_insn "zero_extendhisi2"
  613.   [(set (match_operand:SI 0 "general_operand" "=g<")
  614.     (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
  615.   ""
  616.   "movzwd %1,%0")
  617.  
  618. (define_insn "zero_extendqihi2"
  619.   [(set (match_operand:HI 0 "general_operand" "=g<")
  620.     (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
  621.   ""
  622.   "movzbw %1,%0")
  623.  
  624. (define_insn "zero_extendqisi2"
  625.   [(set (match_operand:SI 0 "general_operand" "=g<")
  626.     (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
  627.   ""
  628.   "movzbd %1,%0")
  629.  
  630. ;; Fix-to-float conversion insns.
  631. ;; Note that the ones that start with SImode come first.
  632. ;; That is so that an operand that is a CONST_INT
  633. ;; (and therefore lacks a specific machine mode).
  634. ;; will be recognized as SImode (which is always valid)
  635. ;; rather than as QImode or HImode.
  636.  
  637. ;; Rumor has it that the National part does not correctly convert
  638. ;; constant ints to floats.  This conversion is therefore disabled.
  639. ;; A register must be used to perform the conversion.
  640.  
  641. (define_insn "floatsisf2"
  642.   [(set (match_operand:SF 0 "general_operand" "=fm<")
  643.     (float:SF (match_operand:SI 1 "general_operand" "rm")))]
  644.   "TARGET_32081"
  645.   "movdf %1,%0")
  646.  
  647. (define_insn "floatsidf2"
  648.   [(set (match_operand:DF 0 "general_operand" "=fm<")
  649.     (float:DF (match_operand:SI 1 "general_operand" "rm")))]
  650.   "TARGET_32081"
  651.   "movdl %1,%0")
  652.  
  653. (define_insn "floathisf2"
  654.   [(set (match_operand:SF 0 "general_operand" "=fm<")
  655.     (float:SF (match_operand:HI 1 "general_operand" "rm")))]
  656.   "TARGET_32081"
  657.   "movwf %1,%0")
  658.  
  659. (define_insn "floathidf2"
  660.   [(set (match_operand:DF 0 "general_operand" "=fm<")
  661.     (float:DF (match_operand:HI 1 "general_operand" "rm")))]
  662.   "TARGET_32081"
  663.   "movwl %1,%0")
  664.  
  665. (define_insn "floatqisf2"
  666.   [(set (match_operand:SF 0 "general_operand" "=fm<")
  667.     (float:SF (match_operand:QI 1 "general_operand" "rm")))]
  668.   "TARGET_32081"
  669.   "movbf %1,%0")
  670.  
  671. ; Some assemblers warn that this insn doesn't work.
  672. ; Maybe they know something we don't.
  673. ;(define_insn "floatqidf2"
  674. ;  [(set (match_operand:DF 0 "general_operand" "=fm<")
  675. ;    (float:DF (match_operand:QI 1 "general_operand" "rm")))]
  676. ;  "TARGET_32081"
  677. ;  "movbl %1,%0")
  678.  
  679. ;; Float-to-fix conversion insns.
  680. ;; The sequent compiler always generates "trunc" insns.
  681.  
  682. (define_insn "fixsfqi2"
  683.   [(set (match_operand:QI 0 "general_operand" "=g<")
  684.     (fix:QI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
  685.   "TARGET_32081"
  686.   "truncfb %1,%0")
  687.  
  688. (define_insn "fixsfhi2"
  689.   [(set (match_operand:HI 0 "general_operand" "=g<")
  690.     (fix:HI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
  691.   "TARGET_32081"
  692.   "truncfw %1,%0")
  693.  
  694. (define_insn "fixsfsi2"
  695.   [(set (match_operand:SI 0 "general_operand" "=g<")
  696.     (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
  697.   "TARGET_32081"
  698.   "truncfd %1,%0")
  699.  
  700. (define_insn "fixdfqi2"
  701.   [(set (match_operand:QI 0 "general_operand" "=g<")
  702.     (fix:QI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
  703.   "TARGET_32081"
  704.   "trunclb %1,%0")
  705.  
  706. (define_insn "fixdfhi2"
  707.   [(set (match_operand:HI 0 "general_operand" "=g<")
  708.     (fix:HI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
  709.   "TARGET_32081"
  710.   "trunclw %1,%0")
  711.  
  712. (define_insn "fixdfsi2"
  713.   [(set (match_operand:SI 0 "general_operand" "=g<")
  714.     (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
  715.   "TARGET_32081"
  716.   "truncld %1,%0")
  717.  
  718. ;; Unsigned
  719.  
  720. (define_insn "fixunssfqi2"
  721.   [(set (match_operand:QI 0 "general_operand" "=g<")
  722.     (unsigned_fix:QI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
  723.   "TARGET_32081"
  724.   "truncfb %1,%0")
  725.  
  726. (define_insn "fixunssfhi2"
  727.   [(set (match_operand:HI 0 "general_operand" "=g<")
  728.     (unsigned_fix:HI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
  729.   "TARGET_32081"
  730.   "truncfw %1,%0")
  731.  
  732. (define_insn "fixunssfsi2"
  733.   [(set (match_operand:SI 0 "general_operand" "=g<")
  734.     (unsigned_fix:SI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
  735.   "TARGET_32081"
  736.   "truncfd %1,%0")
  737.  
  738. (define_insn "fixunsdfqi2"
  739.   [(set (match_operand:QI 0 "general_operand" "=g<")
  740.     (unsigned_fix:QI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
  741.   "TARGET_32081"
  742.   "trunclb %1,%0")
  743.  
  744. (define_insn "fixunsdfhi2"
  745.   [(set (match_operand:HI 0 "general_operand" "=g<")
  746.     (unsigned_fix:HI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
  747.   "TARGET_32081"
  748.   "trunclw %1,%0")
  749.  
  750. (define_insn "fixunsdfsi2"
  751.   [(set (match_operand:SI 0 "general_operand" "=g<")
  752.     (unsigned_fix:SI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
  753.   "TARGET_32081"
  754.   "truncld %1,%0")
  755.  
  756. ;;; These are not yet used by GCC
  757. (define_insn "fix_truncsfqi2"
  758.   [(set (match_operand:QI 0 "general_operand" "=g<")
  759.     (fix:QI (match_operand:SF 1 "general_operand" "fm")))]
  760.   "TARGET_32081"
  761.   "truncfb %1,%0")
  762.  
  763. (define_insn "fix_truncsfhi2"
  764.   [(set (match_operand:HI 0 "general_operand" "=g<")
  765.     (fix:HI (match_operand:SF 1 "general_operand" "fm")))]
  766.   "TARGET_32081"
  767.   "truncfw %1,%0")
  768.  
  769. (define_insn "fix_truncsfsi2"
  770.   [(set (match_operand:SI 0 "general_operand" "=g<")
  771.     (fix:SI (match_operand:SF 1 "general_operand" "fm")))]
  772.   "TARGET_32081"
  773.   "truncfd %1,%0")
  774.  
  775. (define_insn "fix_truncdfqi2"
  776.   [(set (match_operand:QI 0 "general_operand" "=g<")
  777.     (fix:QI (match_operand:DF 1 "general_operand" "fm")))]
  778.   "TARGET_32081"
  779.   "trunclb %1,%0")
  780.  
  781. (define_insn "fix_truncdfhi2"
  782.   [(set (match_operand:HI 0 "general_operand" "=g<")
  783.     (fix:HI (match_operand:DF 1 "general_operand" "fm")))]
  784.   "TARGET_32081"
  785.   "trunclw %1,%0")
  786.  
  787. (define_insn "fix_truncdfsi2"
  788.   [(set (match_operand:SI 0 "general_operand" "=g<")
  789.     (fix:SI (match_operand:DF 1 "general_operand" "fm")))]
  790.   "TARGET_32081"
  791.   "truncld %1,%0")
  792.  
  793. ;;- All kinds of add instructions.
  794.  
  795. (define_insn "adddf3"
  796.   [(set (match_operand:DF 0 "general_operand" "=fm")
  797.     (plus:DF (match_operand:DF 1 "general_operand" "%0")
  798.          (match_operand:DF 2 "general_operand" "fmF")))]
  799.   "TARGET_32081"
  800.   "addl %2,%0")
  801.  
  802.  
  803. (define_insn "addsf3"
  804.   [(set (match_operand:SF 0 "general_operand" "=fm")
  805.     (plus:SF (match_operand:SF 1 "general_operand" "%0")
  806.          (match_operand:SF 2 "general_operand" "fmF")))]
  807.   "TARGET_32081"
  808.   "addf %2,%0")
  809.  
  810. (define_insn ""
  811.   [(set (reg:SI 17)
  812.     (plus:SI (reg:SI 17)
  813.          (match_operand:SI 0 "immediate_operand" "i")))]
  814.   "GET_CODE (operands[0]) == CONST_INT"
  815.   "*
  816. {
  817. #ifndef SEQUENT_ADJUST_STACK
  818.   if (TARGET_32532)
  819.     if (INTVAL (operands[0]) == 8)
  820.       return \"cmpd tos,tos\";
  821.   if (TARGET_32532 || TARGET_32332)
  822.     if (INTVAL (operands[0]) == 4)
  823.       return \"cmpqd %$0,tos\";
  824. #endif
  825.   if (! TARGET_32532)
  826.     {
  827.       if (INTVAL (operands[0]) < 64 && INTVAL (operands[0]) > -64)
  828.         return \"adjspb %$%n0\";
  829.       else if (INTVAL (operands[0]) < 8192 && INTVAL (operands[0]) >= -8192)
  830.         return \"adjspw %$%n0\";
  831.     }
  832.   return \"adjspd %$%n0\";
  833. }")
  834.  
  835. (define_insn ""
  836.   [(set (match_operand:SI 0 "general_operand" "=g<")
  837.     (plus:SI (reg:SI 16)
  838.          (match_operand:SI 1 "immediate_operand" "i")))]
  839.   "GET_CODE (operands[1]) == CONST_INT"
  840.   "addr %c1(fp),%0")
  841.  
  842. (define_insn ""
  843.   [(set (match_operand:SI 0 "general_operand" "=g<")
  844.     (plus:SI (reg:SI 17)
  845.          (match_operand:SI 1 "immediate_operand" "i")))]
  846.   "GET_CODE (operands[1]) == CONST_INT"
  847.   "addr %c1(sp),%0")
  848.  
  849. (define_insn "addsi3"
  850.   [(set (match_operand:SI 0 "general_operand" "=g,=g&<")
  851.     (plus:SI (match_operand:SI 1 "general_operand" "%0,r")
  852.          (match_operand:SI 2 "general_operand" "rmn,n")))]
  853.   ""
  854.   "*
  855. {
  856.   if (which_alternative == 1)
  857.     {
  858.       int i = INTVAL (operands[2]);
  859.       if (NS32K_DISPLACEMENT_P (i))
  860.     return \"addr %c2(%1),%0\";
  861.       else
  862.     return \"movd %1,%0\;addd %2,%0\";
  863.     }
  864.   if (GET_CODE (operands[2]) == CONST_INT)
  865.     {
  866.       int i = INTVAL (operands[2]);
  867.  
  868.       if (i <= 7 && i >= -8)
  869.     return \"addqd %2,%0\";
  870.       else if (GET_CODE (operands[0]) == REG
  871.            && i < 0x4000 && i >= -0x4000 && ! TARGET_32532)
  872.     return \"addr %c2(%0),%0\";
  873.     }
  874.   return \"addd %2,%0\";
  875. }")
  876.  
  877. (define_insn "addhi3"
  878.   [(set (match_operand:HI 0 "general_operand" "=g")
  879.     (plus:HI (match_operand:HI 1 "general_operand" "%0")
  880.          (match_operand:HI 2 "general_operand" "g")))]
  881.   ""
  882.   "*
  883. { if (GET_CODE (operands[2]) == CONST_INT)
  884.     {
  885.       int i = INTVAL (operands[2]);
  886.       if (i <= 7 && i >= -8)
  887.     return \"addqw %2,%0\";
  888.     }
  889.   return \"addw %2,%0\";
  890. }")
  891.  
  892. (define_insn ""
  893.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "=r"))
  894.     (plus:HI (match_operand:HI 1 "general_operand" "0")
  895.          (match_operand:HI 2 "general_operand" "g")))]
  896.   ""
  897.   "*
  898. {
  899.   if (GET_CODE (operands[1]) == CONST_INT
  900.       && INTVAL (operands[1]) >-9 && INTVAL(operands[1]) < 8)
  901.     return \"addqw %2,%0\";
  902.   return \"addw %2,%0\";
  903. }")
  904.  
  905. (define_insn "addqi3"
  906.   [(set (match_operand:QI 0 "general_operand" "=g")
  907.     (plus:QI (match_operand:QI 1 "general_operand" "%0")
  908.          (match_operand:QI 2 "general_operand" "g")))]
  909.   ""
  910.   "*
  911. { if (GET_CODE (operands[2]) == CONST_INT)
  912.     {
  913.       int i = INTVAL (operands[2]);
  914.       if (i <= 7 && i >= -8)
  915.     return \"addqb %2,%0\";
  916.     }
  917.   return \"addb %2,%0\";
  918. }")
  919.  
  920. (define_insn ""
  921.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "=r"))
  922.     (plus:QI (match_operand:QI 1 "general_operand" "0")
  923.          (match_operand:QI 2 "general_operand" "g")))]
  924.   ""
  925.   "*
  926. {
  927.   if (GET_CODE (operands[1]) == CONST_INT
  928.       && INTVAL (operands[1]) >-9 && INTVAL(operands[1]) < 8)
  929.     return \"addqb %2,%0\";
  930.   return \"addb %2,%0\";
  931. }")
  932.  
  933. ;;- All kinds of subtract instructions.
  934.  
  935. (define_insn "subdf3"
  936.   [(set (match_operand:DF 0 "general_operand" "=fm")
  937.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  938.           (match_operand:DF 2 "general_operand" "fmF")))]
  939.   "TARGET_32081"
  940.   "subl %2,%0")
  941.  
  942. (define_insn "subsf3"
  943.   [(set (match_operand:SF 0 "general_operand" "=fm")
  944.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  945.           (match_operand:SF 2 "general_operand" "fmF")))]
  946.   "TARGET_32081"
  947.   "subf %2,%0")
  948.  
  949. (define_insn ""
  950.   [(set (reg:SI 17)
  951.     (minus:SI (reg:SI 17)
  952.           (match_operand:SI 0 "immediate_operand" "i")))]
  953.   "GET_CODE (operands[0]) == CONST_INT"
  954.   "*
  955. {
  956.   if (GET_CODE(operands[0]) == CONST_INT && INTVAL(operands[0]) < 64
  957.       && INTVAL(operands[0]) > -64 && ! TARGET_32532)
  958.     return \"adjspb %$%0\";
  959.   return \"adjspd %$%0\";
  960. }")
  961.  
  962. (define_insn "subsi3"
  963.   [(set (match_operand:SI 0 "general_operand" "=g")
  964.     (minus:SI (match_operand:SI 1 "general_operand" "0")
  965.           (match_operand:SI 2 "general_operand" "rmn")))]
  966.   ""
  967.   "*
  968. { if (GET_CODE (operands[2]) == CONST_INT)
  969.     {
  970.       int i = INTVAL (operands[2]);
  971.  
  972.       if (i <= 8 && i >= -7)
  973.         return \"addqd %$%n2,%0\";
  974.     }
  975.   return \"subd %2,%0\";
  976. }")
  977.  
  978. (define_insn "subhi3"
  979.   [(set (match_operand:HI 0 "general_operand" "=g")
  980.     (minus:HI (match_operand:HI 1 "general_operand" "0")
  981.           (match_operand:HI 2 "general_operand" "g")))]
  982.   ""
  983.   "*
  984. { if (GET_CODE (operands[2]) == CONST_INT)
  985.     {
  986.       int i = INTVAL (operands[2]);
  987.  
  988.       if (i <= 8 && i >= -7)
  989.         return \"addqw %$%n2,%0\";
  990.     }
  991.   return \"subw %2,%0\";
  992. }")
  993.  
  994. (define_insn ""
  995.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "=r"))
  996.     (minus:HI (match_operand:HI 1 "general_operand" "0")
  997.           (match_operand:HI 2 "general_operand" "g")))]
  998.   ""
  999.   "*
  1000. {
  1001.   if (GET_CODE (operands[1]) == CONST_INT
  1002.       && INTVAL (operands[1]) >-8 && INTVAL(operands[1]) < 9)
  1003.     return \"addqw %$%n2,%0\";
  1004.   return \"subw %2,%0\";
  1005. }")
  1006.  
  1007. (define_insn "subqi3"
  1008.   [(set (match_operand:QI 0 "general_operand" "=g")
  1009.     (minus:QI (match_operand:QI 1 "general_operand" "0")
  1010.           (match_operand:QI 2 "general_operand" "g")))]
  1011.   ""
  1012.   "*
  1013. { if (GET_CODE (operands[2]) == CONST_INT)
  1014.     {
  1015.       int i = INTVAL (operands[2]);
  1016.  
  1017.       if (i <= 8 && i >= -7)
  1018.     return \"addqb %$%n2,%0\";
  1019.     }
  1020.   return \"subb %2,%0\";
  1021. }")
  1022.  
  1023. (define_insn ""
  1024.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "=r"))
  1025.     (minus:QI (match_operand:QI 1 "general_operand" "0")
  1026.           (match_operand:QI 2 "general_operand" "g")))]
  1027.   ""
  1028.   "*
  1029. {
  1030.   if (GET_CODE (operands[1]) == CONST_INT
  1031.       && INTVAL (operands[1]) >-8 && INTVAL(operands[1]) < 9)
  1032.     return \"addqb %$%n2,%0\";
  1033.   return \"subb %2,%0\";
  1034. }")
  1035.  
  1036. ;;- Multiply instructions.
  1037.  
  1038. (define_insn "muldf3"
  1039.   [(set (match_operand:DF 0 "general_operand" "=fm")
  1040.     (mult:DF (match_operand:DF 1 "general_operand" "%0")
  1041.          (match_operand:DF 2 "general_operand" "fmF")))]
  1042.   "TARGET_32081"
  1043.   "mull %2,%0")
  1044.  
  1045. (define_insn "mulsf3"
  1046.   [(set (match_operand:SF 0 "general_operand" "=fm")
  1047.     (mult:SF (match_operand:SF 1 "general_operand" "%0")
  1048.          (match_operand:SF 2 "general_operand" "fmF")))]
  1049.   "TARGET_32081"
  1050.   "mulf %2,%0")
  1051.  
  1052. (define_insn "mulsi3"
  1053.   [(set (match_operand:SI 0 "general_operand" "=g")
  1054.     (mult:SI (match_operand:SI 1 "general_operand" "%0")
  1055.          (match_operand:SI 2 "general_operand" "rmn")))]
  1056.   ""
  1057.   "muld %2,%0")
  1058.  
  1059. (define_insn "mulhi3"
  1060.   [(set (match_operand:HI 0 "general_operand" "=g")
  1061.     (mult:HI (match_operand:HI 1 "general_operand" "%0")
  1062.          (match_operand:HI 2 "general_operand" "g")))]
  1063.   ""
  1064.   "mulw %2,%0")
  1065.  
  1066. (define_insn "mulqi3"
  1067.   [(set (match_operand:QI 0 "general_operand" "=g")
  1068.     (mult:QI (match_operand:QI 1 "general_operand" "%0")
  1069.          (match_operand:QI 2 "general_operand" "g")))]
  1070.   ""
  1071.   "mulb %2,%0")
  1072.  
  1073. (define_insn "umulsidi3"
  1074.   [(set (match_operand:DI 0 "general_operand" "=g")
  1075.     (mult:DI (zero_extend:DI
  1076.           (match_operand:SI 1 "nonimmediate_operand" "0"))
  1077.          (zero_extend:DI
  1078.           (match_operand:SI 2 "nonimmediate_operand" "rmn"))))]
  1079.   ""
  1080.   "meid %2,%0")
  1081.  
  1082. ;;- Divide instructions.
  1083.  
  1084. (define_insn "divdf3"
  1085.   [(set (match_operand:DF 0 "general_operand" "=fm")
  1086.     (div:DF (match_operand:DF 1 "general_operand" "0")
  1087.         (match_operand:DF 2 "general_operand" "fmF")))]
  1088.   "TARGET_32081"
  1089.   "divl %2,%0")
  1090.  
  1091. (define_insn "divsf3"
  1092.   [(set (match_operand:SF 0 "general_operand" "=fm")
  1093.     (div:SF (match_operand:SF 1 "general_operand" "0")
  1094.         (match_operand:SF 2 "general_operand" "fmF")))]
  1095.   "TARGET_32081"
  1096.   "divf %2,%0")
  1097.  
  1098. (define_insn "divsi3"
  1099.   [(set (match_operand:SI 0 "general_operand" "=g")
  1100.     (div:SI (match_operand:SI 1 "general_operand" "0")
  1101.         (match_operand:SI 2 "general_operand" "rmn")))]
  1102.   ""
  1103.   "quod %2,%0")
  1104.  
  1105. (define_insn "divhi3"
  1106.   [(set (match_operand:HI 0 "general_operand" "=g")
  1107.     (div:HI (match_operand:HI 1 "general_operand" "0")
  1108.         (match_operand:HI 2 "general_operand" "g")))]
  1109.   ""
  1110.   "quow %2,%0")
  1111.  
  1112. (define_insn "divqi3"
  1113.   [(set (match_operand:QI 0 "general_operand" "=g")
  1114.     (div:QI (match_operand:QI 1 "general_operand" "0")
  1115.         (match_operand:QI 2 "general_operand" "g")))]
  1116.   ""
  1117.   "quob %2,%0")
  1118.  
  1119. (define_insn "udivsi3"
  1120.   [(set (match_operand:SI 0 "register_operand" "=r")
  1121.     (udiv:SI (subreg:SI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
  1122.          (match_operand:SI 2 "general_operand" "rmn")))]
  1123.   ""
  1124.   "*
  1125. {
  1126.   operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1127.   return \"deid %2,%0\;movd %1,%0\";
  1128. }")
  1129.  
  1130. (define_insn "udivhi3"
  1131.   [(set (match_operand:HI 0 "register_operand" "=r")
  1132.     (udiv:HI (subreg:HI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
  1133.          (match_operand:HI 2 "general_operand" "g")))]
  1134.   ""
  1135.   "*
  1136. {
  1137.   operands[1] = gen_rtx (REG, HImode, REGNO (operands[0]) + 1);
  1138.   return \"deiw %2,%0\;movw %1,%0\";
  1139. }")
  1140.  
  1141. (define_insn "udivqi3"
  1142.   [(set (match_operand:QI 0 "register_operand" "=r")
  1143.     (udiv:QI (subreg:QI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
  1144.          (match_operand:QI 2 "general_operand" "g")))]
  1145.   ""
  1146.   "*
  1147. {
  1148.   operands[1] = gen_rtx (REG, QImode, REGNO (operands[0]) + 1);
  1149.   return \"deib %2,%0\;movb %1,%0\";
  1150. }")
  1151.  
  1152. ;; Remainder instructions.
  1153.  
  1154. (define_insn "modsi3"
  1155.   [(set (match_operand:SI 0 "general_operand" "=g")
  1156.     (mod:SI (match_operand:SI 1 "general_operand" "0")
  1157.         (match_operand:SI 2 "general_operand" "rmn")))]
  1158.   ""
  1159.   "remd %2,%0")
  1160.  
  1161. (define_insn "modhi3"
  1162.   [(set (match_operand:HI 0 "general_operand" "=g")
  1163.     (mod:HI (match_operand:HI 1 "general_operand" "0")
  1164.         (match_operand:HI 2 "general_operand" "g")))]
  1165.   ""
  1166.   "remw %2,%0")
  1167.  
  1168. (define_insn "modqi3"
  1169.   [(set (match_operand:QI 0 "general_operand" "=g")
  1170.     (mod:QI (match_operand:QI 1 "general_operand" "0")
  1171.         (match_operand:QI 2 "general_operand" "g")))]
  1172.   ""
  1173.   "remb %2,%0")
  1174.  
  1175. (define_insn "umodsi3"
  1176.   [(set (match_operand:SI 0 "register_operand" "=r")
  1177.     (umod:SI (subreg:SI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
  1178.          (match_operand:SI 2 "general_operand" "rmn")))]
  1179.   ""
  1180.   "deid %2,%0")
  1181.  
  1182. (define_insn "umodhi3"
  1183.   [(set (match_operand:HI 0 "register_operand" "=r")
  1184.     (umod:HI (subreg:HI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
  1185.          (match_operand:HI 2 "general_operand" "g")))]
  1186.   ""
  1187.   "deiw %2,%0")
  1188.  
  1189. (define_insn "umodqi3"
  1190.   [(set (match_operand:QI 0 "register_operand" "=r")
  1191.     (umod:QI (subreg:QI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
  1192.          (match_operand:QI 2 "general_operand" "g")))]
  1193.   ""
  1194.   "deib %2,%0")
  1195.  
  1196. ; This isn't be usable in its current form.
  1197. ;(define_insn "udivmoddisi4"
  1198. ;  [(set (subreg:SI (match_operand:DI 0 "general_operand" "=r") 1)
  1199. ;    (udiv:SI (match_operand:DI 1 "general_operand" "0")
  1200. ;         (match_operand:SI 2 "general_operand" "rmn")))
  1201. ;   (set (subreg:SI (match_dup 0) 0)
  1202. ;    (umod:SI (match_dup 1) (match_dup 2)))]
  1203. ;  ""
  1204. ;  "deid %2,%0")
  1205.  
  1206. ;;- Logical Instructions: AND
  1207.  
  1208. (define_insn "andsi3"
  1209.   [(set (match_operand:SI 0 "general_operand" "=g")
  1210.     (and:SI (match_operand:SI 1 "general_operand" "%0")
  1211.         (match_operand:SI 2 "general_operand" "rmn")))]
  1212.   ""
  1213.   "*
  1214. {
  1215.   if (GET_CODE (operands[2]) == CONST_INT)
  1216.     {
  1217.       if ((INTVAL (operands[2]) | 0xff) == 0xffffffff)
  1218.     {
  1219.       if (INTVAL (operands[2]) == 0xffffff00)
  1220.         return \"movqb %$0,%0\";
  1221.       else
  1222.         {
  1223.           operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1224.                      INTVAL (operands[2]) & 0xff);
  1225.           return \"andb %2,%0\";
  1226.         }
  1227.     }
  1228.       if ((INTVAL (operands[2]) | 0xffff) == 0xffffffff)
  1229.         {
  1230.       if (INTVAL (operands[2]) == 0xffff0000)
  1231.         return \"movqw %$0,%0\";
  1232.       else
  1233.         {
  1234.           operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1235.                      INTVAL (operands[2]) & 0xffff);
  1236.           return \"andw %2,%0\";
  1237.         }
  1238.     }
  1239.     }
  1240.   return \"andd %2,%0\";
  1241. }")
  1242.  
  1243. (define_insn "andhi3"
  1244.   [(set (match_operand:HI 0 "general_operand" "=g")
  1245.     (and:HI (match_operand:HI 1 "general_operand" "%0")
  1246.         (match_operand:HI 2 "general_operand" "g")))]
  1247.   ""
  1248.   "*
  1249. {
  1250.   if (GET_CODE (operands[2]) == CONST_INT
  1251.       && (INTVAL (operands[2]) | 0xff) == 0xffffffff)
  1252.     {
  1253.       if (INTVAL (operands[2]) == 0xffffff00)
  1254.     return \"movqb %$0,%0\";
  1255.       else
  1256.     {
  1257.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1258.                  INTVAL (operands[2]) & 0xff);
  1259.       return \"andb %2,%0\";
  1260.     }
  1261.     }
  1262.   return \"andw %2,%0\";
  1263. }")
  1264.  
  1265. (define_insn "andqi3"
  1266.   [(set (match_operand:QI 0 "general_operand" "=g")
  1267.     (and:QI (match_operand:QI 1 "general_operand" "%0")
  1268.         (match_operand:QI 2 "general_operand" "g")))]
  1269.   ""
  1270.   "andb %2,%0")
  1271.  
  1272. (define_insn ""
  1273.   [(set (match_operand:SI 0 "general_operand" "=g")
  1274.     (and:SI (not:SI (match_operand:SI 1 "general_operand" "rmn"))
  1275.         (match_operand:SI 2 "general_operand" "0")))]
  1276.   ""
  1277.   "bicd %1,%0")
  1278.  
  1279. (define_insn ""
  1280.   [(set (match_operand:HI 0 "general_operand" "=g")
  1281.     (and:HI (not:HI (match_operand:HI 1 "general_operand" "g"))
  1282.         (match_operand:HI 2 "general_operand" "0")))]
  1283.   ""
  1284.   "bicw %1,%0")
  1285.  
  1286. (define_insn ""
  1287.   [(set (match_operand:QI 0 "general_operand" "=g")
  1288.     (and:QI (not:QI (match_operand:QI 1 "general_operand" "g"))
  1289.         (match_operand:QI 2 "general_operand" "0")))]
  1290.   ""
  1291.   "bicb %1,%0")
  1292.  
  1293. ;;- Bit set instructions.
  1294.  
  1295. (define_insn "iorsi3"
  1296.   [(set (match_operand:SI 0 "general_operand" "=g")
  1297.     (ior:SI (match_operand:SI 1 "general_operand" "%0")
  1298.         (match_operand:SI 2 "general_operand" "rmn")))]
  1299.   ""
  1300.   "*
  1301. {
  1302.   if (GET_CODE (operands[2]) == CONST_INT) {
  1303.     if ((INTVAL (operands[2]) & 0xffffff00) == 0)
  1304.       return \"orb %2,%0\";
  1305.     if ((INTVAL (operands[2]) & 0xffff0000) == 0)
  1306.       return \"orw %2,%0\";
  1307.   }
  1308.   return \"ord %2,%0\";
  1309. }")
  1310.  
  1311. (define_insn "iorhi3"
  1312.   [(set (match_operand:HI 0 "general_operand" "=g")
  1313.     (ior:HI (match_operand:HI 1 "general_operand" "%0")
  1314.         (match_operand:HI 2 "general_operand" "g")))]
  1315.   ""
  1316.   "*
  1317. {
  1318.   if (GET_CODE(operands[2]) == CONST_INT &&
  1319.       (INTVAL(operands[2]) & 0xffffff00) == 0)
  1320.     return \"orb %2,%0\";
  1321.   return \"orw %2,%0\";
  1322. }")
  1323.  
  1324. (define_insn "iorqi3"
  1325.   [(set (match_operand:QI 0 "general_operand" "=g")
  1326.     (ior:QI (match_operand:QI 1 "general_operand" "%0")
  1327.         (match_operand:QI 2 "general_operand" "g")))]
  1328.   ""
  1329.   "orb %2,%0")
  1330.  
  1331. ;;- xor instructions.
  1332.  
  1333. (define_insn "xorsi3"
  1334.   [(set (match_operand:SI 0 "general_operand" "=g")
  1335.     (xor:SI (match_operand:SI 1 "general_operand" "%0")
  1336.         (match_operand:SI 2 "general_operand" "rmn")))]
  1337.   ""
  1338.   "*
  1339. {
  1340.   if (GET_CODE (operands[2]) == CONST_INT) {
  1341.     if ((INTVAL (operands[2]) & 0xffffff00) == 0)
  1342.       return \"xorb %2,%0\";
  1343.     if ((INTVAL (operands[2]) & 0xffff0000) == 0)
  1344.       return \"xorw %2,%0\";
  1345.   }
  1346.   return \"xord %2,%0\";
  1347. }")
  1348.  
  1349. (define_insn "xorhi3"
  1350.   [(set (match_operand:HI 0 "general_operand" "=g")
  1351.     (xor:HI (match_operand:HI 1 "general_operand" "%0")
  1352.         (match_operand:HI 2 "general_operand" "g")))]
  1353.   ""
  1354.   "*
  1355. {
  1356.   if (GET_CODE(operands[2]) == CONST_INT &&
  1357.       (INTVAL(operands[2]) & 0xffffff00) == 0)
  1358.     return \"xorb %2,%0\";
  1359.   return \"xorw %2,%0\";
  1360. }")
  1361.  
  1362. (define_insn "xorqi3"
  1363.   [(set (match_operand:QI 0 "general_operand" "=g")
  1364.     (xor:QI (match_operand:QI 1 "general_operand" "%0")
  1365.         (match_operand:QI 2 "general_operand" "g")))]
  1366.   ""
  1367.   "xorb %2,%0")
  1368.  
  1369. (define_insn "negdf2"
  1370.   [(set (match_operand:DF 0 "general_operand" "=fm<")
  1371.     (neg:DF (match_operand:DF 1 "general_operand" "fmF")))]
  1372.   "TARGET_32081"
  1373.   "negl %1,%0")
  1374.  
  1375. (define_insn "negsf2"
  1376.   [(set (match_operand:SF 0 "general_operand" "=fm<")
  1377.     (neg:SF (match_operand:SF 1 "general_operand" "fmF")))]
  1378.   "TARGET_32081"
  1379.   "negf %1,%0")
  1380.  
  1381. (define_insn "negsi2"
  1382.   [(set (match_operand:SI 0 "general_operand" "=g<")
  1383.     (neg:SI (match_operand:SI 1 "general_operand" "rmn")))]
  1384.   ""
  1385.   "negd %1,%0")
  1386.  
  1387. (define_insn "neghi2"
  1388.   [(set (match_operand:HI 0 "general_operand" "=g<")
  1389.     (neg:HI (match_operand:HI 1 "general_operand" "g")))]
  1390.   ""
  1391.   "negw %1,%0")
  1392.  
  1393. (define_insn "negqi2"
  1394.   [(set (match_operand:QI 0 "general_operand" "=g<")
  1395.     (neg:QI (match_operand:QI 1 "general_operand" "g")))]
  1396.   ""
  1397.   "negb %1,%0")
  1398.  
  1399. (define_insn "one_cmplsi2"
  1400.   [(set (match_operand:SI 0 "general_operand" "=g<")
  1401.     (not:SI (match_operand:SI 1 "general_operand" "rmn")))]
  1402.   ""
  1403.   "comd %1,%0")
  1404.  
  1405. (define_insn "one_cmplhi2"
  1406.   [(set (match_operand:HI 0 "general_operand" "=g<")
  1407.     (not:HI (match_operand:HI 1 "general_operand" "g")))]
  1408.   ""
  1409.   "comw %1,%0")
  1410.  
  1411. (define_insn "one_cmplqi2"
  1412.   [(set (match_operand:QI 0 "general_operand" "=g<")
  1413.     (not:QI (match_operand:QI 1 "general_operand" "g")))]
  1414.   ""
  1415.   "comb %1,%0")
  1416.  
  1417. ;; arithmetic left and right shift operations
  1418. ;; on the 32532 we will always use lshd for arithmetic left shifts,
  1419. ;; because it is three times faster.  Broken programs which
  1420. ;; use negative shift counts are probably broken differently
  1421. ;; than elsewhere.
  1422.  
  1423. ;; alternative 0 never matches on the 32532
  1424. (define_insn "ashlsi3"
  1425.   [(set (match_operand:SI 0 "general_operand" "=g,g")
  1426.     (ashift:SI (match_operand:SI 1 "general_operand" "r,0")
  1427.            (match_operand:SI 2 "general_operand" "I,rmn")))]
  1428.   ""
  1429.   "*
  1430. { if (TARGET_32532)
  1431.     return \"lshd %2,%0\";
  1432.   else
  1433.     return output_shift_insn (operands);
  1434. }")
  1435.  
  1436. (define_insn "ashlhi3"
  1437.   [(set (match_operand:HI 0 "general_operand" "=g")
  1438.     (ashift:HI (match_operand:HI 1 "general_operand" "0")
  1439.            (match_operand:SI 2 "general_operand" "rmn")))]
  1440.   ""
  1441.   "*
  1442. { if (GET_CODE (operands[2]) == CONST_INT)
  1443.     {
  1444.       if (INTVAL (operands[2]) == 1)
  1445.     return \"addw %0,%0\";
  1446.       else if (INTVAL (operands[2]) == 2 && !TARGET_32532)
  1447.     return \"addw %0,%0\;addw %0,%0\";
  1448.     }
  1449.   if (TARGET_32532)
  1450.     return \"lshw %2,%0\";
  1451.   else
  1452.     return \"ashw %2,%0\";
  1453. }")
  1454.  
  1455. (define_insn "ashlqi3"
  1456.   [(set (match_operand:QI 0 "general_operand" "=g")
  1457.     (ashift:QI (match_operand:QI 1 "general_operand" "0")
  1458.            (match_operand:SI 2 "general_operand" "rmn")))]
  1459.   ""
  1460.   "*
  1461. { if (GET_CODE (operands[2]) == CONST_INT)
  1462.     {
  1463.       if (INTVAL (operands[2]) == 1)
  1464.     return \"addb %0,%0\";
  1465.       else if (INTVAL (operands[2]) == 2 && !TARGET_32532)
  1466.     return \"addb %0,%0\;addb %0,%0\";
  1467.     }
  1468.   if (TARGET_32532)
  1469.     return \"lshb %2,%0\";
  1470.   else
  1471.     return \"ashb %2,%0\";
  1472. }")
  1473.  
  1474. ;; Arithmetic right shift on the 32k works by negating the shift count.
  1475. (define_expand "ashrsi3"
  1476.   [(set (match_operand:SI 0 "general_operand" "=g")
  1477.     (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
  1478.              (match_operand:SI 2 "general_operand" "g")))]
  1479.   ""
  1480.   "
  1481. {
  1482.   if (GET_CODE (operands[2]) != CONST_INT)
  1483.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1484. }")
  1485.  
  1486. (define_insn ""
  1487.   [(set (match_operand:SI 0 "general_operand" "=g")
  1488.     (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
  1489.              (match_operand:SI 2 "immediate_operand" "i")))]
  1490.   ""
  1491.   "ashd %$%n2,%0")
  1492.  
  1493. (define_insn ""
  1494.   [(set (match_operand:SI 0 "general_operand" "=g")
  1495.     (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
  1496.              (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
  1497.   ""
  1498.   "ashd %2,%0")
  1499.  
  1500. (define_expand "ashrhi3"
  1501.   [(set (match_operand:HI 0 "general_operand" "=g")
  1502.     (ashiftrt:HI (match_operand:HI 1 "general_operand" "g")
  1503.              (match_operand:SI 2 "general_operand" "g")))]
  1504.   ""
  1505.   "
  1506. {
  1507.   if (GET_CODE (operands[2]) != CONST_INT)
  1508.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1509. }")
  1510.  
  1511. (define_insn ""
  1512.   [(set (match_operand:HI 0 "general_operand" "=g")
  1513.     (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
  1514.              (match_operand:SI 2 "immediate_operand" "i")))]
  1515.   ""
  1516.   "ashw %$%n2,%0")
  1517.  
  1518. (define_insn ""
  1519.   [(set (match_operand:HI 0 "general_operand" "=g")
  1520.     (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
  1521.              (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
  1522.   ""
  1523.   "ashw %2,%0")
  1524.  
  1525. (define_expand "ashrqi3"
  1526.   [(set (match_operand:QI 0 "general_operand" "=g")
  1527.     (ashiftrt:QI (match_operand:QI 1 "general_operand" "g")
  1528.              (match_operand:SI 2 "general_operand" "g")))]
  1529.   ""
  1530.   "
  1531. {
  1532.   if (GET_CODE (operands[2]) != CONST_INT)
  1533.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1534. }")
  1535.  
  1536. (define_insn ""
  1537.   [(set (match_operand:QI 0 "general_operand" "=g")
  1538.     (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
  1539.              (match_operand:SI 2 "immediate_operand" "i")))]
  1540.   ""
  1541.   "ashb %$%n2,%0")
  1542.  
  1543. (define_insn ""
  1544.   [(set (match_operand:QI 0 "general_operand" "=g")
  1545.     (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
  1546.              (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
  1547.   ""
  1548.   "ashb %2,%0")
  1549.  
  1550. ;; logical shift instructions
  1551.  
  1552. ;; Logical right shift on the 32k works by negating the shift count.
  1553. (define_expand "lshrsi3"
  1554.   [(set (match_operand:SI 0 "general_operand" "=g")
  1555.     (lshiftrt:SI (match_operand:SI 1 "general_operand" "g")
  1556.              (match_operand:SI 2 "general_operand" "g")))]
  1557.   ""
  1558.   "
  1559. {
  1560.   if (GET_CODE (operands[2]) != CONST_INT)
  1561.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1562. }")
  1563.  
  1564. (define_insn ""
  1565.   [(set (match_operand:SI 0 "general_operand" "=g")
  1566.     (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
  1567.              (match_operand:SI 2 "immediate_operand" "i")))]
  1568.   ""
  1569.   "lshd %$%n2,%0")
  1570.  
  1571. (define_insn ""
  1572.   [(set (match_operand:SI 0 "general_operand" "=g")
  1573.     (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
  1574.              (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
  1575.   ""
  1576.   "lshd %2,%0")
  1577.  
  1578. (define_expand "lshrhi3"
  1579.   [(set (match_operand:HI 0 "general_operand" "=g")
  1580.     (lshiftrt:HI (match_operand:HI 1 "general_operand" "g")
  1581.              (match_operand:SI 2 "general_operand" "g")))]
  1582.   ""
  1583.   "
  1584. {
  1585.   if (GET_CODE (operands[2]) != CONST_INT)
  1586.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1587. }")
  1588.  
  1589. (define_insn ""
  1590.   [(set (match_operand:HI 0 "general_operand" "=g")
  1591.     (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
  1592.              (match_operand:SI 2 "immediate_operand" "i")))]
  1593.   ""
  1594.   "lshw %$%n2,%0")
  1595.  
  1596. (define_insn ""
  1597.   [(set (match_operand:HI 0 "general_operand" "=g")
  1598.     (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
  1599.              (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
  1600.   ""
  1601.   "lshw %2,%0")
  1602.  
  1603. (define_expand "lshrqi3"
  1604.   [(set (match_operand:QI 0 "general_operand" "=g")
  1605.     (lshiftrt:QI (match_operand:QI 1 "general_operand" "g")
  1606.              (match_operand:SI 2 "general_operand" "g")))]
  1607.   ""
  1608.   "
  1609. {
  1610.   if (GET_CODE (operands[2]) != CONST_INT)
  1611.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1612. }")
  1613.  
  1614. (define_insn ""
  1615.   [(set (match_operand:QI 0 "general_operand" "=g")
  1616.     (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
  1617.              (match_operand:SI 2 "immediate_operand" "i")))]
  1618.   ""
  1619.   "lshb %$%n2,%0")
  1620.  
  1621. (define_insn ""
  1622.   [(set (match_operand:QI 0 "general_operand" "=g")
  1623.     (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
  1624.              (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
  1625.   ""
  1626.   "lshb %2,%0")
  1627.  
  1628. ;; Rotate instructions
  1629.  
  1630. (define_insn "rotlsi3"
  1631.   [(set (match_operand:SI 0 "general_operand" "=g")
  1632.     (rotate:SI (match_operand:SI 1 "general_operand" "0")
  1633.            (match_operand:SI 2 "general_operand" "rmn")))]
  1634.   ""
  1635.   "rotd %2,%0")
  1636.  
  1637. (define_insn "rotlhi3"
  1638.   [(set (match_operand:HI 0 "general_operand" "=g")
  1639.     (rotate:HI (match_operand:HI 1 "general_operand" "0")
  1640.            (match_operand:SI 2 "general_operand" "rmn")))]
  1641.   ""
  1642.   "rotw %2,%0")
  1643.  
  1644. (define_insn "rotlqi3"
  1645.   [(set (match_operand:QI 0 "general_operand" "=g")
  1646.     (rotate:QI (match_operand:QI 1 "general_operand" "0")
  1647.            (match_operand:SI 2 "general_operand" "rmn")))]
  1648.   ""
  1649.   "rotb %2,%0")
  1650.  
  1651. ;; Right rotate on the 32k works by negating the shift count.
  1652. (define_expand "rotrsi3"
  1653.   [(set (match_operand:SI 0 "general_operand" "=g")
  1654.     (rotatert:SI (match_operand:SI 1 "general_operand" "g")
  1655.              (match_operand:SI 2 "general_operand" "g")))]
  1656.   ""
  1657.   "
  1658. {
  1659.   if (GET_CODE (operands[2]) != CONST_INT)
  1660.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1661. }")
  1662.  
  1663. (define_insn ""
  1664.   [(set (match_operand:SI 0 "general_operand" "=g")
  1665.     (rotatert:SI (match_operand:SI 1 "general_operand" "0")
  1666.              (match_operand:SI 2 "immediate_operand" "i")))]
  1667.   ""
  1668.   "rotd %$%n2,%0")
  1669.  
  1670. (define_insn ""
  1671.   [(set (match_operand:SI 0 "general_operand" "=g")
  1672.     (rotatert:SI (match_operand:SI 1 "general_operand" "0")
  1673.              (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
  1674.   ""
  1675.   "rotd %2,%0")
  1676.  
  1677. (define_expand "rotrhi3"
  1678.   [(set (match_operand:HI 0 "general_operand" "=g")
  1679.     (rotatert:HI (match_operand:HI 1 "general_operand" "g")
  1680.              (match_operand:SI 2 "general_operand" "g")))]
  1681.   ""
  1682.   "
  1683. {
  1684.   if (GET_CODE (operands[2]) != CONST_INT)
  1685.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1686. }")
  1687.  
  1688. (define_insn ""
  1689.   [(set (match_operand:HI 0 "general_operand" "=g")
  1690.     (rotatert:HI (match_operand:HI 1 "general_operand" "0")
  1691.              (match_operand:SI 2 "immediate_operand" "i")))]
  1692.   ""
  1693.   "rotw %$%n2,%0")
  1694.  
  1695. (define_insn ""
  1696.   [(set (match_operand:HI 0 "general_operand" "=g")
  1697.     (rotatert:HI (match_operand:HI 1 "general_operand" "0")
  1698.              (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
  1699.   ""
  1700.   "rotw %2,%0")
  1701.  
  1702. (define_expand "rotrqi3"
  1703.   [(set (match_operand:QI 0 "general_operand" "=g")
  1704.     (rotatert:QI (match_operand:QI 1 "general_operand" "g")
  1705.              (match_operand:SI 2 "general_operand" "g")))]
  1706.   ""
  1707.   "
  1708. {
  1709.   if (GET_CODE (operands[2]) != CONST_INT)
  1710.     operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
  1711. }")
  1712.  
  1713. (define_insn ""
  1714.   [(set (match_operand:QI 0 "general_operand" "=g")
  1715.     (rotatert:QI (match_operand:QI 1 "general_operand" "0")
  1716.              (match_operand:SI 2 "immediate_operand" "i")))]
  1717.   ""
  1718.   "rotb %$%n2,%0")
  1719.  
  1720. (define_insn ""
  1721.   [(set (match_operand:QI 0 "general_operand" "=g")
  1722.     (rotatert:QI (match_operand:QI 1 "general_operand" "0")
  1723.              (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
  1724.   ""
  1725.   "rotb %2,%0")
  1726.  
  1727. ;;- load or push effective address 
  1728. ;; These come after the move, add, and multiply patterns
  1729. ;; because we don't want pushl $1 turned into pushad 1.
  1730.  
  1731. (define_insn ""
  1732.   [(set (match_operand:SI 0 "general_operand" "=g<")
  1733.     (match_operand:QI 1 "address_operand" "p"))]
  1734.   ""
  1735.   "*
  1736. {
  1737.   if (REG_P (operands[0])
  1738.       && GET_CODE (operands[1]) == MULT
  1739.       && GET_CODE (XEXP (operands[1], 1)) == CONST_INT
  1740.       && (INTVAL (XEXP (operands[1], 1)) == 2
  1741.       || INTVAL (XEXP (operands[1], 1)) == 4))
  1742.     {
  1743.       rtx xoperands[3];
  1744.       xoperands[0] = operands[0];
  1745.       xoperands[1] = XEXP (operands[1], 0);
  1746.       xoperands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (XEXP (operands[1], 1)) >> 1);
  1747.       return output_shift_insn (xoperands);
  1748.     }
  1749.   return \"addr %a1,%0\";
  1750. }")
  1751.  
  1752. ;;; Index insns.  These are about the same speed as multiply-add counterparts.
  1753. ;;; but slower then using power-of-2 shifts if we can use them
  1754. ;
  1755. ;(define_insn ""
  1756. ;  [(set (match_operand:SI 0 "register_operand" "=r")
  1757. ;    (plus:SI (match_operand:SI 1 "general_operand" "rmn")
  1758. ;         (mult:SI (match_operand:SI 2 "register_operand" "0")
  1759. ;              (plus:SI (match_operand:SI 3 "general_operand" "rmn") (const_int 1)))))]
  1760. ;  "GET_CODE (operands[3]) != CONST_INT || INTVAL (operands[3]) > 8"
  1761. ;  "indexd %0,%3,%1")
  1762. ;
  1763. ;(define_insn ""
  1764. ;  [(set (match_operand:SI 0 "register_operand" "=r")
  1765. ;    (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "0")
  1766. ;              (plus:SI (match_operand:SI 2 "general_operand" "rmn") (const_int 1)))
  1767. ;         (match_operand:SI 3 "general_operand" "rmn")))]
  1768. ;  "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 8"
  1769. ;  "indexd %0,%2,%3")
  1770.  
  1771. ;; Set, Clear, and Invert bit
  1772.  
  1773. (define_insn ""
  1774.   [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "+g")
  1775.              (const_int 1)
  1776.              (match_operand:SI 1 "general_operand" "rmn"))
  1777.     (const_int 1))]
  1778.   ""
  1779.   "sbitd %1,%0")
  1780.  
  1781. (define_insn ""
  1782.   [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "+g")
  1783.              (const_int 1)
  1784.              (match_operand:SI 1 "general_operand" "rmn"))
  1785.     (const_int 0))]
  1786.   ""
  1787.   "cbitd %1,%0")
  1788.  
  1789. (define_insn ""
  1790.   [(set (match_operand:SI 0 "general_operand" "+g")
  1791.     (xor:SI (ashift:SI (const_int 1)
  1792.                (match_operand:SI 1 "general_operand" "rmn"))
  1793.         (match_dup 0)))]
  1794.   ""
  1795.   "ibitd %1,%0")
  1796.  
  1797. (define_insn ""
  1798.   [(set (match_operand:QI 0 "general_operand" "=g")
  1799.     (xor:QI (subreg:QI
  1800.          (ashift:SI (const_int 1)
  1801.                 (match_operand:QI 1 "general_operand" "rmn")) 0)
  1802.         (match_dup 0)))]
  1803.   ""
  1804.   "ibitb %1,%0")
  1805.  
  1806. ;; Recognize jbs and jbc instructions.
  1807.  
  1808. (define_insn ""
  1809.   [(set (cc0)
  1810.     (zero_extract (match_operand:SI 0 "general_operand" "rm")
  1811.               (const_int 1)
  1812.               (match_operand:SI 1 "general_operand" "g")))]
  1813.   ""
  1814.   "*
  1815. { cc_status.flags = CC_Z_IN_F;
  1816.   return \"tbitd %1,%0\";
  1817. }")
  1818.  
  1819. ;; extract(base, width, offset)
  1820. ;; Signed bitfield extraction is not supported in hardware on the
  1821. ;; NS 32032.  It is therefore better to let GCC figure out a
  1822. ;; good strategy for generating the proper instruction sequence
  1823. ;; and represent it as rtl.
  1824.  
  1825. ;; Optimize the case of extracting a byte or word from a register.
  1826. ;; Otherwise we must load a register with the offset of the
  1827. ;; chunk we want, and perform an extract insn (each of which
  1828. ;; is very expensive).  Since we use the stack to do our bit-twiddling
  1829. ;; we cannot use it for a destination.  Perhaps things are fast
  1830. ;; enough on the 32532 that such hacks are not needed.
  1831.  
  1832. (define_insn ""
  1833.   [(set (match_operand:SI 0 "general_operand" "=ro")
  1834.     (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
  1835.              (match_operand:SI 2 "const_int_operand" "i")
  1836.              (match_operand:SI 3 "const_int_operand" "i")))]
  1837.   "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
  1838.    && (INTVAL (operands[3]) == 8 || INTVAL (operands[3]) == 16 || INTVAL (operands[3]) == 24)"
  1839.   "*
  1840. {
  1841.   output_asm_insn (\"movd %1,tos\", operands);
  1842.   if (INTVAL (operands[2]) == 16)
  1843.     {
  1844.       if (INTVAL (operands[3]) == 8)
  1845.     output_asm_insn (\"movzwd 1(sp),%0\", operands);
  1846.       else
  1847.     output_asm_insn (\"movzwd 2(sp),%0\", operands);
  1848.     }
  1849.   else
  1850.     {
  1851.       if (INTVAL (operands[3]) == 8)
  1852.     output_asm_insn (\"movzbd 1(sp),%0\", operands);
  1853.       else if (INTVAL (operands[3]) == 16)
  1854.     output_asm_insn (\"movzbd 2(sp),%0\", operands);
  1855.       else
  1856.     output_asm_insn (\"movzbd 3(sp),%0\", operands);
  1857.     }
  1858.   if (TARGET_32532 || TARGET_32332)
  1859.     return \"cmpqd %$0,tos\";
  1860.   else
  1861.     return \"adjspb %$-4\";
  1862. }")
  1863.  
  1864. ;; The extsd/extd isntructions have the problem that they always access
  1865. ;; 32 bits even if the bitfield is smaller. For example the instruction
  1866. ;;     extsd 7(r1),r0,2,5
  1867. ;; would read not only at address 7(r1) but also at 8(r1) to 10(r1).
  1868. ;; If these addresses are in a different (unmapped) page a memory fault
  1869. ;; is the result.
  1870. ;;
  1871. ;; Timing considerations:
  1872. ;;    movd    0(r1),r0    3 bytes
  1873. ;;    lshd    -26,r0        4
  1874. ;;    andd    0x1f,r0        5
  1875. ;; takes about 13 cycles on the 532 while
  1876. ;;    extsd    7(r1),r0,2,5    5 bytes
  1877. ;; takes about 21 cycles.
  1878. ;;
  1879. ;; So lets forget about extsd/extd on the 532.
  1880.  
  1881. (define_insn ""
  1882.   [(set (match_operand:SI 0 "general_operand" "=g<")
  1883.     (zero_extract:SI (match_operand:SI 1 "register_operand" "g")
  1884.              (match_operand:SI 2 "const_int_operand" "i")
  1885.              (match_operand:SI 3 "general_operand" "rK")))]
  1886.   "! TARGET_32532"
  1887.   "*
  1888. { if (GET_CODE (operands[3]) == CONST_INT)
  1889.     return \"extsd %1,%0,%3,%2\";
  1890.   else return \"extd %3,%1,%0,%2\";
  1891. }")
  1892.  
  1893. (define_insn "extzv"
  1894.   [(set (match_operand:SI 0 "general_operand" "=g<")
  1895.     (zero_extract:SI (match_operand:QI 1 "general_operand" "g")
  1896.              (match_operand:SI 2 "const_int_operand" "i")
  1897.              (match_operand:SI 3 "general_operand" "rK")))]
  1898.   "! TARGET_32532"
  1899.   "*
  1900. { if (GET_CODE (operands[3]) == CONST_INT)
  1901.     return \"extsd %1,%0,%3,%2\";
  1902.   else return \"extd %3,%1,%0,%2\";
  1903. }")
  1904.  
  1905. (define_insn ""
  1906.   [(set (zero_extract:SI (match_operand:SI 0 "memory_operand" "+o")
  1907.              (match_operand:SI 1 "const_int_operand" "i")
  1908.              (match_operand:SI 2 "general_operand" "rn"))
  1909.     (match_operand:SI 3 "general_operand" "rm"))]
  1910.   ""
  1911.   "*
  1912. { if (GET_CODE (operands[2]) == CONST_INT)
  1913.     {
  1914.       if (INTVAL (operands[2]) >= 8)
  1915.     {
  1916.       operands[0] = adj_offsettable_operand (operands[0],
  1917.                             INTVAL (operands[2]) / 8);
  1918.           operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) % 8);
  1919.     }
  1920.       if (INTVAL (operands[1]) <= 8)
  1921.         return \"inssb %3,%0,%2,%1\";
  1922.       else if (INTVAL (operands[1]) <= 16)
  1923.     return \"inssw %3,%0,%2,%1\";
  1924.       else
  1925.     return \"inssd %3,%0,%2,%1\";
  1926.     }
  1927.   return \"insd %2,%3,%0,%1\";
  1928. }")
  1929.  
  1930. (define_insn ""
  1931.   [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
  1932.              (match_operand:SI 1 "const_int_operand" "i")
  1933.              (match_operand:SI 2 "general_operand" "rK"))
  1934.     (match_operand:SI 3 "general_operand" "rm"))]
  1935.   ""
  1936.   "*
  1937. { if (GET_CODE (operands[2]) == CONST_INT)
  1938.     if (INTVAL (operands[1]) <= 8)
  1939.       return \"inssb %3,%0,%2,%1\";
  1940.     else if (INTVAL (operands[1]) <= 16)
  1941.       return \"inssw %3,%0,%2,%1\";
  1942.     else
  1943.       return \"inssd %3,%0,%2,%1\";
  1944.   return \"insd %2,%3,%0,%1\";
  1945. }")
  1946.  
  1947. (define_insn "insv"
  1948.   [(set (zero_extract:SI (match_operand:QI 0 "general_operand" "+g")
  1949.              (match_operand:SI 1 "const_int_operand" "i")
  1950.              (match_operand:SI 2 "general_operand" "rK"))
  1951.     (match_operand:SI 3 "general_operand" "rm"))]
  1952.   ""
  1953.   "*
  1954. { if (GET_CODE (operands[2]) == CONST_INT)
  1955.     if (INTVAL (operands[1]) <= 8)
  1956.       return \"inssb %3,%0,%2,%1\";
  1957.     else if (INTVAL (operands[1]) <= 16)
  1958.       return \"inssw %3,%0,%2,%1\";
  1959.     else
  1960.       return \"inssd %3,%0,%2,%1\";
  1961.   return \"insd %2,%3,%0,%1\";
  1962. }")
  1963.  
  1964.  
  1965. (define_insn "jump"
  1966.   [(set (pc)
  1967.     (label_ref (match_operand 0 "" "")))]
  1968.   ""
  1969.   "br %l0")
  1970.  
  1971. (define_insn "beq"
  1972.   [(set (pc)
  1973.     (if_then_else (eq (cc0)
  1974.               (const_int 0))
  1975.               (label_ref (match_operand 0 "" ""))
  1976.               (pc)))]
  1977.   ""
  1978.   "*
  1979. { if (cc_prev_status.flags & CC_Z_IN_F)
  1980.     return \"bfc %l0\";
  1981.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  1982.     return \"bfs %l0\";
  1983.   else return \"beq %l0\";
  1984. }")
  1985.  
  1986. (define_insn "bne"
  1987.   [(set (pc)
  1988.     (if_then_else (ne (cc0)
  1989.               (const_int 0))
  1990.               (label_ref (match_operand 0 "" ""))
  1991.               (pc)))]
  1992.   ""
  1993.   "*
  1994. { if (cc_prev_status.flags & CC_Z_IN_F)
  1995.     return \"bfs %l0\";
  1996.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  1997.     return \"bfc %l0\";
  1998.   else return \"bne %l0\";
  1999. }")
  2000.  
  2001. (define_insn "bgt"
  2002.   [(set (pc)
  2003.     (if_then_else (gt (cc0)
  2004.               (const_int 0))
  2005.               (label_ref (match_operand 0 "" ""))
  2006.               (pc)))]
  2007.   ""
  2008.   "bgt %l0")
  2009.  
  2010. (define_insn "bgtu"
  2011.   [(set (pc)
  2012.     (if_then_else (gtu (cc0)
  2013.                (const_int 0))
  2014.               (label_ref (match_operand 0 "" ""))
  2015.               (pc)))]
  2016.   ""
  2017.   "bhi %l0")
  2018.  
  2019. (define_insn "blt"
  2020.   [(set (pc)
  2021.     (if_then_else (lt (cc0)
  2022.               (const_int 0))
  2023.               (label_ref (match_operand 0 "" ""))
  2024.               (pc)))]
  2025.   ""
  2026.   "blt %l0")
  2027.  
  2028. (define_insn "bltu"
  2029.   [(set (pc)
  2030.     (if_then_else (ltu (cc0)
  2031.                (const_int 0))
  2032.               (label_ref (match_operand 0 "" ""))
  2033.               (pc)))]
  2034.   ""
  2035.   "blo %l0")
  2036.  
  2037. (define_insn "bge"
  2038.   [(set (pc)
  2039.     (if_then_else (ge (cc0)
  2040.               (const_int 0))
  2041.               (label_ref (match_operand 0 "" ""))
  2042.               (pc)))]
  2043.   ""
  2044.   "bge %l0")
  2045.  
  2046. (define_insn "bgeu"
  2047.   [(set (pc)
  2048.     (if_then_else (geu (cc0)
  2049.                (const_int 0))
  2050.               (label_ref (match_operand 0 "" ""))
  2051.               (pc)))]
  2052.   ""
  2053.   "bhs %l0")
  2054.  
  2055. (define_insn "ble"
  2056.   [(set (pc)
  2057.     (if_then_else (le (cc0)
  2058.               (const_int 0))
  2059.               (label_ref (match_operand 0 "" ""))
  2060.               (pc)))]
  2061.   ""
  2062.   "ble %l0")
  2063.  
  2064. (define_insn "bleu"
  2065.   [(set (pc)
  2066.     (if_then_else (leu (cc0)
  2067.                (const_int 0))
  2068.               (label_ref (match_operand 0 "" ""))
  2069.               (pc)))]
  2070.   ""
  2071.   "bls %l0")
  2072.  
  2073. (define_insn ""
  2074.   [(set (pc)
  2075.     (if_then_else (eq (cc0)
  2076.               (const_int 0))
  2077.               (pc)
  2078.               (label_ref (match_operand 0 "" ""))))]
  2079.   ""
  2080.   "*
  2081. { if (cc_prev_status.flags & CC_Z_IN_F)
  2082.     return \"bfs %l0\";
  2083.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  2084.     return \"bfc %l0\";
  2085.   else return \"bne %l0\";
  2086. }")
  2087.  
  2088. (define_insn ""
  2089.   [(set (pc)
  2090.     (if_then_else (ne (cc0)
  2091.               (const_int 0))
  2092.               (pc)
  2093.               (label_ref (match_operand 0 "" ""))))]
  2094.   ""
  2095.   "*
  2096. { if (cc_prev_status.flags & CC_Z_IN_F)
  2097.     return \"bfc %l0\";
  2098.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  2099.     return \"bfs %l0\";
  2100.   else return \"beq %l0\";
  2101. }")
  2102.  
  2103. (define_insn ""
  2104.   [(set (pc)
  2105.     (if_then_else (gt (cc0)
  2106.               (const_int 0))
  2107.               (pc)
  2108.               (label_ref (match_operand 0 "" ""))))]
  2109.   ""
  2110.   "ble %l0")
  2111.  
  2112. (define_insn ""
  2113.   [(set (pc)
  2114.     (if_then_else (gtu (cc0)
  2115.                (const_int 0))
  2116.               (pc)
  2117.               (label_ref (match_operand 0 "" ""))))]
  2118.   ""
  2119.   "bls %l0")
  2120.  
  2121. (define_insn ""
  2122.   [(set (pc)
  2123.     (if_then_else (lt (cc0)
  2124.               (const_int 0))
  2125.               (pc)
  2126.               (label_ref (match_operand 0 "" ""))))]
  2127.   ""
  2128.   "bge %l0")
  2129.  
  2130. (define_insn ""
  2131.   [(set (pc)
  2132.     (if_then_else (ltu (cc0)
  2133.                (const_int 0))
  2134.               (pc)
  2135.               (label_ref (match_operand 0 "" ""))))]
  2136.   ""
  2137.   "bhs %l0")
  2138.  
  2139. (define_insn ""
  2140.   [(set (pc)
  2141.     (if_then_else (ge (cc0)
  2142.               (const_int 0))
  2143.               (pc)
  2144.               (label_ref (match_operand 0 "" ""))))]
  2145.   ""
  2146.   "blt %l0")
  2147.  
  2148. (define_insn ""
  2149.   [(set (pc)
  2150.     (if_then_else (geu (cc0)
  2151.                (const_int 0))
  2152.               (pc)
  2153.               (label_ref (match_operand 0 "" ""))))]
  2154.   ""
  2155.   "blo %l0")
  2156.  
  2157. (define_insn ""
  2158.   [(set (pc)
  2159.     (if_then_else (le (cc0)
  2160.               (const_int 0))
  2161.               (pc)
  2162.               (label_ref (match_operand 0 "" ""))))]
  2163.   ""
  2164.   "bgt %l0")
  2165.  
  2166. (define_insn ""
  2167.   [(set (pc)
  2168.     (if_then_else (leu (cc0)
  2169.                (const_int 0))
  2170.               (pc)
  2171.               (label_ref (match_operand 0 "" ""))))]
  2172.   ""
  2173.   "bhi %l0")
  2174.  
  2175. ;; Subtract-and-jump and Add-and-jump insns.
  2176. ;; These can actually be used for adding numbers in the range -8 to 7
  2177.  
  2178. (define_insn ""
  2179.   [(set (pc)
  2180.     (if_then_else
  2181.      (ne (match_operand:SI 0 "general_operand" "+g")
  2182.          (match_operand:SI 1 "const_int_operand" "i"))
  2183.      (label_ref (match_operand 2 "" ""))
  2184.      (pc)))
  2185.   (set (match_dup 0)
  2186.        (minus:SI (match_dup 0)
  2187.          (match_dup 1)))]
  2188.   "INTVAL (operands[1]) > -8 && INTVAL (operands[1]) <= 8"
  2189.   "acbd %$%n1,%0,%l2")
  2190.  
  2191. (define_insn ""
  2192.   [(set (pc)
  2193.     (if_then_else
  2194.      (ne (match_operand:SI 0 "general_operand" "+g")
  2195.          (match_operand:SI 1 "const_int_operand" "i"))
  2196.      (label_ref (match_operand 2 "" ""))
  2197.      (pc)))
  2198.   (set (match_dup 0)
  2199.        (plus:SI (match_dup 0)
  2200.         (match_operand:SI 3 "const_int_operand" "i")))]
  2201.   "INTVAL (operands[1]) == - INTVAL (operands[3])
  2202.    && INTVAL (operands[3]) >= -8 && INTVAL (operands[3]) < 8"
  2203.   "acbd %3,%0,%l2")
  2204.  
  2205. (define_insn "call"
  2206.   [(call (match_operand:QI 0 "memory_operand" "m")
  2207.      (match_operand:QI 1 "general_operand" "g"))]
  2208.   ""
  2209.   "*
  2210. {
  2211. #ifndef JSR_ALWAYS
  2212.   if (GET_CODE (operands[0]) == MEM)
  2213.     {
  2214.       rtx temp = XEXP (operands[0], 0);
  2215.       if (CONSTANT_ADDRESS_P (temp))
  2216.     {
  2217. #ifdef ENCORE_ASM
  2218.       return \"bsr %?%0\";
  2219. #else
  2220. #ifdef CALL_MEMREF_IMPLICIT
  2221.       operands[0] = temp;
  2222.       return \"bsr %0\";
  2223. #else
  2224. #ifdef GNX_V3
  2225.       return \"bsr %0\";
  2226. #else
  2227.       return \"bsr %?%a0\";
  2228. #endif
  2229. #endif
  2230. #endif
  2231.     }
  2232.       if (GET_CODE (XEXP (operands[0], 0)) == REG)
  2233. #if defined (GNX_V3) || defined (CALL_MEMREF_IMPLICIT)
  2234.     return \"jsr %0\";
  2235. #else
  2236.         return \"jsr %a0\";
  2237. #endif
  2238.     }
  2239. #endif /* not JSR_ALWAYS */
  2240.   return \"jsr %0\";
  2241. }")
  2242.  
  2243. (define_insn "call_value"
  2244.   [(set (match_operand 0 "" "=rf")
  2245.     (call (match_operand:QI 1 "memory_operand" "m")
  2246.           (match_operand:QI 2 "general_operand" "g")))]
  2247.   ""
  2248.   "*
  2249. {
  2250. #ifndef JSR_ALWAYS
  2251.   if (GET_CODE (operands[1]) == MEM)
  2252.     {
  2253.       rtx temp = XEXP (operands[1], 0);
  2254.       if (CONSTANT_ADDRESS_P (temp))
  2255.     {
  2256. #ifdef ENCORE_ASM
  2257.       return \"bsr %?%1\";
  2258. #else
  2259. #ifdef CALL_MEMREF_IMPLICIT
  2260.       operands[1] = temp;
  2261.       return \"bsr %1\";
  2262. #else
  2263. #ifdef GNX_V3
  2264.       return \"bsr %1\";
  2265. #else
  2266.       return \"bsr %?%a1\";
  2267. #endif
  2268. #endif
  2269. #endif
  2270.     }
  2271.       if (GET_CODE (XEXP (operands[1], 0)) == REG)
  2272. #if defined (GNX_V3) || defined (CALL_MEMREF_IMPLICIT)
  2273.     return \"jsr %1\";
  2274. #else
  2275.         return \"jsr %a1\";
  2276. #endif
  2277.     }
  2278. #endif /* not JSR_ALWAYS */
  2279.   return \"jsr %1\";
  2280. }")
  2281.  
  2282. ;; Call subroutine returning any type.
  2283.  
  2284. (define_expand "untyped_call"
  2285.   [(parallel [(call (match_operand 0 "" "")
  2286.             (const_int 0))
  2287.           (match_operand 1 "" "")
  2288.           (match_operand 2 "" "")])]
  2289.   ""
  2290.   "
  2291. {
  2292.   int i;
  2293.  
  2294.   emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
  2295.  
  2296.   for (i = 0; i < XVECLEN (operands[2], 0); i++)
  2297.     {
  2298.       rtx set = XVECEXP (operands[2], 0, i);
  2299.       emit_move_insn (SET_DEST (set), SET_SRC (set));
  2300.     }
  2301.  
  2302.   /* The optimizer does not know that the call sets the function value
  2303.      registers we stored in the result block.  We avoid problems by
  2304.      claiming that all hard registers are used and clobbered at this
  2305.      point.  */
  2306.   emit_insn (gen_blockage ());
  2307.  
  2308.   DONE;
  2309. }")
  2310.  
  2311. ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
  2312. ;; all of memory.  This blocks insns from being moved across this point.
  2313.  
  2314. (define_insn "blockage"
  2315.   [(unspec_volatile [(const_int 0)] 0)]
  2316.   ""
  2317.   "")
  2318.  
  2319. (define_insn "return"
  2320.   [(return)]
  2321.   "0"
  2322.   "ret 0")
  2323.  
  2324. (define_insn "abssf2"
  2325.   [(set (match_operand:SF 0 "general_operand" "=fm<")
  2326.     (abs:SF (match_operand:SF 1 "general_operand" "fmF")))]
  2327.   "TARGET_32081"
  2328.   "absf %1,%0")
  2329.  
  2330. (define_insn "absdf2"
  2331.   [(set (match_operand:DF 0 "general_operand" "=fm<")
  2332.     (abs:DF (match_operand:DF 1 "general_operand" "fmF")))]
  2333.   "TARGET_32081"
  2334.   "absl %1,%0")
  2335.  
  2336. (define_insn "abssi2"
  2337.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2338.     (abs:SI (match_operand:SI 1 "general_operand" "rmn")))]
  2339.   ""
  2340.   "absd %1,%0")
  2341.  
  2342. (define_insn "abshi2"
  2343.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2344.     (abs:HI (match_operand:HI 1 "general_operand" "g")))]
  2345.   ""
  2346.   "absw %1,%0")
  2347.  
  2348. (define_insn "absqi2"
  2349.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2350.     (abs:QI (match_operand:QI 1 "general_operand" "g")))]
  2351.   ""
  2352.   "absb %1,%0")
  2353.  
  2354. (define_insn "nop"
  2355.   [(const_int 0)]
  2356.   ""
  2357.   "nop")
  2358.  
  2359. (define_insn "indirect_jump"
  2360.   [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
  2361.   ""
  2362.   "jump %0")
  2363.  
  2364. (define_insn "tablejump"
  2365.   [(set (pc)
  2366.     (plus:SI (pc) (match_operand:SI 0 "general_operand" "g")))
  2367.    (use (label_ref (match_operand 1 "" "")))]
  2368.   ""
  2369.   "*
  2370. {
  2371.   ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\",
  2372.                  CODE_LABEL_NUMBER (operands[1]));
  2373.   return \"cased %0\";
  2374. }")
  2375.  
  2376. ;; Scondi instructions
  2377. (define_insn "seq"
  2378.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2379.     (eq:SI (cc0) (const_int 0)))]
  2380.   ""
  2381.   "*
  2382. { if (cc_prev_status.flags & CC_Z_IN_F)
  2383.     return \"sfcd %0\";
  2384.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  2385.     return \"sfsd %0\";
  2386.   else return \"seqd %0\";
  2387. }")
  2388.  
  2389. (define_insn ""
  2390.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2391.     (eq:HI (cc0) (const_int 0)))]
  2392.   ""
  2393.   "*
  2394. { if (cc_prev_status.flags & CC_Z_IN_F)
  2395.     return \"sfcw %0\";
  2396.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  2397.     return \"sfsw %0\";
  2398.   else return \"seqw %0\";
  2399. }")
  2400.  
  2401. (define_insn ""
  2402.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2403.     (eq:QI (cc0) (const_int 0)))]
  2404.   ""
  2405.   "*
  2406. { if (cc_prev_status.flags & CC_Z_IN_F)
  2407.     return \"sfcb %0\";
  2408.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  2409.     return \"sfsb %0\";
  2410.   else return \"seqb %0\";
  2411. }")
  2412.  
  2413. (define_insn "sne"
  2414.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2415.     (ne:SI (cc0) (const_int 0)))]
  2416.   ""
  2417.   "*
  2418. { if (cc_prev_status.flags & CC_Z_IN_F)
  2419.     return \"sfsd %0\";
  2420.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  2421.     return \"sfcd %0\";
  2422.   else return \"sned %0\";
  2423. }")
  2424.  
  2425. (define_insn ""
  2426.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2427.     (ne:HI (cc0) (const_int 0)))]
  2428.   ""
  2429.   "*
  2430. { if (cc_prev_status.flags & CC_Z_IN_F)
  2431.     return \"sfsw %0\";
  2432.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  2433.     return \"sfcw %0\";
  2434.   else return \"snew %0\";
  2435. }")
  2436.  
  2437. (define_insn ""
  2438.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2439.     (ne:QI (cc0) (const_int 0)))]
  2440.   ""
  2441.   "*
  2442. { if (cc_prev_status.flags & CC_Z_IN_F)
  2443.     return \"sfsb %0\";
  2444.   else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
  2445.     return \"sfcb %0\";
  2446.   else return \"sneb %0\";
  2447. }")
  2448.  
  2449. (define_insn "sgt"
  2450.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2451.     (gt:SI (cc0) (const_int 0)))]
  2452.   ""
  2453.   "sgtd %0")
  2454.  
  2455. (define_insn ""
  2456.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2457.     (gt:HI (cc0) (const_int 0)))]
  2458.   ""
  2459.   "sgtw %0")
  2460.  
  2461. (define_insn ""
  2462.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2463.     (gt:QI (cc0) (const_int 0)))]
  2464.   ""
  2465.   "sgtb %0")
  2466.  
  2467. (define_insn "sgtu"
  2468.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2469.     (gtu:SI (cc0) (const_int 0)))]
  2470.   ""
  2471.   "shid %0")
  2472.  
  2473. (define_insn ""
  2474.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2475.     (gtu:HI (cc0) (const_int 0)))]
  2476.   ""
  2477.   "shiw %0")
  2478.  
  2479. (define_insn ""
  2480.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2481.     (gtu:QI (cc0) (const_int 0)))]
  2482.   ""
  2483.   "shib %0")
  2484.  
  2485. (define_insn "slt"
  2486.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2487.     (lt:SI (cc0) (const_int 0)))]
  2488.   ""
  2489.   "sltd %0")
  2490.  
  2491. (define_insn ""
  2492.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2493.     (lt:HI (cc0) (const_int 0)))]
  2494.   ""
  2495.   "sltw %0")
  2496.  
  2497. (define_insn ""
  2498.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2499.     (lt:QI (cc0) (const_int 0)))]
  2500.   ""
  2501.   "sltb %0")
  2502.  
  2503. (define_insn "sltu"
  2504.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2505.     (ltu:SI (cc0) (const_int 0)))]
  2506.   ""
  2507.   "slod %0")
  2508.  
  2509. (define_insn ""
  2510.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2511.     (ltu:HI (cc0) (const_int 0)))]
  2512.   ""
  2513.   "slow %0")
  2514.  
  2515. (define_insn ""
  2516.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2517.     (ltu:QI (cc0) (const_int 0)))]
  2518.   ""
  2519.   "slob %0")
  2520.  
  2521. (define_insn "sge"
  2522.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2523.     (ge:SI (cc0) (const_int 0)))]
  2524.   ""
  2525.   "sged %0")
  2526.  
  2527. (define_insn ""
  2528.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2529.     (ge:HI (cc0) (const_int 0)))]
  2530.   ""
  2531.   "sgew %0")
  2532.  
  2533. (define_insn ""
  2534.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2535.     (ge:QI (cc0) (const_int 0)))]
  2536.   ""
  2537.   "sgeb %0")
  2538.  
  2539. (define_insn "sgeu"
  2540.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2541.     (geu:SI (cc0) (const_int 0)))]
  2542.   ""
  2543.   "shsd %0")  
  2544.  
  2545. (define_insn ""
  2546.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2547.     (geu:HI (cc0) (const_int 0)))]
  2548.   ""
  2549.   "shsw %0")  
  2550.  
  2551. (define_insn ""
  2552.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2553.     (geu:QI (cc0) (const_int 0)))]
  2554.   ""
  2555.   "shsb %0")  
  2556.  
  2557. (define_insn "sle"
  2558.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2559.     (le:SI (cc0) (const_int 0)))]
  2560.   ""
  2561.   "sled %0")
  2562.  
  2563. (define_insn ""
  2564.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2565.     (le:HI (cc0) (const_int 0)))]
  2566.   ""
  2567.   "slew %0")
  2568.  
  2569. (define_insn ""
  2570.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2571.     (le:QI (cc0) (const_int 0)))]
  2572.   ""
  2573.   "sleb %0")
  2574.  
  2575. (define_insn "sleu"
  2576.   [(set (match_operand:SI 0 "general_operand" "=g<")
  2577.     (leu:SI (cc0) (const_int 0)))]
  2578.   ""
  2579.   "slsd %0")
  2580.  
  2581. (define_insn ""
  2582.   [(set (match_operand:HI 0 "general_operand" "=g<")
  2583.     (leu:HI (cc0) (const_int 0)))]
  2584.   ""
  2585.   "slsw %0")
  2586.  
  2587. (define_insn ""
  2588.   [(set (match_operand:QI 0 "general_operand" "=g<")
  2589.     (leu:QI (cc0) (const_int 0)))]
  2590.   ""
  2591.   "slsb %0")
  2592.  
  2593. ;; ffs instructions
  2594.  
  2595. (define_insn "ffsqi2"
  2596.   [(set (match_operand:QI 0 "general_operand" "=g")
  2597.     (ffs:QI (match_operand:SI 1 "general_operand" "g")))]
  2598.   ""
  2599.   "*
  2600. {
  2601.   return \"movqb 0,%0; ffsd %1,%0; bfs 1f; addqb 1,%0; 1:\";
  2602. }")
  2603.  
  2604. (define_insn "ffshi2"
  2605.   [(set (match_operand:HI 0 "general_operand" "=g")
  2606.     (ffs:HI (match_operand:SI 1 "general_operand" "g")))]
  2607.   ""
  2608.   "*
  2609. {
  2610.   return \"movqw 0,%0; ffsd %1,%0; bfs 1f; addqw 1,%0; 1:\";
  2611. }")
  2612.  
  2613. (define_insn "ffssi2"
  2614.   [(set (match_operand:SI 0 "general_operand" "=g")
  2615.     (ffs:SI (match_operand:SI 1 "general_operand" "g")))]
  2616.   ""
  2617.   "*
  2618. {
  2619.   return \"movqd 0,%0; ffsd %1,%0; bfs 1f; addqd 1,%0; 1:\";
  2620. }")
  2621.  
  2622. ;; Speed up stack adjust followed by a HI fixedpoint push.
  2623.  
  2624. (define_peephole
  2625.   [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int -2)))
  2626.    (set (match_operand:HI 0 "push_operand" "=m")
  2627.     (match_operand:HI 1 "general_operand" "g"))]
  2628.   "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
  2629.   "*
  2630. {
  2631.   if (GET_CODE (operands[1]) == CONST_INT)
  2632.     output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,tos\"),
  2633.              operands);
  2634.   else
  2635.     output_asm_insn (\"movzwd %1,tos\", operands);
  2636.   return \"\";
  2637. }")
  2638.  
  2639. ;; Speed up stack adjust followed by a zero_extend:HI(QI) fixedpoint push.
  2640.  
  2641. (define_peephole
  2642.   [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int -2)))
  2643.    (set (match_operand:HI 0 "push_operand" "=m")
  2644.     (zero_extend:HI (match_operand:QI 1 "general_operand" "g")))]
  2645.   "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
  2646.   "*
  2647. {
  2648.   if (GET_CODE (operands[1]) == CONST_INT)
  2649.     output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,tos\"),
  2650.              operands);
  2651.   else
  2652.     output_asm_insn (\"movzbd %1,tos\", operands);
  2653.   return \"\";
  2654. }")
  2655.  
  2656. ;; Speed up stack adjust followed by a sign_extend:HI(QI) fixedpoint push.
  2657.  
  2658. (define_peephole
  2659.   [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int -2)))
  2660.    (set (match_operand:HI 0 "push_operand" "=m")
  2661.     (sign_extend:HI (match_operand:QI 1 "general_operand" "g")))]
  2662.   "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
  2663.   "*
  2664. {
  2665.   if (GET_CODE (operands[1]) == CONST_INT)
  2666.     output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,tos\"),
  2667.              operands);
  2668.   else
  2669.     output_asm_insn (\"movxbd %1,tos\", operands);
  2670.   return \"\";
  2671. }")
  2672.  
  2673. ;; Speed up stack adjust followed by a QI fixedpoint push.
  2674.  
  2675. (define_peephole
  2676.   [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int -3)))
  2677.    (set (match_operand:QI 0 "push_operand" "=m")
  2678.     (match_operand:QI 1 "general_operand" "g"))]
  2679.   "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
  2680.   "*
  2681. {
  2682.   if (GET_CODE (operands[1]) == CONST_INT)
  2683.     output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,tos\"),
  2684.              operands);
  2685.   else
  2686.     output_asm_insn (\"movzbd %1,tos\", operands);
  2687.   return \"\";
  2688. }")
  2689.  
  2690. ;; Speed up stack adjust followed by a SI fixedpoint push.
  2691.  
  2692. (define_peephole
  2693.   [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int 4)))
  2694.    (set (match_operand:SI 0 "push_operand" "=m")
  2695.     (match_operand:SI 1 "general_operand" "g"))]
  2696.   "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
  2697.   "*
  2698. {
  2699.   if (GET_CODE (operands[1]) == CONST_INT)
  2700.     output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,0(sp)\"),
  2701.              operands);
  2702.   else
  2703.     output_asm_insn (\"movd %1,0(sp)\", operands);
  2704.   return \"\";
  2705. }")
  2706.  
  2707. ;; Speed up stack adjust followed by two fullword fixedpoint pushes.
  2708.  
  2709. (define_peephole
  2710.   [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int 8)))
  2711.    (set (match_operand:SI 0 "push_operand" "=m")
  2712.     (match_operand:SI 1 "general_operand" "g"))
  2713.    (set (match_operand:SI 2 "push_operand" "=m")
  2714.     (match_operand:SI 3 "general_operand" "g"))]
  2715.   "! reg_mentioned_p (stack_pointer_rtx, operands[1])
  2716.    && ! reg_mentioned_p (stack_pointer_rtx, operands[3])"
  2717.   "*
  2718. {
  2719.   if (GET_CODE (operands[1]) == CONST_INT)
  2720.     output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,4(sp)\"),
  2721.              operands);
  2722.   else
  2723.     output_asm_insn (\"movd %1,4(sp)\", operands);
  2724.  
  2725.   if (GET_CODE (operands[3]) == CONST_INT)
  2726.     output_asm_insn (output_move_dconst (INTVAL (operands[3]), \"%$%3,0(sp)\"),
  2727.              operands);
  2728.   else
  2729.     output_asm_insn (\"movd %3,0(sp)\", operands);
  2730.   return \"\";
  2731. }")
  2732.