home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / GCC 1.37.1r14 / usr / gcc-1.37.1r14 / (gcc-1.37.π) / optabs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-19  |  72.0 KB  |  2,563 lines  |  [TEXT/KAHL]

  1. /* Expand the basic unary and binary arithmetic operations, for GNU compiler.
  2.    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  3.    Copyright (C) 1989, 1990 Apple Computer, Inc.
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 1, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21.  
  22. #include "config.h"
  23. #include "rtl.h"
  24. #include "tree.h"
  25. #include "flags.h"
  26. #include "insn-flags.h"
  27. #include "insn-codes.h"
  28. #include "expr.h"
  29. #include "insn-config.h"
  30. #include "recog.h"
  31.  
  32. /* In ANSI C we could write MODE + 1, but traditional C compilers
  33.    seem to reject it.  */
  34. #define INC_MODE(MODE) (enum machine_mode) ((int)(MODE) + 1)
  35.  
  36. /* Each optab contains info on how this target machine
  37.    can perform a particular operation
  38.    for all sizes and kinds of operands.
  39.  
  40.    The operation to be performed is often specified
  41.    by passing one of these optabs as an argument.
  42.  
  43.    See expr.h for documentation of these optabs.  */
  44.  
  45. optab add_optab;
  46. optab sub_optab;
  47. optab smul_optab;
  48. optab umul_optab;
  49. optab smul_widen_optab;
  50. optab umul_widen_optab;
  51. optab sdiv_optab;
  52. optab sdivmod_optab;
  53. optab udiv_optab;
  54. optab udivmod_optab;
  55. optab smod_optab;
  56. optab umod_optab;
  57. optab flodiv_optab;
  58. optab ftrunc_optab;
  59. optab and_optab;
  60. optab andcb_optab;
  61. optab ior_optab;
  62. optab xor_optab;
  63. optab ashl_optab;
  64. optab lshr_optab;
  65. optab lshl_optab;
  66. optab ashr_optab;
  67. optab rotl_optab;
  68. optab rotr_optab;
  69.  
  70. optab mov_optab;
  71. optab movstrict_optab;
  72.  
  73. optab neg_optab;
  74. optab abs_optab;
  75. optab one_cmpl_optab;
  76. optab ffs_optab;
  77. #ifdef APPLE_C
  78. /* Add (possibly unused) optables for assorted elementary functions. */
  79. optab sin_optab;
  80. optab cos_optab;
  81. optab tan_optab;
  82. optab asin_optab;
  83. optab acos_optab;
  84. optab atan_optab;
  85. optab sinh_optab;
  86. optab cosh_optab;
  87. optab tanh_optab;
  88. optab exp_optab;
  89. optab log_optab;
  90. optab log10_optab;
  91. optab sqrt_optab;
  92. #endif /* APPLE_C */
  93.  
  94. optab cmp_optab;
  95. optab ucmp_optab;  /* Used only for libcalls for unsigned comparisons.  */
  96. optab tst_optab;
  97.  
  98. /* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
  99.    gives the gen_function to make a branch to test that condition.  */
  100.  
  101. rtxfun bcc_gen_fctn[NUM_RTX_CODE];
  102.  
  103. /* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
  104.    gives the gen_function to make a store-condition insn
  105.    to test that condition.  */
  106.  
  107. rtxfun setcc_gen_fctn[NUM_RTX_CODE];
  108.  
  109. /* Generate code to perform an operation specified by BINOPTAB
  110.    on operands OP0 and OP1, with result having machine-mode MODE.
  111.  
  112.    UNSIGNEDP is for the case where we have to widen the operands
  113.    to perform the operation.  It says to use zero-extension.
  114.  
  115.    If TARGET is nonzero, the value
  116.    is generated there, if it is convenient to do so.
  117.    In all cases an rtx is returned for the locus of the value;
  118.    this may or may not be TARGET.  */
  119.  
  120. rtx
  121. expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
  122.      enum machine_mode mode;
  123.      optab binoptab;
  124.      rtx op0, op1;
  125.      rtx target;
  126.      int unsignedp;
  127.      enum optab_methods methods;
  128. {
  129.   enum mode_class class;
  130.   enum machine_mode wider_mode;
  131.   register rtx temp;
  132.   rtx last;
  133.  
  134.   class = GET_MODE_CLASS (mode);
  135.  
  136.   op0 = protect_from_queue (op0, 0);
  137.   op1 = protect_from_queue (op1, 0);
  138.   if (target)
  139.     target = protect_from_queue (target, 1);
  140.  
  141. #if 0
  142.   /* We may get better code by generating the result in a register
  143.      when the target is not one of the operands.  */
  144.   if (target && ! rtx_equal_p (target, op1) && ! rtx_equal_p (target, op0))
  145.     target_is_not_an_operand = 1;
  146. #endif
  147.  
  148.   if (flag_force_mem)
  149.     {
  150.       op0 = force_not_mem (op0);
  151.       op1 = force_not_mem (op1);
  152.     }
  153.  
  154.   /* Record where to delete back to if we backtrack.  */
  155.   last = get_last_insn ();
  156.  
  157.   /* If operation is commutative,
  158.      try to make the first operand a register.
  159.      Even better, try to make it the same as the target.
  160.      Also try to make the last operand a constant.  */
  161.   if (binoptab == add_optab
  162.       || binoptab == and_optab
  163.       || binoptab == ior_optab
  164.       || binoptab == xor_optab
  165.       || binoptab == smul_optab
  166.       || binoptab == umul_optab
  167.       || binoptab == smul_widen_optab
  168.       || binoptab == umul_widen_optab)
  169.     {
  170.       if (((target == 0 || GET_CODE (target) == REG)
  171.        ? ((GET_CODE (op1) == REG
  172.            && GET_CODE (op0) != REG)
  173.           || target == op1)
  174.        : rtx_equal_p (op1, target))
  175.       ||
  176.       GET_CODE (op0) == CONST_INT)
  177.     {
  178.       temp = op1;
  179.       op1 = op0;
  180.       op0 = temp;
  181.     }
  182.     }
  183.  
  184.   /* If we can do it with a three-operand insn, do so.  */
  185.  
  186.   if (methods != OPTAB_MUST_WIDEN
  187.       && binoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  188.     {
  189.       int icode = (int) binoptab->handlers[(int) mode].insn_code;
  190.       enum machine_mode mode0 = insn_operand_mode[icode][1];
  191.       enum machine_mode mode1 = insn_operand_mode[icode][2];
  192.       rtx pat;
  193.       rtx xop0 = op0, xop1 = op1;
  194.  
  195.       if (target)
  196.     temp = target;
  197.       else
  198.     temp = gen_reg_rtx (mode);
  199.  
  200.       /* In case the insn wants input operands in modes different from
  201.      the result, convert the operands.  */
  202.  
  203.       if (GET_MODE (op0) != VOIDmode
  204.       && GET_MODE (op0) != mode0)
  205.     xop0 = convert_to_mode (mode0, xop0, unsignedp);
  206.  
  207.       if (GET_MODE (xop1) != VOIDmode
  208.       && GET_MODE (xop1) != mode1)
  209.     xop1 = convert_to_mode (mode1, xop1, unsignedp);
  210.  
  211.       /* Now, if insn requires register operands, put operands into regs.  */
  212.  
  213.       if (! (*insn_operand_predicate[icode][1]) (xop0, mode0))
  214.     xop0 = force_reg (mode0, xop0);
  215.  
  216.       if (! (*insn_operand_predicate[icode][2]) (xop1, mode1))
  217.     xop1 = force_reg (mode1, xop1);
  218.  
  219.       if (! (*insn_operand_predicate[icode][0]) (temp, mode))
  220.     temp = gen_reg_rtx (mode);
  221.  
  222.       pat = GEN_FCN (icode) (temp, xop0, xop1);
  223.       if (pat)
  224.     {
  225.       emit_insn (pat);
  226.       return temp;
  227.     }
  228.       else
  229.     delete_insns_since (last);
  230.     }
  231.  
  232.   /* It can't be open-coded in this mode.
  233.      Use a library call if one is available and caller says that's ok.  */
  234.  
  235.   if (binoptab->handlers[(int) mode].lib_call
  236.       && (methods == OPTAB_LIB || methods == OPTAB_LIB_WIDEN))
  237.     {
  238.       rtx insn_before, insn_first, insn_last;
  239.       rtx funexp = gen_rtx (SYMBOL_REF, Pmode,
  240.                 binoptab->handlers[(int) mode].lib_call);
  241.  
  242.       /* Pass the address through a pseudoreg, if desired,
  243.      before the "beginning" of the library call.
  244.      So this insn isn't "part of" the library call, in case that
  245.      is deleted, or cse'd.  */
  246. #ifndef NO_FUNCTION_CSE
  247.       if (! flag_no_function_cse)
  248.     funexp = copy_to_mode_reg (Pmode, funexp);
  249. #endif
  250.  
  251.       insn_before = get_last_insn ();
  252.       if (insn_before == 0)
  253.     abort ();
  254.  
  255.       /* Cannot pass FUNEXP since emit_library_call insists
  256.      on getting a SYMBOL_REF.  But cse will make this SYMBOL_REF
  257.      be replaced with the copy we made just above.  */
  258.       /* Pass 1 for NO_QUEUE so we don't lose any increments
  259.      if the libcall is cse'd or moved.  */
  260.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  261.                   binoptab->handlers[(int) mode].lib_call),
  262.              1, mode, 2, op0, mode, op1, mode);
  263.       target = hard_libcall_value (mode);
  264.       temp = copy_to_reg (target);
  265.  
  266.       insn_first = NEXT_INSN (insn_before);
  267.       insn_last = get_last_insn ();
  268.  
  269.       REG_NOTES (insn_last)
  270.     = gen_rtx (EXPR_LIST, REG_EQUAL,
  271.            gen_rtx (binoptab->code, mode, op0, op1),
  272.            gen_rtx (INSN_LIST, REG_RETVAL, insn_first,
  273.                 REG_NOTES (insn_last)));
  274.       REG_NOTES (insn_first)
  275.     = gen_rtx (INSN_LIST, REG_LIBCALL, insn_last,
  276.            REG_NOTES (insn_first));
  277.       return temp;
  278.     }
  279.  
  280.   delete_insns_since (last);
  281.  
  282.   /* It can't be done in this mode.  Can we do it in a wider mode?  */
  283.  
  284.   if (! (methods == OPTAB_WIDEN || methods == OPTAB_LIB_WIDEN
  285.      || methods == OPTAB_MUST_WIDEN))
  286.     return 0;            /* Caller says, don't even try.  */
  287.  
  288.   /* Compute the value of METHODS to pass to recursive calls.
  289.      Don't allow widening to be tried recursively.  */
  290.  
  291.   methods = (methods == OPTAB_LIB_WIDEN ? OPTAB_LIB : OPTAB_DIRECT);
  292.  
  293.   /* Widening is now independent of specific machine modes.
  294.      It is assumed that widening may be performed to any
  295.      higher numbered mode in the same mode class.  */
  296.  
  297.   if (class == MODE_INT || class == MODE_FLOAT)
  298.     {
  299.       for (wider_mode = INC_MODE (mode);
  300.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  301.         && GET_MODE_CLASS (wider_mode) == class);
  302.        wider_mode = INC_MODE (wider_mode))
  303.     {
  304.       if ((binoptab->handlers[(int) wider_mode].insn_code
  305.            != CODE_FOR_nothing)
  306.           || (methods == OPTAB_LIB
  307.           && binoptab->handlers[(int) wider_mode].lib_call))
  308.         {
  309.           rtx xop0 = op0, xop1 = op1;
  310.           int no_extend = 0;
  311.  
  312.           /* For certain operations, we need not actually extend
  313.          the narrow operands, as long as we will truncate
  314.          the results to the same narrowness.  */
  315.  
  316.           if (binoptab == ior_optab || binoptab == and_optab
  317.           || binoptab == xor_optab || binoptab == andcb_optab
  318.           || binoptab == add_optab || binoptab == sub_optab
  319.           || binoptab == smul_optab || binoptab == umul_optab
  320.           || binoptab == ashl_optab || binoptab == lshl_optab)
  321.         no_extend = 1;
  322.  
  323.           if (GET_MODE (xop0) != VOIDmode)
  324.         {
  325.           if (no_extend)
  326.             {
  327.               temp = force_reg (GET_MODE (xop0), xop0);
  328.               xop0 = gen_rtx (SUBREG, wider_mode, temp, 0);
  329.             }
  330.           else
  331.             {
  332.               temp = gen_reg_rtx (wider_mode);
  333.               convert_move (temp, xop0, unsignedp);
  334.               xop0 = temp;
  335.             }
  336.         }
  337.           if (GET_MODE (xop1) != VOIDmode)
  338.         {
  339.           if (no_extend)
  340.             {
  341.               temp = force_reg (GET_MODE (xop1), xop1);
  342.               xop1 = gen_rtx (SUBREG, wider_mode, temp, 0);
  343.             }
  344.           else
  345.             {
  346.               temp = gen_reg_rtx (wider_mode);
  347.               convert_move (temp, xop1, unsignedp);
  348.               xop1 = temp;
  349.             }
  350.         }
  351.  
  352.           temp = expand_binop (wider_mode, binoptab, xop0, xop1, 0,
  353.                    unsignedp, methods);
  354.           if (temp)
  355.         {
  356.           if (class == MODE_FLOAT)
  357.             {
  358.               if (target == 0)
  359.             target = gen_reg_rtx (mode);
  360.               convert_move (target, temp, 0);
  361.               return target;
  362.             }
  363.           else
  364.             return gen_lowpart (mode, temp);
  365.         }
  366.           else
  367.         delete_insns_since (last);
  368.         }
  369.     }
  370.     }
  371.  
  372.   return 0;
  373. }
  374.  
  375. /* Expand a binary operator which has both signed and unsigned forms.
  376.    UOPTAB is the optab for unsigned operations, and SOPTAB is for
  377.    signed operations.
  378.  
  379.    If we widen unsigned operands, we may use a signed wider operation instead
  380.    of an unsigned wider operation, since the result would be the same.  */
  381.  
  382. rtx
  383. sign_expand_binop (mode, uoptab, soptab, op0, op1, target, unsignedp, methods)
  384.     enum machine_mode mode;
  385.     optab uoptab, soptab;
  386.     rtx op0, op1, target;
  387.     int unsignedp;
  388.     enum optab_methods methods;
  389. {
  390.   register rtx temp;
  391.   optab direct_optab = unsignedp ? uoptab : soptab;
  392.   struct optab wide_soptab;
  393.  
  394.   /* Do it without widening, if possible.  */
  395.   temp = expand_binop (mode, direct_optab, op0, op1, target,
  396.                unsignedp, OPTAB_DIRECT);
  397.   if (temp || methods == OPTAB_DIRECT)
  398.     return temp;
  399.  
  400.   /* Try widening to a signed int.  Make a fake signed optab that
  401.      hides any signed insn for direct use.  */
  402.   wide_soptab = *soptab;
  403.   wide_soptab.handlers[(int) mode].insn_code = CODE_FOR_nothing;
  404.   wide_soptab.handlers[(int) mode].lib_call = 0;
  405.  
  406.   temp = expand_binop (mode, &wide_soptab, op0, op1, target,
  407.                unsignedp, OPTAB_WIDEN);
  408.  
  409.   /* For unsigned operands, try widening to an unsigned int.  */
  410.   if (temp == 0 && unsignedp)
  411.     temp = expand_binop (mode, uoptab, op0, op1, target,
  412.              unsignedp, OPTAB_WIDEN);
  413.   if (temp || methods == OPTAB_WIDEN)
  414.     return temp;
  415.  
  416.   /* Use the right width lib call if that exists.  */
  417.   temp = expand_binop (mode, direct_optab, op0, op1, target, unsignedp, OPTAB_LIB);
  418.   if (temp || methods == OPTAB_LIB)
  419.     return temp;
  420.  
  421.   /* Must widen and use a lib call, use either signed or unsigned.  */
  422.   temp = expand_binop (mode, &wide_soptab, op0, op1, target,
  423.                unsignedp, methods);
  424.   if (temp != 0)
  425.     return temp;
  426.   if (unsignedp)
  427.     return expand_binop (mode, uoptab, op0, op1, target,
  428.              unsignedp, methods);
  429.   return 0;
  430. }
  431.  
  432. /* Generate code to perform an operation specified by BINOPTAB
  433.    on operands OP0 and OP1, with two results to TARG1 and TARG2.
  434.    We assume that the order of the operands for the instruction
  435.    is TARG0, OP0, OP1, TARG1, which would fit a pattern like
  436.    [(set TARG0 (operate OP0 OP1)) (set TARG1 (operate ...))].
  437.  
  438.    Either TARG0 or TARG1 may be zero, but what that means is that
  439.    that result is not actually wanted.  We will generate it into
  440.    a dummy pseudo-reg and discard it.  They may not both be zero.
  441.  
  442.    Returns 1 if this operation can be performed; 0 if not.  */
  443.  
  444. int
  445. expand_twoval_binop (binoptab, op0, op1, targ0, targ1, unsignedp)
  446.      optab binoptab;
  447.      rtx op0, op1;
  448.      rtx targ0, targ1;
  449.      int unsignedp;
  450. {
  451.   enum machine_mode mode = GET_MODE (targ0 ? targ0 : targ1);
  452.   enum mode_class class;
  453.   enum machine_mode wider_mode;
  454.  
  455.   class = GET_MODE_CLASS (mode);
  456.  
  457.   op0 = protect_from_queue (op0, 0);
  458.   op1 = protect_from_queue (op1, 0);
  459.  
  460.   if (flag_force_mem)
  461.     {
  462.       op0 = force_not_mem (op0);
  463.       op1 = force_not_mem (op1);
  464.     }
  465.  
  466.   if (targ0)
  467.     targ0 = protect_from_queue (targ0, 1);
  468.   else
  469.     targ0 = gen_reg_rtx (mode);
  470.   if (targ1)
  471.     targ1 = protect_from_queue (targ1, 1);
  472.   else
  473.     targ1 = gen_reg_rtx (mode);
  474.  
  475.   if (binoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  476.     {
  477.       emit_insn (GEN_FCN (binoptab->handlers[(int) mode].insn_code)
  478.          (targ0, op0, op1, targ1));
  479.       return 1;
  480.     }
  481.  
  482.   /* It can't be done in this mode.  Can we do it in a wider mode?  */
  483.  
  484.   if (class == MODE_INT || class == MODE_FLOAT)
  485.     {
  486.       for (wider_mode = INC_MODE (mode);
  487.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  488.         && GET_MODE_CLASS (wider_mode) == class);
  489.        wider_mode = INC_MODE (wider_mode))
  490.     {
  491.       if (binoptab->handlers[(int) wider_mode].insn_code
  492.           != CODE_FOR_nothing)
  493.         {
  494.           expand_twoval_binop_convert (binoptab, wider_mode, op0, op1,
  495.                        targ0, targ1, unsignedp);
  496.           return 1;
  497.         }
  498.     }
  499.     }
  500.   return 0;
  501. }
  502.  
  503. int
  504. expand_twoval_binop_convert (binoptab, mode, op0, op1, targ0, targ1, unsignedp)
  505.      register optab binoptab;
  506.      register rtx op0, op1, targ0, targ1;
  507.      int unsignedp;
  508. {
  509.   register rtx t0 = gen_reg_rtx (SImode);
  510.   register rtx t1 = gen_reg_rtx (SImode);
  511.   register rtx temp;
  512.  
  513.   temp = gen_reg_rtx (SImode);
  514.   convert_move (temp, op0, unsignedp);
  515.   op0 = temp;
  516.   temp = gen_reg_rtx (SImode);
  517.   convert_move (temp, op1, unsignedp);
  518.   op1 = temp;
  519.  
  520.   expand_twoval_binop (binoptab, op0, op1, t0, t1, unsignedp);
  521.   convert_move (targ0, t0, unsignedp);
  522.   convert_move (targ1, t1, unsignedp);
  523.   return 1;
  524. }
  525.  
  526. /* Generate code to perform an operation specified by UNOPTAB
  527.    on operand OP0, with result having machine-mode MODE.
  528.  
  529.    UNSIGNEDP is for the case where we have to widen the operands
  530.    to perform the operation.  It says to use zero-extension.
  531.  
  532.    If TARGET is nonzero, the value
  533.    is generated there, if it is convenient to do so.
  534.    In all cases an rtx is returned for the locus of the value;
  535.    this may or may not be TARGET.  */
  536.  
  537. rtx
  538. expand_unop (mode, unoptab, op0, target, unsignedp)
  539.      enum machine_mode mode;
  540.      optab unoptab;
  541.      rtx op0;
  542.      rtx target;
  543.      int unsignedp;
  544. {
  545.   enum mode_class class;
  546.   enum machine_mode wider_mode;
  547.   register rtx temp;
  548.  
  549.   class = GET_MODE_CLASS (mode);
  550.  
  551.   op0 = protect_from_queue (op0, 0);
  552.  
  553.   if (flag_force_mem)
  554.     {
  555.       op0 = force_not_mem (op0);
  556.     }
  557.  
  558.   if (target)
  559.     target = protect_from_queue (target, 1);
  560.  
  561.   if (unoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  562.     {
  563.       int icode = (int) unoptab->handlers[(int) mode].insn_code;
  564.       enum machine_mode mode0 = insn_operand_mode[icode][1];
  565.  
  566.       if (target)
  567.     temp = target;
  568.       else
  569.     temp = gen_reg_rtx (mode);
  570.  
  571.       if (GET_MODE (op0) != VOIDmode
  572.       && GET_MODE (op0) != mode0)
  573.     op0 = convert_to_mode (mode0, op0, unsignedp);
  574.  
  575.       /* Now, if insn requires register operands, put operands into regs.  */
  576.  
  577.       if (! (*insn_operand_predicate[icode][1]) (op0, mode0))
  578.     op0 = force_reg (mode0, op0);
  579.  
  580.       if (! (*insn_operand_predicate[icode][0]) (temp, mode))
  581.     temp = gen_reg_rtx (mode);
  582.  
  583.       emit_insn (GEN_FCN (icode) (temp, op0));
  584.       return temp;
  585.     }
  586.   else if (unoptab->handlers[(int) mode].lib_call)
  587.     {
  588.       rtx insn_before, insn_last;
  589.       rtx funexp = gen_rtx (SYMBOL_REF, Pmode,
  590.                 unoptab->handlers[(int) mode].lib_call);
  591.  
  592.       /* Pass the address through a pseudoreg, if desired,
  593.      before the "beginning" of the library call (for deletion).  */
  594. #ifndef NO_FUNCTION_CSE
  595.       if (! flag_no_function_cse)
  596.     funexp = copy_to_mode_reg (Pmode, funexp);
  597. #endif
  598.  
  599.       insn_before = get_last_insn ();
  600.  
  601.       /* Cannot pass FUNEXP since  emit_library_call insists
  602.      on getting a SYMBOL_REF.  But cse will make this SYMBOL_REF
  603.      be replaced with the copy we made just above.  */
  604.       /* Pass 1 for NO_QUEUE so we don't lose any increments
  605.      if the libcall is cse'd or moved.  */
  606.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  607.                   unoptab->handlers[(int) mode].lib_call),
  608.              1, mode, 1, op0, mode);
  609.       target = hard_libcall_value (mode);
  610.       temp = copy_to_reg (target);
  611.       insn_last = get_last_insn ();
  612.       REG_NOTES (insn_last)
  613.     = gen_rtx (EXPR_LIST, REG_EQUAL,
  614.            gen_rtx (unoptab->code, mode, op0),
  615.            gen_rtx (INSN_LIST, REG_RETVAL,
  616.                 NEXT_INSN (insn_before),
  617.                 REG_NOTES (insn_last)));
  618.       REG_NOTES (NEXT_INSN (insn_before))
  619.     = gen_rtx (INSN_LIST, REG_LIBCALL, insn_last,
  620.            REG_NOTES (NEXT_INSN (insn_before)));
  621.       return temp;
  622.     }
  623.  
  624.   /* It can't be done in this mode.  Can we do it in a wider mode?  */
  625.  
  626.   if (class == MODE_INT || class == MODE_FLOAT)
  627.     {
  628.       for (wider_mode = INC_MODE (mode);
  629.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  630.         && GET_MODE_CLASS (wider_mode) == class);
  631.        wider_mode = INC_MODE (wider_mode))
  632.     {
  633.       if ((unoptab->handlers[(int) wider_mode].insn_code
  634.            != CODE_FOR_nothing)
  635.           || unoptab->handlers[(int) wider_mode].lib_call)
  636.         {
  637.           if (GET_MODE (op0) != VOIDmode)
  638.         {
  639.           temp = gen_reg_rtx (wider_mode);
  640.           convert_move (temp, op0, unsignedp);
  641. #ifndef APPLE_HAX
  642.           /* Stupid mistake in original 1.37 code. */
  643.           op0 = temp;
  644. #endif /* APPLE_HAX */
  645.         }
  646.           
  647. #ifdef APPLE_HAX
  648.           /* Our fix for the stupid mistake. */
  649.           target = expand_unop (wider_mode, unoptab, temp, 0, unsignedp);
  650. #else
  651.           target = expand_unop (wider_mode, unoptab, op0, 0, unsignedp);
  652. #endif /* APPLE_HAX */
  653.           if (class == MODE_FLOAT)
  654.         {
  655. #ifdef APPLE_HAX
  656.           /* Continuing the fix, we need another temp rtx. */
  657.           rtx temp2;
  658.  
  659.           temp2 = gen_reg_rtx (mode);
  660.           convert_move (temp2, target, 0);
  661.           return temp2;
  662. #else
  663.           if (target == 0)
  664.             target = gen_reg_rtx (mode);
  665.           convert_move (target, temp, 0);
  666.           return target;
  667. #endif /* APPLE_HAX */
  668.         }
  669.           else
  670.         return gen_lowpart (mode, target);
  671.         }
  672.     }
  673.     }
  674.  
  675.   return 0;
  676. }
  677.  
  678. /* Generate an instruction whose insn-code is INSN_CODE,
  679.    with two operands: an output TARGET and an input OP0.
  680.    TARGET *must* be nonzero, and the output is always stored there.
  681.    CODE is an rtx code such that (CODE OP0) is an rtx that describes
  682.    the value that is stored into TARGET.  */
  683.  
  684. void
  685. emit_unop_insn (icode, target, op0, code)
  686.      int icode;
  687.      rtx target;
  688.      rtx op0;
  689.      enum rtx_code code;
  690. {
  691.   register rtx temp;
  692.   enum machine_mode mode0 = insn_operand_mode[icode][1];
  693.   rtx insn;
  694.   rtx prev_insn;
  695.  
  696.   temp = target = protect_from_queue (target, 1);
  697.  
  698.   op0 = protect_from_queue (op0, 0);
  699.  
  700.   if (flag_force_mem)
  701.     op0 = force_not_mem (op0);
  702.  
  703.   /* Now, if insn requires register operands, put operands into regs.  */
  704.  
  705.   if (! (*insn_operand_predicate[icode][1]) (op0, mode0))
  706.     op0 = force_reg (mode0, op0);
  707.  
  708.   if (! (*insn_operand_predicate[icode][0]) (temp, GET_MODE (temp))
  709.       || (flag_force_mem && GET_CODE (temp) == MEM))
  710.     temp = gen_reg_rtx (GET_MODE (temp));
  711.  
  712.   prev_insn = get_last_insn ();
  713.   insn = emit_insn (GEN_FCN (icode) (temp, op0));
  714.  
  715.   /* If we just made a multi-insn sequence,
  716.      record in the last insn an equivalent expression for its value
  717.      and a pointer to the first insn.  This makes cse possible.  */
  718.   if (code != UNKNOWN && PREV_INSN (insn) != prev_insn)
  719.     REG_NOTES (insn)
  720.       = gen_rtx (EXPR_LIST, REG_EQUAL,
  721.          gen_rtx (code, GET_MODE (temp), op0),
  722.          REG_NOTES (insn));
  723.   
  724.   if (temp != target)
  725.     emit_move_insn (target, temp);
  726. }
  727.  
  728. /* Generate code to store zero in X.  */
  729.  
  730. void
  731. emit_clr_insn (x)
  732.      rtx x;
  733. {
  734.   emit_move_insn (x, const0_rtx);
  735. }
  736.  
  737. /* Generate code to store 1 in X
  738.    assuming it contains zero beforehand.  */
  739.  
  740. void
  741. emit_0_to_1_insn (x)
  742.      rtx x;
  743. {
  744.   emit_move_insn (x, const1_rtx);
  745. }
  746.  
  747. /* Generate code to compare X with Y
  748.    so that the condition codes are set.
  749.  
  750.    UNSIGNEDP nonzero says that X and Y are unsigned;
  751.    this matters if they need to be widened.
  752.  
  753.    If they have mode BLKmode, then SIZE specifies the size of both X and Y,
  754.    and ALIGN specifies the known shared alignment of X and Y.  */
  755.  
  756. void
  757. emit_cmp_insn (x, y, size, unsignedp, align)
  758.      rtx x, y;
  759.      rtx size;
  760.      int unsignedp;
  761.      int align;
  762. {
  763.   enum machine_mode mode = GET_MODE (x);
  764.   enum mode_class class;
  765.   enum machine_mode wider_mode;
  766.  
  767.   if (mode == VOIDmode) mode = GET_MODE (y);
  768.   /* They could both be VOIDmode if both args are immediate constants,
  769.      but we should fold that at an earlier stage.
  770.      With no special code here, this will call abort,
  771.      reminding the programmer to implement such folding.  */
  772.  
  773.   class = GET_MODE_CLASS (mode);
  774.  
  775.   if (mode != BLKmode && flag_force_mem)
  776.     {
  777.       x = force_not_mem (x);
  778.       y = force_not_mem (y);
  779.     }
  780.  
  781.   /* Handle all BLKmode compares.  */
  782.  
  783.   if (mode == BLKmode)
  784.     {
  785.       emit_queue ();
  786.       x = protect_from_queue (x, 0);
  787.       y = protect_from_queue (y, 0);
  788.  
  789.       if (size == 0)
  790.     abort ();
  791. #ifdef HAVE_cmpstrqi
  792.       if (HAVE_cmpstrqi
  793.       && GET_CODE (size) == CONST_INT
  794.       && INTVAL (size) < (1 << GET_MODE_BITSIZE (QImode)))
  795.     emit_insn (gen_cmpstrqi (x, y, size,
  796.                  gen_rtx (CONST_INT, VOIDmode, align)));
  797.       else
  798. #endif
  799. #ifdef HAVE_cmpstrhi
  800.       if (HAVE_cmpstrhi
  801.       && GET_CODE (size) == CONST_INT
  802.       && INTVAL (size) < (1 << GET_MODE_BITSIZE (HImode)))
  803.     emit_insn (gen_cmpstrhi (x, y, size,
  804.                  gen_rtx (CONST_INT, VOIDmode, align)));
  805.       else
  806. #endif
  807. #ifdef HAVE_cmpstrsi
  808.       if (HAVE_cmpstrsi)
  809.     emit_insn (gen_cmpstrsi (x, y, convert_to_mode (SImode, size, 1),
  810.                  gen_rtx (CONST_INT, VOIDmode, align)));
  811.       else
  812. #endif
  813.     {
  814. #ifdef TARGET_MEM_FUNCTIONS
  815.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcmp"), 0, 
  816.                  SImode, 3,
  817.                  XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
  818.                  size, Pmode);
  819. #else
  820.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcmp"), 0,
  821.                  SImode, 3,
  822.                  XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
  823.                  size, Pmode);
  824. #endif
  825.       emit_cmp_insn (hard_libcall_value (SImode), const0_rtx, 0, 0, 0);
  826.     }
  827.       return;
  828.     }
  829.  
  830.   /* Handle some compares against zero.  */
  831.  
  832.   if (y == CONST0_RTX (mode)
  833.       && tst_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  834.     {
  835.       int icode = (int) tst_optab->handlers[(int) mode].insn_code;
  836.  
  837.       emit_queue ();
  838.       x = protect_from_queue (x, 0);
  839.       y = protect_from_queue (y, 0);
  840.  
  841.       /* Now, if insn requires register operands, put operands into regs.  */
  842.       if (! (*insn_operand_predicate[icode][0])
  843.       (x, insn_operand_mode[icode][0]))
  844.     x = force_reg (insn_operand_mode[icode][0], x);
  845.  
  846.       emit_insn (GEN_FCN (icode) (x));
  847.       return;
  848.     }
  849.  
  850.   /* Handle compares for which there is a directly suitable insn.  */
  851.  
  852.   if (cmp_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  853.     {
  854.       int icode = (int) cmp_optab->handlers[(int) mode].insn_code;
  855.  
  856.       emit_queue ();
  857.       x = protect_from_queue (x, 0);
  858.       y = protect_from_queue (y, 0);
  859.  
  860.       /* Now, if insn requires register operands, put operands into regs.  */
  861.       if (! (*insn_operand_predicate[icode][0])
  862.       (x, insn_operand_mode[icode][0]))
  863.     x = force_reg (insn_operand_mode[icode][0], x);
  864.  
  865.       if (! (*insn_operand_predicate[icode][1])
  866.       (y, insn_operand_mode[icode][1]))
  867.     y = force_reg (insn_operand_mode[icode][1], y);
  868.  
  869.       emit_insn (GEN_FCN (icode) (x, y));
  870.       return;
  871.     }
  872.  
  873.   /* Try widening if we can find a direct insn that way.  */
  874.  
  875.   if (class == MODE_INT || class == MODE_FLOAT)
  876.     {
  877.       for (wider_mode = INC_MODE (mode);
  878.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  879.         && GET_MODE_CLASS (wider_mode) == class);
  880.        wider_mode = INC_MODE (wider_mode))
  881.     {
  882.       if (cmp_optab->handlers[(int) wider_mode].insn_code
  883.           != CODE_FOR_nothing)
  884.         {
  885.           x = convert_to_mode (wider_mode, x, unsignedp);
  886.           y = convert_to_mode (wider_mode, y, unsignedp);
  887.           emit_cmp_insn (x, y, 0, unsignedp, align);
  888.           return;
  889.         }
  890.     }
  891.     }
  892.  
  893.   /* Handle a lib call just for the mode we are using.  */
  894.  
  895.   if (cmp_optab->handlers[(int) mode].lib_call)
  896.     {
  897.       char *string = cmp_optab->handlers[(int) mode].lib_call;
  898.       /* If we want unsigned, and this mode has a distinct unsigned
  899.      comparison routine, use that.  */
  900.       if (unsignedp && ucmp_optab->handlers[(int) mode].lib_call)
  901.     string = ucmp_optab->handlers[(int) mode].lib_call;
  902.  
  903.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, string), 0,
  904.              SImode, 2, x, mode, y, mode);
  905.  
  906.       /* Integer comparison returns a result that must be compared against 1,
  907.      so that even if we do an unsigned compare afterward,
  908.      there is still a value that can represent the result "less than".  */
  909.       if (GET_MODE_CLASS (mode) == MODE_INT)
  910.     emit_cmp_insn (hard_libcall_value (SImode), const1_rtx, 0, unsignedp, 0);
  911.       else
  912.     emit_cmp_insn (hard_libcall_value (SImode), const0_rtx, 0, 0, 0);
  913.       return;
  914.     }
  915.  
  916.   /* Try widening and then using a libcall.  */
  917.  
  918.   if (class == MODE_FLOAT)
  919.     {
  920.       for (wider_mode = INC_MODE (mode);
  921.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  922.         && GET_MODE_CLASS (wider_mode) == class);
  923.        wider_mode = INC_MODE (wider_mode))
  924.     {
  925.       if ((cmp_optab->handlers[(int) wider_mode].insn_code
  926.            != CODE_FOR_nothing)
  927.           || (cmp_optab->handlers[(int) wider_mode].lib_call != 0))
  928.         {
  929.           x = convert_to_mode (wider_mode, x, unsignedp);
  930.           y = convert_to_mode (wider_mode, y, unsignedp);
  931.           emit_cmp_insn (x, y, 0, unsignedp, align);
  932.         }
  933.     }
  934.       return;
  935.     }
  936.  
  937.   abort ();
  938. }
  939.  
  940. /* These three functions generate an insn body and return it
  941.    rather than emitting the insn.
  942.  
  943.    They do not protect from queued increments,
  944.    because they may be used 1) in protect_from_queue itself
  945.    and 2) in other passes where there is no queue.  */
  946.  
  947. /* Generate and return an insn body to add Y to X.  */
  948.  
  949. rtx
  950. gen_add2_insn (x, y)
  951.      rtx x, y;
  952. {
  953.   return (GEN_FCN (add_optab->handlers[(int) GET_MODE (x)].insn_code)
  954.       (x, x, y));
  955. }
  956.  
  957. int
  958. have_add2_insn (mode)
  959.      enum machine_mode mode;
  960. {
  961.   return add_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
  962. }
  963.  
  964. /* Generate and return an insn body to subtract Y from X.  */
  965.  
  966. rtx
  967. gen_sub2_insn (x, y)
  968.      rtx x, y;
  969. {
  970.   return (GEN_FCN (sub_optab->handlers[(int) GET_MODE (x)].insn_code)
  971.       (x, x, y));
  972. }
  973.  
  974. int
  975. have_sub2_insn (mode)
  976.      enum machine_mode mode;
  977. {
  978.   return add_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
  979. }
  980.  
  981. /* Generate the body of an instruction to copy Y into X.  */
  982.  
  983. rtx
  984. gen_move_insn (x, y)
  985.      rtx x, y;
  986. {
  987.   register enum machine_mode mode = GET_MODE (x);
  988.   if (mode == VOIDmode)
  989.     mode = GET_MODE (y);
  990.   return (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));
  991. }
  992.  
  993. #if 0
  994. /* Tables of patterns for extending one integer mode to another.  */
  995. enum insn_code zero_extend_optab[MAX_MACHINE_MODE][MAX_MACHINE_MODE];
  996. enum insn_code sign_extend_optab[MAX_MACHINE_MODE][MAX_MACHINE_MODE];
  997.  
  998. /* Generate the body of an insn to extend Y (with mode MFROM)
  999.    into X (with mode MTO).  Do zero-extension if UNSIGNEDP is nonzero.  */
  1000.  
  1001. rtx
  1002. gen_extend_insn (x, y, mto, mfrom, unsignedp)
  1003.      rtx x, y;
  1004.      enum machine_mode mto, mfrom;
  1005.      int unsignedp;
  1006. {
  1007.   return (GEN_FCN ((unsignedp ? zero_extend_optab : sign_extend_optab)
  1008.            [(int)mto][(int)mfrom])
  1009.       (x, y));
  1010. }
  1011.  
  1012. static void
  1013. init_extends ()
  1014. {
  1015.   bzero (sign_extend_optab, sizeof sign_extend_optab);
  1016.   bzero (zero_extend_optab, sizeof zero_extend_optab);
  1017.   sign_extend_optab[(int) SImode][(int) HImode] = CODE_FOR_extendhisi2;
  1018.   sign_extend_optab[(int) SImode][(int) QImode] = CODE_FOR_extendqisi2;
  1019.   sign_extend_optab[(int) HImode][(int) QImode] = CODE_FOR_extendqihi2;
  1020.   zero_extend_optab[(int) SImode][(int) HImode] = CODE_FOR_zero_extendhisi2;
  1021.   zero_extend_optab[(int) SImode][(int) QImode] = CODE_FOR_zero_extendqisi2;
  1022.   zero_extend_optab[(int) HImode][(int) QImode] = CODE_FOR_zero_extendqihi2;
  1023. }
  1024. #endif
  1025.  
  1026. /* can_fix_p and can_float_p say whether the target machine
  1027.    can directly convert a given fixed point type to
  1028.    a given floating point type, or vice versa.
  1029.    The returned value is the CODE_FOR_... value to use,
  1030.    or CODE_FOR_nothing if these modes cannot be directly converted.  */
  1031.  
  1032. #ifdef APPLE_HAX
  1033. /* There are actually three floating modes to convert to/from. */
  1034. static enum insn_code fixtab[3][2][2];
  1035. static enum insn_code fixtrunctab[3][2][2];
  1036. static enum insn_code floattab[3][2];
  1037. #else
  1038. static enum insn_code fixtab[2][2][2];
  1039. static enum insn_code fixtrunctab[2][2][2];
  1040. static enum insn_code floattab[2][2];
  1041. #endif /* APPLE_HAX */
  1042.  
  1043. #ifdef APPLE_HAX
  1044. /* A special macro is convenient to select an index to float modes. */
  1045. #define FLTMODE_INDEX(F) ((F) == SFmode ? 0 : ((F) == DFmode ? 1 : 2))
  1046. #endif /* APPLE_HAX */
  1047.  
  1048. /* *TRUNCP_PTR is set to 1 if it is necessary to output
  1049.    an explicit FTRUNC insn before the fix insn; otherwise 0.  */
  1050.  
  1051. static enum insn_code
  1052. can_fix_p (fixmode, fltmode, unsignedp, truncp_ptr)
  1053.      enum machine_mode fltmode, fixmode;
  1054.      int unsignedp;
  1055.      int *truncp_ptr;
  1056. {
  1057.   *truncp_ptr = 0;
  1058. #ifdef APPLE_HAX
  1059.   /* Use an indexing macro instead of a comparison to select by float mode. */
  1060.   if (fixtrunctab[FLTMODE_INDEX (fltmode)][fixmode == DImode][unsignedp]
  1061.       != CODE_FOR_nothing)
  1062.     return fixtrunctab[FLTMODE_INDEX (fltmode)][fixmode == DImode][unsignedp];
  1063. #else
  1064.   if (fixtrunctab[fltmode != SFmode][fixmode == DImode][unsignedp]
  1065.       != CODE_FOR_nothing)
  1066.     return fixtrunctab[fltmode != SFmode][fixmode == DImode][unsignedp];
  1067. #endif /* APPLE_HAX */
  1068.   if (ftrunc_optab->handlers[(int) fltmode].insn_code != CODE_FOR_nothing)
  1069.     {
  1070.       *truncp_ptr = 1;
  1071. #ifdef APPLE_HAX
  1072.       /* Use an indexing macro instead of a cmp to select by float mode. */
  1073.       return fixtab[FLTMODE_INDEX (fltmode)][fixmode == DImode][unsignedp];
  1074. #else
  1075.       return fixtab[fltmode != SFmode][fixmode == DImode][unsignedp];
  1076. #endif /* APPLE_HAX */
  1077.     }
  1078.   return CODE_FOR_nothing;
  1079. }
  1080.  
  1081. static enum insn_code
  1082. can_float_p (fltmode, fixmode)
  1083.      enum machine_mode fixmode, fltmode;
  1084. {
  1085. #ifdef APPLE_HAX
  1086.   /* Use an indexing macro instead of a cmp to select by float mode. */
  1087.   return floattab[FLTMODE_INDEX(fltmode)][fixmode == DImode];
  1088. #else
  1089.   return floattab[fltmode != SFmode][fixmode == DImode];
  1090. #endif /* APPLE_HAX */
  1091. }
  1092.  
  1093. void
  1094. init_fixtab ()
  1095. {
  1096.   enum insn_code *p;
  1097.   for (p = fixtab[0][0];
  1098.        p < fixtab[0][0] + sizeof fixtab / sizeof (fixtab[0][0][0]); 
  1099.        p++)
  1100.     *p = CODE_FOR_nothing;
  1101.   for (p = fixtrunctab[0][0];
  1102.        p < fixtrunctab[0][0] + sizeof fixtrunctab / sizeof (fixtrunctab[0][0][0]); 
  1103.        p++)
  1104.     *p = CODE_FOR_nothing;
  1105.  
  1106. #ifdef HAVE_fixsfsi2
  1107.   if (HAVE_fixsfsi2)
  1108.     fixtab[0][0][0] = CODE_FOR_fixsfsi2;
  1109. #endif
  1110. #ifdef HAVE_fixsfdi2
  1111.   if (HAVE_fixsfdi2)
  1112.     fixtab[0][1][0] = CODE_FOR_fixsfdi2;
  1113. #endif
  1114. #ifdef HAVE_fixdfsi2
  1115.   if (HAVE_fixdfsi2)
  1116.     fixtab[1][0][0] = CODE_FOR_fixdfsi2;
  1117. #endif
  1118. #ifdef HAVE_fixdfdi2
  1119.   if (HAVE_fixdfdi2)
  1120.     fixtab[1][1][0] = CODE_FOR_fixdfdi2;
  1121. #endif
  1122. #ifdef APPLE_HAX
  1123.   /* Extended float conversions. */
  1124. #ifdef HAVE_fixxfsi2
  1125.   if (HAVE_fixxfsi2)
  1126.     fixtab[2][0][0] = CODE_FOR_fixxfsi2;
  1127. #endif
  1128. #ifdef HAVE_fixxfdi2
  1129.   if (HAVE_fixxfdi2)
  1130.     fixtab[2][1][0] = CODE_FOR_fixxfdi2;
  1131. #endif
  1132. #endif /* APPLE_HAX */
  1133.  
  1134. #ifdef HAVE_fixunssfsi2
  1135.   if (HAVE_fixunssfsi2)
  1136.     fixtab[0][0][1] = CODE_FOR_fixunssfsi2;
  1137. #endif
  1138. #ifdef HAVE_fixunssfdi2
  1139.   if (HAVE_fixunssfdi2)
  1140.     fixtab[0][1][1] = CODE_FOR_fixunssfdi2;
  1141. #endif
  1142. #ifdef HAVE_fixunsdfsi2
  1143.   if (HAVE_fixunsdfsi2)
  1144.     fixtab[1][0][1] = CODE_FOR_fixunsdfsi2;
  1145. #endif
  1146. #ifdef HAVE_fixunsdfdi2
  1147.   if (HAVE_fixunsdfdi2)
  1148.     fixtab[1][1][1] = CODE_FOR_fixunsdfdi2;
  1149. #endif
  1150. #ifdef APPLE_HAX
  1151.   /* Extended float conversions. */
  1152. #ifdef HAVE_fixunsxfsi2
  1153.   if (HAVE_fixunsxfsi2)
  1154.     fixtab[2][0][1] = CODE_FOR_fixunsxfsi2;
  1155. #endif
  1156. #ifdef HAVE_fixunsxfdi2
  1157.   if (HAVE_fixunsxfdi2)
  1158.     fixtab[2][1][1] = CODE_FOR_fixunsxfdi2;
  1159. #endif
  1160. #endif /* APPLE_HAX */
  1161.  
  1162. #ifdef HAVE_fix_truncsfsi2
  1163.   if (HAVE_fix_truncsfsi2)
  1164.     fixtrunctab[0][0][0] = CODE_FOR_fix_truncsfsi2;
  1165. #endif
  1166. #ifdef HAVE_fix_truncsfdi2
  1167.   if (HAVE_fix_truncsfdi2)
  1168.     fixtrunctab[0][1][0] = CODE_FOR_fix_truncsfdi2;
  1169. #endif
  1170. #ifdef HAVE_fix_truncdfsi2
  1171.   if (HAVE_fix_truncdfsi2)
  1172.     fixtrunctab[1][0][0] = CODE_FOR_fix_truncdfsi2;
  1173. #endif
  1174. #ifdef HAVE_fix_truncdfdi2
  1175.   if (HAVE_fix_truncdfdi2)
  1176.     fixtrunctab[1][1][0] = CODE_FOR_fix_truncdfdi2;
  1177. #endif
  1178. #ifdef APPLE_HAX
  1179.   /* Extended float conversions. */
  1180. #ifdef HAVE_fix_truncxfsi2
  1181.   if (HAVE_fix_truncxfsi2)
  1182.     fixtrunctab[2][0][0] = CODE_FOR_fix_truncxfsi2;
  1183. #endif
  1184. #ifdef HAVE_fix_truncxfdi2
  1185.   if (HAVE_fix_truncxfdi2)
  1186.     fixtrunctab[2][1][0] = CODE_FOR_fix_truncxfdi2;
  1187. #endif
  1188. #endif /* APPLE_HAX */
  1189.  
  1190. #ifdef HAVE_fixuns_truncsfsi2
  1191.   if (HAVE_fixuns_truncsfsi2)
  1192.     fixtrunctab[0][0][1] = CODE_FOR_fixuns_truncsfsi2;
  1193. #endif
  1194. #ifdef HAVE_fixuns_truncsfdi2
  1195.   if (HAVE_fixuns_truncsfdi2)
  1196.     fixtrunctab[0][1][1] = CODE_FOR_fixuns_truncsfdi2;
  1197. #endif
  1198. #ifdef HAVE_fixuns_truncdfsi2
  1199.   if (HAVE_fixuns_truncdfsi2)
  1200.     fixtrunctab[1][0][1] = CODE_FOR_fixuns_truncdfsi2;
  1201. #endif
  1202. #ifdef HAVE_fixuns_truncdfdi2
  1203.   if (HAVE_fixuns_truncdfdi2)
  1204.     fixtrunctab[1][1][1] = CODE_FOR_fixuns_truncdfdi2;
  1205. #endif
  1206. #ifdef APPLE_HAX
  1207.   /* Extended float conversions. */
  1208. #ifdef HAVE_fixuns_truncxfsi2
  1209.   if (HAVE_fixuns_truncxfsi2)
  1210.     fixtrunctab[2][0][1] = CODE_FOR_fixuns_truncxfsi2;
  1211. #endif
  1212. #ifdef HAVE_fixuns_truncxfdi2
  1213.   if (HAVE_fixuns_truncxfdi2)
  1214.     fixtrunctab[2][1][1] = CODE_FOR_fixuns_truncxfdi2;
  1215. #endif
  1216. #endif /* APPLE_HAX */
  1217.  
  1218. #ifdef FIXUNS_TRUNC_LIKE_FIX_TRUNC
  1219.   /* This flag says the same insns that convert to a signed fixnum
  1220.      also convert validly to an unsigned one.  */
  1221.   {
  1222.     int i;
  1223.     int j;
  1224. #ifdef APPLE_HAX
  1225.     /* Have three float modes to iterate over now. */
  1226.     for (i = 0; i < 3; i++)
  1227. #else
  1228.     for (i = 0; i < 2; i++)
  1229. #endif /* APPLE_HAX */
  1230.       for (j = 0; j < 2; j++)
  1231.     fixtrunctab[i][j][1] = fixtrunctab[i][j][0];
  1232.   }
  1233. #endif
  1234. }
  1235.  
  1236. void
  1237. init_floattab ()
  1238. {
  1239.   enum insn_code *p;
  1240.   for (p = floattab[0];
  1241.        p < floattab[0] + sizeof floattab / sizeof (floattab[0][0]); 
  1242.        p++)
  1243.     *p = CODE_FOR_nothing;
  1244.  
  1245. #ifdef HAVE_floatsisf2
  1246.   if (HAVE_floatsisf2)
  1247.     floattab[0][0] = CODE_FOR_floatsisf2;
  1248. #endif
  1249. #ifdef HAVE_floatdisf2
  1250.   if (HAVE_floatdisf2)
  1251.     floattab[0][1] = CODE_FOR_floatdisf2;
  1252. #endif
  1253. #ifdef HAVE_floatsidf2
  1254.   if (HAVE_floatsidf2)
  1255.     floattab[1][0] = CODE_FOR_floatsidf2;
  1256. #endif
  1257. #ifdef HAVE_floatdidf2
  1258.   if (HAVE_floatdidf2)
  1259.     floattab[1][1] = CODE_FOR_floatdidf2;
  1260. #endif
  1261. #ifdef APPLE_HAX
  1262.   /* Extended float conversions. */
  1263. #ifdef HAVE_floatsixf2
  1264.   if (HAVE_floatsixf2)
  1265.     floattab[2][0] = CODE_FOR_floatsixf2;
  1266. #endif
  1267. #ifdef HAVE_floatdixf2
  1268.   if (HAVE_floatdixf2)
  1269.     floattab[2][1] = CODE_FOR_floatdixf2;
  1270. #endif
  1271. #endif /* APPLE_HAX */
  1272. }
  1273.  
  1274. /* Generate code to convert FROM to floating point
  1275.    and store in TO.  FROM must be fixed point.
  1276.    UNSIGNEDP nonzero means regard FROM as unsigned.
  1277.    Normally this is done by correcting the final value
  1278.    if it is negative.  */
  1279.  
  1280. void
  1281. expand_float (real_to, from, unsignedp)
  1282.      rtx real_to, from;
  1283.      int unsignedp;
  1284. {
  1285.   enum insn_code icode;
  1286.   register rtx to;
  1287.  
  1288.   /* Constants should get converted in `fold'.
  1289.      We lose here since we don't know the mode.  */
  1290.   if (GET_MODE (from) == VOIDmode)
  1291.     abort ();
  1292.  
  1293.   to = real_to = protect_from_queue (real_to, 1);
  1294.   from = protect_from_queue (from, 0);
  1295.  
  1296.   if (flag_force_mem)
  1297.     {
  1298.       from = force_not_mem (from);
  1299.     }
  1300.  
  1301.   /* If we are about to do some arithmetic to correct for an
  1302.      unsigned operand, do it in a register.  */
  1303.  
  1304.   if (unsignedp && GET_CODE (to) != REG)
  1305.     to = gen_reg_rtx (GET_MODE (to));
  1306.  
  1307.   /* Now do the basic conversion.  Do it in the specified modes if possible;
  1308.      otherwise convert either input, output or both with wider mode;
  1309.      otherwise use a library call.  */
  1310.  
  1311.   if ((icode = can_float_p (GET_MODE (to), GET_MODE (from)))
  1312.       != CODE_FOR_nothing)
  1313.     {
  1314.       emit_unop_insn (icode, to, from, FLOAT);
  1315.     }
  1316.   else if (GET_MODE (to) == SFmode
  1317.        && ((icode = can_float_p (DFmode, GET_MODE (from)))
  1318.            != CODE_FOR_nothing))
  1319.     {
  1320.       to = gen_reg_rtx (DFmode);
  1321.       emit_unop_insn (icode, to, from, FLOAT);
  1322.     }
  1323.   /* If we can't float a SI, maybe we can float a DI.
  1324.      If so, convert to DI and then float.  */
  1325.   else if (GET_MODE (from) != DImode
  1326.        && (can_float_p (GET_MODE (to), DImode) != CODE_FOR_nothing
  1327.            || can_float_p (DFmode, DImode) != CODE_FOR_nothing))
  1328.     {
  1329.       register rtx tem = gen_reg_rtx (DImode);
  1330.       convert_move (tem, from, unsignedp);
  1331.       from = tem;
  1332.       /* If we extend FROM then we don't need to correct
  1333.      the final value for unsignedness.  */
  1334.       unsignedp = 0;
  1335.  
  1336.       if ((icode = can_float_p (GET_MODE (to), GET_MODE (from)))
  1337.       != CODE_FOR_nothing)
  1338.     {
  1339.       emit_unop_insn (icode, to, from, FLOAT);
  1340.     }
  1341.       else if ((icode = can_float_p (DFmode, DImode))
  1342.             != CODE_FOR_nothing)
  1343.     {
  1344.       to = gen_reg_rtx (DFmode);
  1345.       emit_unop_insn (icode, to, from, FLOAT);
  1346.     }
  1347.     }
  1348.   /* No hardware instruction available; call a library
  1349.      to convert from SImode or DImode into DFmode.  */
  1350. #ifdef APPLE_HAX
  1351.   /* Now we have to do XFmode if dest is not DFmode. */
  1352.   else if (GET_MODE (to) == DFmode)
  1353. #else
  1354.   else
  1355. #endif /* APPLE_HAX */
  1356.     {
  1357.       if (GET_MODE_SIZE (GET_MODE (from)) < GET_MODE_SIZE (SImode))
  1358.     {
  1359.       from = convert_to_mode (SImode, from, unsignedp);
  1360.       unsignedp = 0;
  1361.     }
  1362.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1363.                   (GET_MODE (from) == SImode ? "__floatsidf"
  1364.                    : "__floatdidf")),
  1365.              0, DFmode, 1, from, GET_MODE (from));
  1366.       to = copy_to_reg (hard_libcall_value (DFmode));
  1367.     }
  1368. #ifdef APPLE_HAX
  1369.   /* Conversions from integer to extended float. */
  1370.   else
  1371.     {
  1372.       if (GET_MODE_SIZE (GET_MODE (from)) < GET_MODE_SIZE (SImode))
  1373.     {
  1374.       from = convert_to_mode (SImode, from, unsignedp);
  1375.       unsignedp = 0;
  1376.     }
  1377.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1378.                   (GET_MODE (from) == SImode ? "__floatsixf"
  1379.                    : "__floatdixf")),
  1380.              0, XFmode, 1, from, GET_MODE (from));
  1381.       to = copy_to_reg (hard_libcall_value (XFmode));
  1382.     }
  1383. #endif /* APPLE_HAX */
  1384.  
  1385.   /* If FROM was unsigned but we treated it as signed,
  1386.      then in the case where it is negative (and therefore TO is negative),
  1387.      correct its value by 2**bitwidth.  */
  1388.  
  1389.   if (unsignedp)
  1390.     {
  1391.       rtx label = gen_label_rtx ();
  1392.       rtx temp;
  1393.       REAL_VALUE_TYPE offset;
  1394.  
  1395.       do_pending_stack_adjust ();
  1396. #ifdef APPLE_C
  1397.       /* Issue a compare against three modes of constant zero. */
  1398.       emit_cmp_insn (to, GET_MODE (to) == DFmode ? dconst0_rtx : (GET_MODE (to) == XFmode ? ldconst0_rtx : fconst0_rtx),
  1399. #else
  1400.       emit_cmp_insn (to, GET_MODE (to) == DFmode ? dconst0_rtx : fconst0_rtx,
  1401. #endif /* APPLE_C */
  1402.              0, 0, 0);
  1403.       emit_jump_insn (gen_bge (label));
  1404.       offset = REAL_VALUE_LDEXP (1.0, GET_MODE_BITSIZE (GET_MODE (from)));
  1405.       temp = expand_binop (GET_MODE (to), add_optab, to,
  1406.                immed_real_const_1 (offset, GET_MODE (to)),
  1407.                to, 0, OPTAB_LIB_WIDEN);
  1408.       if (temp != to)
  1409.     emit_move_insn (to, temp);
  1410.       do_pending_stack_adjust ();
  1411.       emit_label (label);
  1412.     }
  1413.  
  1414.   /* Copy result to requested destination
  1415.      if we have been computing in a temp location.  */
  1416.  
  1417.   if (to != real_to)
  1418.     {
  1419.       if (GET_MODE (real_to) == GET_MODE (to))
  1420.     emit_move_insn (real_to, to);
  1421.       else
  1422.     convert_move (real_to, to, 0);
  1423.     }
  1424. }
  1425.  
  1426. /* expand_fix: generate code to convert FROM to fixed point
  1427.    and store in TO.  FROM must be floating point.  */
  1428.  
  1429. static rtx
  1430. ftruncify (x)
  1431.      rtx x;
  1432. {
  1433.   rtx temp = gen_reg_rtx (GET_MODE (x));
  1434.   return expand_unop (GET_MODE (x), ftrunc_optab, x, temp, 0);
  1435. }
  1436.  
  1437. void
  1438. expand_fix (to, from, unsignedp)
  1439.      register rtx to, from;
  1440.      int unsignedp;
  1441. {
  1442.   enum insn_code icode;
  1443.   register rtx target;
  1444.   int must_trunc = 0;
  1445.  
  1446.   while (1)
  1447.     {
  1448.       icode = can_fix_p (GET_MODE (to), GET_MODE (from), unsignedp, &must_trunc);
  1449.       if (icode != CODE_FOR_nothing)
  1450.     {
  1451.       if (must_trunc)
  1452.         from = ftruncify (from);
  1453.  
  1454.       emit_unop_insn (icode, to, from, FIX);
  1455.       return;
  1456.     }
  1457.  
  1458. #if 0  /* Turned off.  It fails because the positive numbers
  1459.       that become temporarily negative are rounded up instead of down.  */
  1460.  
  1461.       /* If no insns for unsigned conversion,
  1462.      we can go via a signed number.
  1463.      But make sure we won't overflow in the compiler.  */
  1464.       if (unsignedp && GET_MODE_BITSIZE (GET_MODE (to)) <= HOST_BITS_PER_INT
  1465.       /* Make sure we won't lose significant bits doing this.  */
  1466.       && GET_MODE_BITSIZE (GET_MODE (from)) > GET_MODE_BITSIZE (GET_MODE (to)))
  1467.     {
  1468.       icode = can_fix_p (GET_MODE (to), GET_MODE (from),
  1469.                  0, &must_trunc);
  1470.  
  1471.       if (icode != CODE_FOR_nothing)
  1472.         {
  1473.           REAL_VALUE_TYPE offset;
  1474.           rtx temp, temp1;
  1475.           int bitsize = GET_MODE_BITSIZE (GET_MODE (to));
  1476.  
  1477.           if (must_trunc)
  1478.         from = ftruncify (from);
  1479.  
  1480.           /* Subtract 2**(N-1), convert to signed number,
  1481.          then add 2**(N-1).  */
  1482.           offset = REAL_VALUE_LDEXP (1.0, bitsize - 1);
  1483.           temp = expand_binop (GET_MODE (from), sub_optab, from,
  1484.                    immed_real_const_1 (offset, GET_MODE (from)),
  1485.                    0, 0, OPTAB_LIB_WIDEN);
  1486.  
  1487.           temp1 = gen_reg_rtx (GET_MODE (to));
  1488.           emit_unop_insn (icode, temp1, temp, FIX);
  1489.           temp = expand_binop (GET_MODE (to), add_optab, temp1,
  1490.                    gen_rtx (CONST_INT, VOIDmode,
  1491.                         1 << (bitsize - 1)),
  1492.                    to, 1, OPTAB_LIB_WIDEN);
  1493.           if (temp != to)
  1494.         emit_move_insn (to, temp);
  1495.           return;
  1496.         }
  1497.     }
  1498. #endif
  1499.       icode = can_fix_p (DImode, GET_MODE (from), unsignedp, &must_trunc);
  1500.  
  1501.       if (GET_MODE (to) != DImode && icode != CODE_FOR_nothing)
  1502.     {
  1503.       register rtx temp = gen_reg_rtx (DImode);
  1504.  
  1505.       if (must_trunc)
  1506.         from = ftruncify (from);
  1507.       emit_unop_insn (icode, temp, from, FIX);
  1508.       convert_move (to, temp, unsignedp);
  1509.       return;
  1510.     }
  1511.  
  1512. #ifdef APPLE_C
  1513.       /* If FROM is not XFmode, convert to XFmode and try again from there.  */
  1514.       if (GET_MODE (from) == XFmode)
  1515.     break;
  1516.  
  1517.       from = convert_to_mode (XFmode, from, 0);
  1518. #else
  1519.       /* If FROM is not DFmode, convert to DFmode and try again from there.  */
  1520.       if (GET_MODE (from) == DFmode)
  1521.     break;
  1522.  
  1523.       from = convert_to_mode (DFmode, from, 0);
  1524. #endif /* APPLE_C */
  1525.     }
  1526.  
  1527.   /* We can't do it with an insn, so use a library call.
  1528.      The mode of FROM is known to be DFmode.  */
  1529.  
  1530.   to = protect_from_queue (to, 1);
  1531.   from = protect_from_queue (from, 0);
  1532.  
  1533.   if (flag_force_mem)
  1534.     from = force_not_mem (from);
  1535.  
  1536.   if (GET_MODE (to) != DImode)
  1537.     {
  1538.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1539.                   unsignedp ? "__fixunsdfsi"
  1540.                   : "__fixdfsi"),
  1541.              0, SImode, 1, from, DFmode);
  1542.       target = hard_libcall_value (SImode);
  1543.     }
  1544.   else
  1545.     {
  1546.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1547.                   unsignedp ? "__fixunsdfdi"
  1548.                   : "__fixdfdi"),
  1549.              0, DImode, 1, from, DFmode);
  1550.       target = hard_libcall_value (DImode);
  1551.     }
  1552.  
  1553.   if (GET_MODE (to) == GET_MODE (target))
  1554.     emit_move_insn (to, target);
  1555.   else
  1556.     convert_move (to, target, 0);
  1557. }
  1558.  
  1559. static optab
  1560. init_optab (code)
  1561.      enum rtx_code code;
  1562. {
  1563.   int i;
  1564.   optab op = (optab) malloc (sizeof (struct optab));
  1565.   op->code = code;
  1566.   for (i = 0; i < NUM_MACHINE_MODES; i++)
  1567.     {
  1568.       op->handlers[i].insn_code = CODE_FOR_nothing;
  1569.       op->handlers[i].lib_call = 0;
  1570.     }
  1571.   return op;
  1572. }
  1573.  
  1574. /* Call this once to initialize the contents of the optabs
  1575.    appropriately for the current target machine.  */
  1576.  
  1577. void
  1578. init_optabs ()
  1579. {
  1580.   init_fixtab ();
  1581.   init_floattab ();
  1582.   init_comparisons ();
  1583. /*  init_extends (); */
  1584.  
  1585.   add_optab = init_optab (PLUS);
  1586.   sub_optab = init_optab (MINUS);
  1587.   smul_optab = init_optab (MULT);
  1588.   umul_optab = init_optab (UMULT);
  1589.   smul_widen_optab = init_optab (MULT);
  1590.   umul_widen_optab = init_optab (UMULT);
  1591.   sdiv_optab = init_optab (DIV);
  1592.   sdivmod_optab = init_optab (UNKNOWN);
  1593.   udiv_optab = init_optab (UDIV);
  1594.   udivmod_optab = init_optab (UNKNOWN);
  1595.   smod_optab = init_optab (MOD);
  1596.   umod_optab = init_optab (UMOD);
  1597.   flodiv_optab = init_optab (DIV);
  1598.   ftrunc_optab = init_optab (UNKNOWN);
  1599.   and_optab = init_optab (AND);
  1600.   andcb_optab = init_optab (UNKNOWN);
  1601.   ior_optab = init_optab (IOR);
  1602.   xor_optab = init_optab (XOR);
  1603.   ashl_optab = init_optab (ASHIFT);
  1604.   ashr_optab = init_optab (ASHIFTRT);
  1605.   lshl_optab = init_optab (LSHIFT);
  1606.   lshr_optab = init_optab (LSHIFTRT);
  1607.   rotl_optab = init_optab (ROTATE);
  1608.   rotr_optab = init_optab (ROTATERT);
  1609.   mov_optab = init_optab (UNKNOWN);
  1610.   movstrict_optab = init_optab (UNKNOWN);
  1611.   cmp_optab = init_optab (UNKNOWN);
  1612.   ucmp_optab = init_optab (UNKNOWN);
  1613.   tst_optab = init_optab (UNKNOWN);
  1614.   neg_optab = init_optab (NEG);
  1615.   abs_optab = init_optab (ABS);
  1616.   one_cmpl_optab = init_optab (NOT);
  1617.   ffs_optab = init_optab (FFS);
  1618. #ifdef APPLE_C
  1619.   /* Initialize the (possibly unused) optabs for elementary functions. */
  1620.   sin_optab = init_optab (SIN);
  1621.   cos_optab = init_optab (COS);
  1622.   tan_optab = init_optab (TAN);
  1623.   asin_optab = init_optab (ASIN);
  1624.   acos_optab = init_optab (ACOS);
  1625.   atan_optab = init_optab (ATAN);
  1626.   sinh_optab = init_optab (SINH);
  1627.   cosh_optab = init_optab (COSH);
  1628.   tanh_optab = init_optab (TANH);
  1629.   exp_optab = init_optab (EXP);
  1630.   log_optab = init_optab (LOG);
  1631.   log10_optab = init_optab (LOG10);
  1632.   sqrt_optab = init_optab (SQRT);
  1633. #endif /* APPLE_C */
  1634.  
  1635. #ifdef HAVE_addqi3
  1636.   if (HAVE_addqi3)
  1637.     add_optab->handlers[(int) QImode].insn_code = CODE_FOR_addqi3;
  1638. #endif
  1639. #ifdef HAVE_addhi3
  1640.   if (HAVE_addhi3)
  1641.     add_optab->handlers[(int) HImode].insn_code = CODE_FOR_addhi3;
  1642. #endif
  1643. #ifdef HAVE_addsi3
  1644.   if (HAVE_addsi3)
  1645.     add_optab->handlers[(int) SImode].insn_code = CODE_FOR_addsi3;
  1646. #endif
  1647. #ifdef HAVE_adddi3
  1648.   if (HAVE_adddi3)
  1649.     add_optab->handlers[(int) DImode].insn_code = CODE_FOR_adddi3;
  1650. #endif
  1651. #ifdef HAVE_addsf3
  1652.   if (HAVE_addsf3)
  1653.     add_optab->handlers[(int) SFmode].insn_code = CODE_FOR_addsf3;
  1654. #endif
  1655. #ifdef HAVE_adddf3
  1656.   if (HAVE_adddf3)
  1657.     add_optab->handlers[(int) DFmode].insn_code = CODE_FOR_adddf3;
  1658. #endif
  1659.   add_optab->handlers[(int) DImode].lib_call = "__adddi3";
  1660.   add_optab->handlers[(int) SFmode].lib_call = "__addsf3";
  1661.   add_optab->handlers[(int) DFmode].lib_call = "__adddf3";
  1662. #ifdef APPLE_HAX
  1663.   /* Code generation table entries for extended float arithmetic. */
  1664. #ifdef HAVE_addxf3
  1665.   if (HAVE_addxf3)
  1666.     add_optab->handlers[(int) XFmode].insn_code = CODE_FOR_addxf3;
  1667. #endif
  1668.   add_optab->handlers[(int) XFmode].lib_call = "__addxf3";
  1669. #endif /* APPLE_HAX */
  1670.  
  1671. #ifdef HAVE_subqi3
  1672.   if (HAVE_subqi3)
  1673.     sub_optab->handlers[(int) QImode].insn_code = CODE_FOR_subqi3;
  1674. #endif
  1675. #ifdef HAVE_subhi3
  1676.   if (HAVE_subhi3)
  1677.     sub_optab->handlers[(int) HImode].insn_code = CODE_FOR_subhi3;
  1678. #endif
  1679. #ifdef HAVE_subsi3
  1680.   if (HAVE_subsi3)
  1681.     sub_optab->handlers[(int) SImode].insn_code = CODE_FOR_subsi3;
  1682. #endif
  1683. #ifdef HAVE_subdi3
  1684.   if (HAVE_subdi3)
  1685.     sub_optab->handlers[(int) DImode].insn_code = CODE_FOR_subdi3;
  1686. #endif
  1687. #ifdef HAVE_subsf3
  1688.   if (HAVE_subsf3)
  1689.     sub_optab->handlers[(int) SFmode].insn_code = CODE_FOR_subsf3;
  1690. #endif
  1691. #ifdef HAVE_subdf3
  1692.   if (HAVE_subdf3)
  1693.     sub_optab->handlers[(int) DFmode].insn_code = CODE_FOR_subdf3;
  1694. #endif
  1695.   sub_optab->handlers[(int) DImode].lib_call = "__subdi3";
  1696.   sub_optab->handlers[(int) SFmode].lib_call = "__subsf3";
  1697.   sub_optab->handlers[(int) DFmode].lib_call = "__subdf3";
  1698. #ifdef APPLE_HAX
  1699.   /* Code generation table entries for extended float arithmetic. */
  1700. #ifdef HAVE_subxf3
  1701.   if (HAVE_subxf3)
  1702.     sub_optab->handlers[(int) XFmode].insn_code = CODE_FOR_subxf3;
  1703. #endif
  1704.   sub_optab->handlers[(int) XFmode].lib_call = "__subxf3";
  1705. #endif /* APPLE_HAX */
  1706.  
  1707. #ifdef HAVE_mulqi3
  1708.   if (HAVE_mulqi3)
  1709.     smul_optab->handlers[(int) QImode].insn_code = CODE_FOR_mulqi3;
  1710. #endif
  1711. #ifdef HAVE_mulhi3
  1712.   if (HAVE_mulhi3)
  1713.     smul_optab->handlers[(int) HImode].insn_code = CODE_FOR_mulhi3;
  1714. #endif
  1715. #ifdef HAVE_mulsi3
  1716.   if (HAVE_mulsi3)
  1717.     smul_optab->handlers[(int) SImode].insn_code = CODE_FOR_mulsi3;
  1718. #endif
  1719. #ifdef HAVE_muldi3
  1720.   if (HAVE_muldi3)
  1721.     smul_optab->handlers[(int) DImode].insn_code = CODE_FOR_muldi3;
  1722. #endif
  1723. #ifdef HAVE_mulsf3
  1724.   if (HAVE_mulsf3)
  1725.     smul_optab->handlers[(int) SFmode].insn_code = CODE_FOR_mulsf3;
  1726. #endif
  1727. #ifdef HAVE_muldf3
  1728.   if (HAVE_muldf3)
  1729.     smul_optab->handlers[(int) DFmode].insn_code = CODE_FOR_muldf3;
  1730. #endif
  1731.  
  1732. #ifdef MULSI3_LIBCALL
  1733.   smul_optab->handlers[(int) SImode].lib_call = MULSI3_LIBCALL;
  1734. #else
  1735.   smul_optab->handlers[(int) SImode].lib_call = "__mulsi3";
  1736. #endif
  1737.   smul_optab->handlers[(int) DImode].lib_call = "__muldi3";
  1738.   smul_optab->handlers[(int) SFmode].lib_call = "__mulsf3";
  1739.   smul_optab->handlers[(int) DFmode].lib_call = "__muldf3";
  1740. #ifdef APPLE_HAX
  1741.   /* Code generation table entries for extended float arithmetic. */
  1742. #ifdef HAVE_mulxf3
  1743.   if (HAVE_mulxf3)
  1744.     smul_optab->handlers[(int) XFmode].insn_code = CODE_FOR_mulxf3;
  1745. #endif
  1746.   smul_optab->handlers[(int) XFmode].lib_call = "__mulxf3";
  1747. #endif /* APPLE_HAX */
  1748.  
  1749. #ifdef HAVE_mulqihi3
  1750.   if (HAVE_mulqihi3)
  1751.     smul_widen_optab->handlers[(int) HImode].insn_code = CODE_FOR_mulqihi3;
  1752. #endif
  1753. #ifdef HAVE_mulhisi3
  1754.   if (HAVE_mulhisi3)
  1755.     smul_widen_optab->handlers[(int) SImode].insn_code = CODE_FOR_mulhisi3;
  1756. #endif
  1757. #ifdef HAVE_mulsidi3
  1758.   if (HAVE_mulsidi3)
  1759.     smul_widen_optab->handlers[(int) DImode].insn_code = CODE_FOR_mulsidi3;
  1760. #endif
  1761.  
  1762. #ifdef HAVE_umulqi3
  1763.   if (HAVE_umulqi3)
  1764.     umul_optab->handlers[(int) QImode].insn_code = CODE_FOR_umulqi3;
  1765. #endif
  1766. #ifdef HAVE_umulhi3
  1767.   if (HAVE_umulhi3)
  1768.     umul_optab->handlers[(int) HImode].insn_code = CODE_FOR_umulhi3;
  1769. #endif
  1770. #ifdef HAVE_umulsi3
  1771.   if (HAVE_umulsi3)
  1772.     umul_optab->handlers[(int) SImode].insn_code = CODE_FOR_umulsi3;
  1773. #endif
  1774. #ifdef HAVE_umuldi3
  1775.   if (HAVE_umuldi3)
  1776.     umul_optab->handlers[(int) DImode].insn_code = CODE_FOR_umuldi3;
  1777. #endif
  1778. #ifdef HAVE_umulsf3
  1779.   if (HAVE_umulsf3)
  1780.     umul_optab->handlers[(int) SFmode].insn_code = CODE_FOR_umulsf3;
  1781. #endif
  1782. #ifdef HAVE_umuldf3
  1783.   if (HAVE_umuldf3)
  1784.     umul_optab->handlers[(int) DFmode].insn_code = CODE_FOR_umuldf3;
  1785. #endif
  1786.  
  1787. #ifdef UMULSI3_LIBCALL
  1788.   umul_optab->handlers[(int) SImode].lib_call = UMULSI3_LIBCALL;
  1789. #else
  1790.   umul_optab->handlers[(int) SImode].lib_call = "__umulsi3";
  1791. #endif
  1792.   umul_optab->handlers[(int) DImode].lib_call = "__umuldi3";
  1793.   umul_optab->handlers[(int) SFmode].lib_call = "__umulsf3";
  1794.   umul_optab->handlers[(int) DFmode].lib_call = "__umuldf3";
  1795. #ifdef APPLE_HAX
  1796.   /* Code generation table entries for extended float arithmetic. */
  1797. #ifdef HAVE_umulxf3
  1798.   if (HAVE_umulxf3)
  1799.     umul_optab->handlers[(int) XFmode].insn_code = CODE_FOR_umulxf3;
  1800. #endif
  1801.   umul_optab->handlers[(int) XFmode].lib_call = "__umulxf3";
  1802. #endif /* APPLE_HAX */
  1803.  
  1804. #ifdef HAVE_umulqihi3
  1805.   if (HAVE_umulqihi3)
  1806.     umul_widen_optab->handlers[(int) HImode].insn_code = CODE_FOR_umulqihi3;
  1807. #endif
  1808. #ifdef HAVE_umulhisi3
  1809.   if (HAVE_umulhisi3)
  1810.     umul_widen_optab->handlers[(int) SImode].insn_code = CODE_FOR_umulhisi3;
  1811. #endif
  1812. #ifdef HAVE_umulsidi3
  1813.   if (HAVE_umulsidi3)
  1814.     umul_widen_optab->handlers[(int) DImode].insn_code = CODE_FOR_umulsidi3;
  1815. #endif
  1816.  
  1817. #ifdef HAVE_divqi3
  1818.   if (HAVE_divqi3)
  1819.     sdiv_optab->handlers[(int) QImode].insn_code = CODE_FOR_divqi3;
  1820. #endif
  1821. #ifdef HAVE_divhi3
  1822.   if (HAVE_divhi3)
  1823.     sdiv_optab->handlers[(int) HImode].insn_code = CODE_FOR_divhi3;
  1824. #endif
  1825. #ifdef HAVE_divsi3
  1826.   if (HAVE_divsi3)
  1827.     sdiv_optab->handlers[(int) SImode].insn_code = CODE_FOR_divsi3;
  1828. #endif
  1829. #ifdef HAVE_divdi3
  1830.   if (HAVE_divdi3)
  1831.     sdiv_optab->handlers[(int) DImode].insn_code = CODE_FOR_divdi3;
  1832. #endif
  1833.  
  1834. #ifdef DIVSI3_LIBCALL
  1835.   sdiv_optab->handlers[(int) SImode].lib_call = DIVSI3_LIBCALL;
  1836. #else
  1837.   sdiv_optab->handlers[(int) SImode].lib_call = "__divsi3";
  1838. #endif
  1839.   sdiv_optab->handlers[(int) DImode].lib_call = "__divdi3";
  1840.  
  1841. #ifdef HAVE_udivqi3
  1842.   if (HAVE_udivqi3)
  1843.     udiv_optab->handlers[(int) QImode].insn_code = CODE_FOR_udivqi3;
  1844. #endif
  1845. #ifdef HAVE_udivhi3
  1846.   if (HAVE_udivhi3)
  1847.     udiv_optab->handlers[(int) HImode].insn_code = CODE_FOR_udivhi3;
  1848. #endif
  1849. #ifdef HAVE_udivsi3
  1850.   if (HAVE_udivsi3)
  1851.     udiv_optab->handlers[(int) SImode].insn_code = CODE_FOR_udivsi3;
  1852. #endif
  1853. #ifdef HAVE_udivdi3
  1854.   if (HAVE_udivdi3)
  1855.     udiv_optab->handlers[(int) DImode].insn_code = CODE_FOR_udivdi3;
  1856. #endif
  1857.  
  1858. #ifdef UDIVSI3_LIBCALL
  1859.   udiv_optab->handlers[(int) SImode].lib_call = UDIVSI3_LIBCALL;
  1860. #else
  1861.   udiv_optab->handlers[(int) SImode].lib_call = "__udivsi3";
  1862. #endif
  1863.   udiv_optab->handlers[(int) DImode].lib_call = "__udivdi3";
  1864.  
  1865. #ifdef HAVE_divmodqi4
  1866.   if (HAVE_divmodqi4)
  1867.     sdivmod_optab->handlers[(int) QImode].insn_code = CODE_FOR_divmodqi4;
  1868. #endif
  1869. #ifdef HAVE_divmodhi4
  1870.   if (HAVE_divmodhi4)
  1871.     sdivmod_optab->handlers[(int) HImode].insn_code = CODE_FOR_divmodhi4;
  1872. #endif
  1873. #ifdef HAVE_divmodsi4
  1874.   if (HAVE_divmodsi4)
  1875.     sdivmod_optab->handlers[(int) SImode].insn_code = CODE_FOR_divmodsi4;
  1876. #endif
  1877. #ifdef HAVE_divmoddi4
  1878.   if (HAVE_divmoddi4)
  1879.     sdivmod_optab->handlers[(int) DImode].insn_code = CODE_FOR_divmoddi4;
  1880. #endif
  1881.  
  1882. #ifdef HAVE_udivmodqi4
  1883.   if (HAVE_udivmodqi4)
  1884.     udivmod_optab->handlers[(int) QImode].insn_code = CODE_FOR_udivmodqi4;
  1885. #endif
  1886. #ifdef HAVE_udivmodhi4
  1887.   if (HAVE_udivmodhi4)
  1888.     udivmod_optab->handlers[(int) HImode].insn_code = CODE_FOR_udivmodhi4;
  1889. #endif
  1890. #ifdef HAVE_udivmodsi4
  1891.   if (HAVE_udivmodsi4)
  1892.     udivmod_optab->handlers[(int) SImode].insn_code = CODE_FOR_udivmodsi4;
  1893. #endif
  1894. #ifdef HAVE_udivmoddi4
  1895.   if (HAVE_udivmoddi4)
  1896.     udivmod_optab->handlers[(int) DImode].insn_code = CODE_FOR_udivmoddi4;
  1897. #endif
  1898.  
  1899. #ifdef HAVE_modqi3
  1900.   if (HAVE_modqi3)
  1901.     smod_optab->handlers[(int) QImode].insn_code = CODE_FOR_modqi3;
  1902. #endif
  1903. #ifdef HAVE_modhi3
  1904.   if (HAVE_modhi3)
  1905.     smod_optab->handlers[(int) HImode].insn_code = CODE_FOR_modhi3;
  1906. #endif
  1907. #ifdef HAVE_modsi3
  1908.   if (HAVE_modsi3)
  1909.     smod_optab->handlers[(int) SImode].insn_code = CODE_FOR_modsi3;
  1910. #endif
  1911. #ifdef HAVE_moddi3
  1912.   if (HAVE_moddi3)
  1913.     smod_optab->handlers[(int) DImode].insn_code = CODE_FOR_moddi3;
  1914. #endif
  1915.  
  1916. #ifdef MODSI3_LIBCALL
  1917.   smod_optab->handlers[(int) SImode].lib_call = MODSI3_LIBCALL;
  1918. #else
  1919.   smod_optab->handlers[(int) SImode].lib_call = "__modsi3";
  1920. #endif
  1921.   smod_optab->handlers[(int) DImode].lib_call = "__moddi3";
  1922.  
  1923. #ifdef HAVE_umodqi3
  1924.   if (HAVE_umodqi3)
  1925.     umod_optab->handlers[(int) QImode].insn_code = CODE_FOR_umodqi3;
  1926. #endif
  1927. #ifdef HAVE_umodhi3
  1928.   if (HAVE_umodhi3)
  1929.     umod_optab->handlers[(int) HImode].insn_code = CODE_FOR_umodhi3;
  1930. #endif
  1931. #ifdef HAVE_umodsi3
  1932.   if (HAVE_umodsi3)
  1933.     umod_optab->handlers[(int) SImode].insn_code = CODE_FOR_umodsi3;
  1934. #endif
  1935. #ifdef HAVE_umoddi3
  1936.   if (HAVE_umoddi3)
  1937.     umod_optab->handlers[(int) DImode].insn_code = CODE_FOR_umoddi3;
  1938. #endif
  1939.  
  1940. #ifdef UMODSI3_LIBCALL
  1941.   umod_optab->handlers[(int) SImode].lib_call = UMODSI3_LIBCALL;
  1942. #else
  1943.   umod_optab->handlers[(int) SImode].lib_call = "__umodsi3";
  1944. #endif
  1945.   umod_optab->handlers[(int) DImode].lib_call = "__umoddi3";
  1946.  
  1947. #ifdef HAVE_divsf3
  1948.   if (HAVE_divsf3)
  1949.     flodiv_optab->handlers[(int) SFmode].insn_code = CODE_FOR_divsf3;
  1950. #endif
  1951. #ifdef HAVE_divdf3
  1952.   if (HAVE_divdf3)
  1953.     flodiv_optab->handlers[(int) DFmode].insn_code = CODE_FOR_divdf3;
  1954. #endif
  1955.   flodiv_optab->handlers[(int) SFmode].lib_call = "__divsf3";
  1956.   flodiv_optab->handlers[(int) DFmode].lib_call = "__divdf3";
  1957. #ifdef APPLE_HAX
  1958.   /* Code generation table entries for extended float arithmetic. */
  1959. #ifdef HAVE_divxf3
  1960.   if (HAVE_divxf3)
  1961.     flodiv_optab->handlers[(int) XFmode].insn_code = CODE_FOR_divxf3;
  1962. #endif
  1963.   flodiv_optab->handlers[(int) XFmode].lib_call = "__divxf3";
  1964. #endif /* APPLE_HAX */
  1965.  
  1966. #ifdef HAVE_ftruncsf2
  1967.   if (HAVE_ftruncsf2)
  1968.     ftrunc_optab->handlers[(int) SFmode].insn_code = CODE_FOR_ftruncsf2;
  1969. #endif
  1970. #ifdef HAVE_ftruncdf2
  1971.   if (HAVE_ftruncdf2)
  1972.     ftrunc_optab->handlers[(int) DFmode].insn_code = CODE_FOR_ftruncdf2;
  1973. #endif
  1974. #ifdef APPLE_HAX
  1975.   /* Code generation table entries for extended float arithmetic. */
  1976. #ifdef HAVE_ftruncxf2
  1977.   if (HAVE_ftruncxf2)
  1978.     ftrunc_optab->handlers[(int) XFmode].insn_code = CODE_FOR_ftruncxf2;
  1979. #endif
  1980. #endif /* APPLE_HAX */
  1981.  
  1982. #ifdef HAVE_andqi3
  1983.   if (HAVE_andqi3)
  1984.     and_optab->handlers[(int) QImode].insn_code = CODE_FOR_andqi3;
  1985. #endif
  1986. #ifdef HAVE_andhi3
  1987.   if (HAVE_andhi3)
  1988.     and_optab->handlers[(int) HImode].insn_code = CODE_FOR_andhi3;
  1989. #endif
  1990. #ifdef HAVE_andsi3
  1991.   if (HAVE_andsi3)
  1992.     and_optab->handlers[(int) SImode].insn_code = CODE_FOR_andsi3;
  1993. #endif
  1994. #ifdef HAVE_anddi3
  1995.   if (HAVE_anddi3)
  1996.     and_optab->handlers[(int) DImode].insn_code = CODE_FOR_anddi3;
  1997. #endif
  1998.   and_optab->handlers[(int) DImode].lib_call = "__anddi3";
  1999.  
  2000. #ifdef HAVE_andcbqi3
  2001.   if (HAVE_andcbqi3)
  2002.     andcb_optab->handlers[(int) QImode].insn_code = CODE_FOR_andcbqi3;
  2003. #endif
  2004. #ifdef HAVE_andcbhi3
  2005.   if (HAVE_andcbhi3)
  2006.     andcb_optab->handlers[(int) HImode].insn_code = CODE_FOR_andcbhi3;
  2007. #endif
  2008. #ifdef HAVE_andcbsi3
  2009.   if (HAVE_andcbsi3)
  2010.     andcb_optab->handlers[(int) SImode].insn_code = CODE_FOR_andcbsi3;
  2011. #endif
  2012. #ifdef HAVE_andcbdi3
  2013.   if (HAVE_andcbdi3)
  2014.     andcb_optab->handlers[(int) DImode].insn_code = CODE_FOR_andcbdi3;
  2015. #endif
  2016.   andcb_optab->handlers[(int) DImode].lib_call = "__andcbdi3";
  2017.  
  2018. #ifdef HAVE_iorqi3
  2019.   if (HAVE_iorqi3)
  2020.     ior_optab->handlers[(int) QImode].insn_code = CODE_FOR_iorqi3;
  2021. #endif
  2022. #ifdef HAVE_iorhi3
  2023.   if (HAVE_iorhi3)
  2024.     ior_optab->handlers[(int) HImode].insn_code = CODE_FOR_iorhi3;
  2025. #endif
  2026. #ifdef HAVE_iorsi3
  2027.   if (HAVE_iorsi3)
  2028.     ior_optab->handlers[(int) SImode].insn_code = CODE_FOR_iorsi3;
  2029. #endif
  2030. #ifdef HAVE_iordi3
  2031.   if (HAVE_iordi3)
  2032.     ior_optab->handlers[(int) DImode].insn_code = CODE_FOR_iordi3;
  2033. #endif
  2034.   ior_optab->handlers[(int) DImode].lib_call = "__iordi3";
  2035.  
  2036. #ifdef HAVE_xorqi3
  2037.   if (HAVE_xorqi3)
  2038.     xor_optab->handlers[(int) QImode].insn_code = CODE_FOR_xorqi3;
  2039. #endif
  2040. #ifdef HAVE_xorhi3
  2041.   if (HAVE_xorhi3)
  2042.     xor_optab->handlers[(int) HImode].insn_code = CODE_FOR_xorhi3;
  2043. #endif
  2044. #ifdef HAVE_xorsi3
  2045.   if (HAVE_xorsi3)
  2046.     xor_optab->handlers[(int) SImode].insn_code = CODE_FOR_xorsi3;
  2047. #endif
  2048. #ifdef HAVE_xordi3
  2049.   if (HAVE_xordi3)
  2050.     xor_optab->handlers[(int) DImode].insn_code = CODE_FOR_xordi3;
  2051. #endif
  2052.   xor_optab->handlers[(int) DImode].lib_call = "__xordi3";
  2053.  
  2054. #ifdef HAVE_ashlqi3
  2055.   if (HAVE_ashlqi3)
  2056.     ashl_optab->handlers[(int) QImode].insn_code = CODE_FOR_ashlqi3;
  2057. #endif
  2058. #ifdef HAVE_ashlhi3
  2059.   if (HAVE_ashlhi3)
  2060.     ashl_optab->handlers[(int) HImode].insn_code = CODE_FOR_ashlhi3;
  2061. #endif
  2062. #ifdef HAVE_ashlsi3
  2063.   if (HAVE_ashlsi3)
  2064.     ashl_optab->handlers[(int) SImode].insn_code = CODE_FOR_ashlsi3;
  2065. #endif
  2066. #ifdef HAVE_ashldi3
  2067.   if (HAVE_ashldi3)
  2068.     ashl_optab->handlers[(int) DImode].insn_code = CODE_FOR_ashldi3;
  2069. #endif
  2070.   ashl_optab->handlers[(int) SImode].lib_call = "__ashlsi3";
  2071.   ashl_optab->handlers[(int) DImode].lib_call = "__ashldi3";
  2072.  
  2073. #ifdef HAVE_ashrqi3
  2074.   if (HAVE_ashrqi3)
  2075.     ashr_optab->handlers[(int) QImode].insn_code = CODE_FOR_ashrqi3;
  2076. #endif
  2077. #ifdef HAVE_ashrhi3
  2078.   if (HAVE_ashrhi3)
  2079.     ashr_optab->handlers[(int) HImode].insn_code = CODE_FOR_ashrhi3;
  2080. #endif
  2081. #ifdef HAVE_ashrsi3
  2082.   if (HAVE_ashrsi3)
  2083.     ashr_optab->handlers[(int) SImode].insn_code = CODE_FOR_ashrsi3;
  2084. #endif
  2085. #ifdef HAVE_ashrdi3
  2086.   if (HAVE_ashrdi3)
  2087.     ashr_optab->handlers[(int) DImode].insn_code = CODE_FOR_ashrdi3;
  2088. #endif
  2089.   ashr_optab->handlers[(int) SImode].lib_call = "__ashrsi3";
  2090.   ashr_optab->handlers[(int) DImode].lib_call = "__ashrdi3";
  2091.  
  2092. #ifdef HAVE_lshlqi3
  2093.   if (HAVE_lshlqi3)
  2094.     lshl_optab->handlers[(int) QImode].insn_code = CODE_FOR_lshlqi3;
  2095. #endif
  2096. #ifdef HAVE_lshlhi3
  2097.   if (HAVE_lshlhi3)
  2098.     lshl_optab->handlers[(int) HImode].insn_code = CODE_FOR_lshlhi3;
  2099. #endif
  2100. #ifdef HAVE_lshlsi3
  2101.   if (HAVE_lshlsi3)
  2102.     lshl_optab->handlers[(int) SImode].insn_code = CODE_FOR_lshlsi3;
  2103. #endif
  2104. #ifdef HAVE_lshldi3
  2105.   if (HAVE_lshldi3)
  2106.     lshl_optab->handlers[(int) DImode].insn_code = CODE_FOR_lshldi3;
  2107. #endif
  2108.   lshl_optab->handlers[(int) SImode].lib_call = "__lshlsi3";
  2109.   lshl_optab->handlers[(int) DImode].lib_call = "__lshldi3";
  2110.  
  2111. #ifdef HAVE_lshrqi3
  2112.   if (HAVE_lshrqi3)
  2113.     lshr_optab->handlers[(int) QImode].insn_code = CODE_FOR_lshrqi3;
  2114. #endif
  2115. #ifdef HAVE_lshrhi3
  2116.   if (HAVE_lshrhi3)
  2117.     lshr_optab->handlers[(int) HImode].insn_code = CODE_FOR_lshrhi3;
  2118. #endif
  2119. #ifdef HAVE_lshrsi3
  2120.   if (HAVE_lshrsi3)
  2121.     lshr_optab->handlers[(int) SImode].insn_code = CODE_FOR_lshrsi3;
  2122. #endif
  2123. #ifdef HAVE_lshrdi3
  2124.   if (HAVE_lshrdi3)
  2125.     lshr_optab->handlers[(int) DImode].insn_code = CODE_FOR_lshrdi3;
  2126. #endif
  2127.   lshr_optab->handlers[(int) SImode].lib_call = "__lshrsi3";
  2128.   lshr_optab->handlers[(int) DImode].lib_call = "__lshrdi3";
  2129.  
  2130. #ifdef HAVE_rotlqi3
  2131.   if (HAVE_rotlqi3)
  2132.     rotl_optab->handlers[(int) QImode].insn_code = CODE_FOR_rotlqi3;
  2133. #endif
  2134. #ifdef HAVE_rotlhi3
  2135.   if (HAVE_rotlhi3)
  2136.     rotl_optab->handlers[(int) HImode].insn_code = CODE_FOR_rotlhi3;
  2137. #endif
  2138. #ifdef HAVE_rotlsi3
  2139.   if (HAVE_rotlsi3)
  2140.     rotl_optab->handlers[(int) SImode].insn_code = CODE_FOR_rotlsi3;
  2141. #endif
  2142. #ifdef HAVE_rotldi3
  2143.   if (HAVE_rotldi3)
  2144.     rotl_optab->handlers[(int) DImode].insn_code = CODE_FOR_rotldi3;
  2145. #endif
  2146.   rotl_optab->handlers[(int) SImode].lib_call = "__rotlsi3";
  2147.   rotl_optab->handlers[(int) DImode].lib_call = "__rotldi3";
  2148.  
  2149. #ifdef HAVE_rotrqi3
  2150.   if (HAVE_rotrqi3)
  2151.     rotr_optab->handlers[(int) QImode].insn_code = CODE_FOR_rotrqi3;
  2152. #endif
  2153. #ifdef HAVE_rotrhi3
  2154.   if (HAVE_rotrhi3)
  2155.     rotr_optab->handlers[(int) HImode].insn_code = CODE_FOR_rotrhi3;
  2156. #endif
  2157. #ifdef HAVE_rotrsi3
  2158.   if (HAVE_rotrsi3)
  2159.     rotr_optab->handlers[(int) SImode].insn_code = CODE_FOR_rotrsi3;
  2160. #endif
  2161. #ifdef HAVE_rotrdi3
  2162.   if (HAVE_rotrdi3)
  2163.     rotr_optab->handlers[(int) DImode].insn_code = CODE_FOR_rotrdi3;
  2164. #endif
  2165.   rotr_optab->handlers[(int) SImode].lib_call = "__rotrsi3";
  2166.   rotr_optab->handlers[(int) DImode].lib_call = "__rotrdi3";
  2167.  
  2168. #ifdef HAVE_negqi2
  2169.   if (HAVE_negqi2)
  2170.     neg_optab->handlers[(int) QImode].insn_code = CODE_FOR_negqi2;
  2171. #endif
  2172. #ifdef HAVE_neghi2
  2173.   if (HAVE_neghi2)
  2174.     neg_optab->handlers[(int) HImode].insn_code = CODE_FOR_neghi2;
  2175. #endif
  2176. #ifdef HAVE_negsi2
  2177.   if (HAVE_negsi2)
  2178.     neg_optab->handlers[(int) SImode].insn_code = CODE_FOR_negsi2;
  2179. #endif
  2180. #ifdef HAVE_negdi2
  2181.   if (HAVE_negdi2)
  2182.     neg_optab->handlers[(int) DImode].insn_code = CODE_FOR_negdi2;
  2183. #endif
  2184. #ifdef HAVE_negsf2
  2185.   if (HAVE_negsf2)
  2186.     neg_optab->handlers[(int) SFmode].insn_code = CODE_FOR_negsf2;
  2187. #endif
  2188. #ifdef HAVE_negdf2
  2189.   if (HAVE_negdf2)
  2190.     neg_optab->handlers[(int) DFmode].insn_code = CODE_FOR_negdf2;
  2191. #endif
  2192.   neg_optab->handlers[(int) SImode].lib_call = "__negsi2"; 
  2193.   neg_optab->handlers[(int) DImode].lib_call = "__negdi2";
  2194.   neg_optab->handlers[(int) SFmode].lib_call = "__negsf2";
  2195.   neg_optab->handlers[(int) DFmode].lib_call = "__negdf2";
  2196. #ifdef APPLE_HAX
  2197.   /* Code generation table entries for extended float arithmetic. */
  2198. #ifdef HAVE_negxf2
  2199.   if (HAVE_negxf2)
  2200.     neg_optab->handlers[(int) XFmode].insn_code = CODE_FOR_negxf2;
  2201. #endif
  2202.   neg_optab->handlers[(int) XFmode].lib_call = "__negxf2";
  2203. #endif /* APPLE_HAX */
  2204.  
  2205. #ifdef HAVE_absqi2
  2206.   if (HAVE_absqi2)
  2207.     abs_optab->handlers[(int) QImode].insn_code = CODE_FOR_absqi2;
  2208. #endif
  2209. #ifdef HAVE_abshi2
  2210.   if (HAVE_abshi2)
  2211.     abs_optab->handlers[(int) HImode].insn_code = CODE_FOR_abshi2;
  2212. #endif
  2213. #ifdef HAVE_abssi2
  2214.   if (HAVE_abssi2)
  2215.     abs_optab->handlers[(int) SImode].insn_code = CODE_FOR_abssi2;
  2216. #endif
  2217. #ifdef HAVE_absdi2
  2218.   if (HAVE_absdi2)
  2219.     abs_optab->handlers[(int) DImode].insn_code = CODE_FOR_absdi2;
  2220. #endif
  2221. #ifdef HAVE_abssf2
  2222.   if (HAVE_abssf2)
  2223.     abs_optab->handlers[(int) SFmode].insn_code = CODE_FOR_abssf2;
  2224. #endif
  2225. #ifdef HAVE_absdf2
  2226.   if (HAVE_absdf2)
  2227.     abs_optab->handlers[(int) DFmode].insn_code = CODE_FOR_absdf2;
  2228. #endif
  2229. #ifdef APPLE_HAX
  2230.   /* Code generation table entries for extended float arithmetic. */
  2231. #ifdef HAVE_absxf2
  2232.   if (HAVE_absxf2)
  2233.     abs_optab->handlers[(int) XFmode].insn_code = CODE_FOR_absxf2;
  2234. #endif
  2235. #endif /* APPLE_HAX */
  2236.   /* No library calls here!  If there is no abs instruction,
  2237.      expand_expr will generate a conditional negation.  */
  2238.  
  2239. #ifdef HAVE_one_cmplqi2
  2240.   if (HAVE_one_cmplqi2)
  2241.     one_cmpl_optab->handlers[(int) QImode].insn_code = CODE_FOR_one_cmplqi2;
  2242. #endif
  2243. #ifdef HAVE_one_cmplhi2
  2244.   if (HAVE_one_cmplhi2)
  2245.     one_cmpl_optab->handlers[(int) HImode].insn_code = CODE_FOR_one_cmplhi2;
  2246. #endif
  2247. #ifdef HAVE_one_cmplsi2
  2248.   if (HAVE_one_cmplsi2)
  2249.     one_cmpl_optab->handlers[(int) SImode].insn_code = CODE_FOR_one_cmplsi2;
  2250. #endif
  2251. #ifdef HAVE_one_cmpldi2
  2252.   if (HAVE_one_cmpldi2)
  2253.     one_cmpl_optab->handlers[(int) DImode].insn_code = CODE_FOR_one_cmpldi2;
  2254. #endif
  2255.   one_cmpl_optab->handlers[(int) SImode].lib_call = "__one_cmplsi2"; 
  2256.   one_cmpl_optab->handlers[(int) DImode].lib_call = "__one_cmpldi2";
  2257.  
  2258. #ifdef HAVE_ffsqi2
  2259.   if (HAVE_ffsqi2)
  2260.     ffs_optab->handlers[(int) QImode].insn_code = CODE_FOR_ffsqi2;
  2261. #endif
  2262. #ifdef HAVE_ffshi2
  2263.   if (HAVE_ffshi2)
  2264.     ffs_optab->handlers[(int) HImode].insn_code = CODE_FOR_ffshi2;
  2265. #endif
  2266. #ifdef HAVE_ffssi2
  2267.   if (HAVE_ffssi2)
  2268.     ffs_optab->handlers[(int) SImode].insn_code = CODE_FOR_ffssi2;
  2269. #endif
  2270. #ifdef HAVE_ffsdi2
  2271.   if (HAVE_ffsdi2)
  2272.     ffs_optab->handlers[(int) DImode].insn_code = CODE_FOR_ffsdi2;
  2273. #endif
  2274.   ffs_optab->handlers[(int) SImode].lib_call = "ffs"; 
  2275.  
  2276. #ifdef APPLE_HAX
  2277.   /* Code generation table entries for extended float elem functions. */
  2278. #ifdef HAVE_sinxf2
  2279.   if (HAVE_sinxf2)
  2280.     sin_optab->handlers[(int) XFmode].insn_code = CODE_FOR_sinxf2;
  2281. #endif
  2282.   sin_optab->handlers[(int) XFmode].lib_call = "__sinxf2";
  2283. #ifdef HAVE_cosxf2
  2284.   if (HAVE_cosxf2)
  2285.     cos_optab->handlers[(int) XFmode].insn_code = CODE_FOR_cosxf2;
  2286. #endif
  2287.   cos_optab->handlers[(int) XFmode].lib_call = "__cosxf2";
  2288. #ifdef HAVE_tanxf2
  2289.   if (HAVE_tanxf2)
  2290.     tan_optab->handlers[(int) XFmode].insn_code = CODE_FOR_tanxf2;
  2291. #endif
  2292.   tan_optab->handlers[(int) XFmode].lib_call = "__tanxf2";
  2293. #ifdef HAVE_asinxf2
  2294.   if (HAVE_asinxf2)
  2295.     asin_optab->handlers[(int) XFmode].insn_code = CODE_FOR_asinxf2;
  2296. #endif
  2297.   asin_optab->handlers[(int) XFmode].lib_call = "__asinxf2";
  2298. #ifdef HAVE_acosxf2
  2299.   if (HAVE_acosxf2)
  2300.     acos_optab->handlers[(int) XFmode].insn_code = CODE_FOR_acosxf2;
  2301. #endif
  2302.   acos_optab->handlers[(int) XFmode].lib_call = "__acosxf2";
  2303. #ifdef HAVE_atanxf2
  2304.   if (HAVE_atanxf2)
  2305.     atan_optab->handlers[(int) XFmode].insn_code = CODE_FOR_atanxf2;
  2306. #endif
  2307.   atan_optab->handlers[(int) XFmode].lib_call = "__atanxf2";
  2308. #ifdef HAVE_sinhxf2
  2309.   if (HAVE_sinhxf2)
  2310.     sinh_optab->handlers[(int) XFmode].insn_code = CODE_FOR_sinhxf2;
  2311. #endif
  2312.   sinh_optab->handlers[(int) XFmode].lib_call = "__sinhxf2";
  2313. #ifdef HAVE_coshxf2
  2314.   if (HAVE_coshxf2)
  2315.     cosh_optab->handlers[(int) XFmode].insn_code = CODE_FOR_coshxf2;
  2316. #endif
  2317.   cosh_optab->handlers[(int) XFmode].lib_call = "__coshxf2";
  2318. #ifdef HAVE_tanhxf2
  2319.   if (HAVE_tanhxf2)
  2320.     tanh_optab->handlers[(int) XFmode].insn_code = CODE_FOR_tanhxf2;
  2321. #endif
  2322.   tanh_optab->handlers[(int) XFmode].lib_call = "__tanhxf2";
  2323. #ifdef HAVE_expxf2
  2324.   if (HAVE_expxf2)
  2325.     exp_optab->handlers[(int) XFmode].insn_code = CODE_FOR_expxf2;
  2326. #endif
  2327.   exp_optab->handlers[(int) XFmode].lib_call = "__expxf2";
  2328. #ifdef HAVE_logxf2
  2329.   if (HAVE_logxf2)
  2330.     log_optab->handlers[(int) XFmode].insn_code = CODE_FOR_logxf2;
  2331. #endif
  2332.   log_optab->handlers[(int) XFmode].lib_call = "__logxf2";
  2333. #ifdef HAVE_log10xf2
  2334.   if (HAVE_log10xf2)
  2335.     log10_optab->handlers[(int) XFmode].insn_code = CODE_FOR_log10xf2;
  2336. #endif
  2337.   log10_optab->handlers[(int) XFmode].lib_call = "__log10xf2";
  2338. #ifdef HAVE_sqrtxf2
  2339.   if (HAVE_sqrtxf2)
  2340.     sqrt_optab->handlers[(int) XFmode].insn_code = CODE_FOR_sqrtxf2;
  2341. #endif
  2342.   sqrt_optab->handlers[(int) XFmode].lib_call = "__sqrtxf2";
  2343. #endif /* APPLE_HAX */
  2344.  
  2345. #ifdef HAVE_movqi
  2346.   if (HAVE_movqi)
  2347.     mov_optab->handlers[(int) QImode].insn_code = CODE_FOR_movqi;
  2348. #endif
  2349. #ifdef HAVE_movhi
  2350.   if (HAVE_movhi)
  2351.     mov_optab->handlers[(int) HImode].insn_code = CODE_FOR_movhi;
  2352. #endif
  2353. #ifdef HAVE_movsi
  2354.   if (HAVE_movsi)
  2355.     mov_optab->handlers[(int) SImode].insn_code = CODE_FOR_movsi;
  2356. #endif
  2357. #ifdef HAVE_movdi
  2358.   if (HAVE_movdi)
  2359.     mov_optab->handlers[(int) DImode].insn_code = CODE_FOR_movdi;
  2360. #endif
  2361. #ifdef HAVE_movti
  2362.   if (HAVE_movti)
  2363.     mov_optab->handlers[(int) TImode].insn_code = CODE_FOR_movti;
  2364. #endif
  2365. #ifdef HAVE_movsf
  2366.   if (HAVE_movsf)
  2367.     mov_optab->handlers[(int) SFmode].insn_code = CODE_FOR_movsf;
  2368. #endif
  2369. #ifdef HAVE_movdf
  2370.   if (HAVE_movdf)
  2371.     mov_optab->handlers[(int) DFmode].insn_code = CODE_FOR_movdf;
  2372. #endif
  2373. #ifdef APPLE_HAX
  2374.   /* Code generation table entries for extended float moves. */
  2375. #ifdef HAVE_movxf
  2376.   if (HAVE_movxf)
  2377.     mov_optab->handlers[(int) XFmode].insn_code = CODE_FOR_movxf;
  2378. #endif
  2379. #endif /* APPLE_HAX */
  2380. #ifdef HAVE_movtf
  2381.   if (HAVE_movtf)
  2382.     mov_optab->handlers[(int) TFmode].insn_code = CODE_FOR_movtf;
  2383. #endif
  2384.  
  2385. #ifdef HAVE_movstrictqi
  2386.   if (HAVE_movstrictqi)
  2387.     movstrict_optab->handlers[(int) QImode].insn_code = CODE_FOR_movstrictqi;
  2388. #endif
  2389. #ifdef HAVE_movstricthi
  2390.   if (HAVE_movstricthi)
  2391.     movstrict_optab->handlers[(int) HImode].insn_code = CODE_FOR_movstricthi;
  2392. #endif
  2393. #ifdef HAVE_movstrictsi
  2394.   if (HAVE_movstrictsi)
  2395.     movstrict_optab->handlers[(int) SImode].insn_code = CODE_FOR_movstrictsi;
  2396. #endif
  2397. #ifdef HAVE_movstrictdi
  2398.   if (HAVE_movstrictdi)
  2399.     movstrict_optab->handlers[(int) DImode].insn_code = CODE_FOR_movstrictdi;
  2400. #endif
  2401.  
  2402. #ifdef HAVE_cmpqi
  2403.   if (HAVE_cmpqi)
  2404.     cmp_optab->handlers[(int) QImode].insn_code = CODE_FOR_cmpqi;
  2405. #endif
  2406. #ifdef HAVE_cmphi
  2407.   if (HAVE_cmphi)
  2408.     cmp_optab->handlers[(int) HImode].insn_code = CODE_FOR_cmphi;
  2409. #endif
  2410. #ifdef HAVE_cmpsi
  2411.   if (HAVE_cmpsi)
  2412.     cmp_optab->handlers[(int) SImode].insn_code = CODE_FOR_cmpsi;
  2413. #endif
  2414. #ifdef HAVE_cmpdi
  2415.   if (HAVE_cmpdi)
  2416.     cmp_optab->handlers[(int) DImode].insn_code = CODE_FOR_cmpdi;
  2417. #endif
  2418. #ifdef HAVE_cmpsf
  2419.   if (HAVE_cmpsf)
  2420.     cmp_optab->handlers[(int) SFmode].insn_code = CODE_FOR_cmpsf;
  2421. #endif
  2422. #ifdef HAVE_cmpdf
  2423.   if (HAVE_cmpdf)
  2424.     cmp_optab->handlers[(int) DFmode].insn_code = CODE_FOR_cmpdf;
  2425. #endif
  2426. #ifdef APPLE_HAX
  2427.   /* Code generation table entries for extended float compare. */
  2428. #ifdef HAVE_cmpxf
  2429.   if (HAVE_cmpxf)
  2430.     cmp_optab->handlers[(int) XFmode].insn_code = CODE_FOR_cmpxf;
  2431. #endif
  2432. #endif /* APPLE_HAX */
  2433. #ifdef HAVE_tstqi
  2434.   if (HAVE_tstqi)
  2435.     tst_optab->handlers[(int) QImode].insn_code = CODE_FOR_tstqi;
  2436. #endif
  2437. #ifdef HAVE_tsthi
  2438.   if (HAVE_tsthi)
  2439.     tst_optab->handlers[(int) HImode].insn_code = CODE_FOR_tsthi;
  2440. #endif
  2441. #ifdef HAVE_tstsi
  2442.   if (HAVE_tstsi)
  2443.     tst_optab->handlers[(int) SImode].insn_code = CODE_FOR_tstsi;
  2444. #endif
  2445. #ifdef HAVE_tstdi
  2446.   if (HAVE_tstdi)
  2447.     tst_optab->handlers[(int) DImode].insn_code = CODE_FOR_tstdi;
  2448. #endif
  2449. #ifdef HAVE_tstsf
  2450.   if (HAVE_tstsf)
  2451.     tst_optab->handlers[(int) SFmode].insn_code = CODE_FOR_tstsf;
  2452. #endif
  2453. #ifdef HAVE_tstdf
  2454.   if (HAVE_tstdf)
  2455.     tst_optab->handlers[(int) DFmode].insn_code = CODE_FOR_tstdf;
  2456. #endif
  2457. #ifdef APPLE_HAX
  2458.   /* Code generation table entries for extended float test against zero. */
  2459. #ifdef HAVE_tstxf
  2460.   if (HAVE_tstxf)
  2461.     tst_optab->handlers[(int) XFmode].insn_code = CODE_FOR_tstxf;
  2462. #endif
  2463. #endif /* APPLE_HAX */
  2464.   /* Comparison libcalls for integers MUST come in pairs, signed/unsigned.  */
  2465.   cmp_optab->handlers[(int) DImode].lib_call = "__cmpdi2";
  2466.   ucmp_optab->handlers[(int) DImode].lib_call = "__ucmpdi2";
  2467.   cmp_optab->handlers[(int) SFmode].lib_call = "__cmpsf2";
  2468.   cmp_optab->handlers[(int) DFmode].lib_call = "__cmpdf2";
  2469. #ifdef APPLE_HAX
  2470.   /* Code generation table entries for extended float compare. */
  2471.   cmp_optab->handlers[(int) XFmode].lib_call = "__cmpxf2";
  2472. #endif /* APPLE_HAX */
  2473.  
  2474. #if HAVE_beq
  2475.   if (HAVE_beq)
  2476.     bcc_gen_fctn[(int) EQ] = gen_beq;
  2477. #endif
  2478. #if HAVE_bne
  2479.   if (HAVE_bne)
  2480.     bcc_gen_fctn[(int) NE] = gen_bne;
  2481. #endif
  2482. #if HAVE_bgt
  2483.   if (HAVE_bgt)
  2484.     bcc_gen_fctn[(int) GT] = gen_bgt;
  2485. #endif
  2486. #if HAVE_bge
  2487.   if (HAVE_bge)
  2488.     bcc_gen_fctn[(int) GE] = gen_bge;
  2489. #endif
  2490. #if HAVE_bgtu
  2491.   if (HAVE_bgtu)
  2492.     bcc_gen_fctn[(int) GTU] = gen_bgtu;
  2493. #endif
  2494. #if HAVE_bgeu
  2495.   if (HAVE_bgeu)
  2496.     bcc_gen_fctn[(int) GEU] = gen_bgeu;
  2497. #endif
  2498. #if HAVE_blt
  2499.   if (HAVE_blt)
  2500.     bcc_gen_fctn[(int) LT] = gen_blt;
  2501. #endif
  2502. #if HAVE_ble
  2503.   if (HAVE_ble)
  2504.     bcc_gen_fctn[(int) LE] = gen_ble;
  2505. #endif
  2506. #if HAVE_bltu
  2507.   if (HAVE_bltu)
  2508.     bcc_gen_fctn[(int) LTU] = gen_bltu;
  2509. #endif
  2510. #if HAVE_bleu
  2511.   if (HAVE_bleu)
  2512.     bcc_gen_fctn[(int) LEU] = gen_bleu;
  2513. #endif
  2514.  
  2515. #if HAVE_seq
  2516.   if (HAVE_seq)
  2517.     setcc_gen_fctn[(int) EQ] = gen_seq;
  2518. #endif
  2519. #if HAVE_sne
  2520.   if (HAVE_sne)
  2521.     setcc_gen_fctn[(int) NE] = gen_sne;
  2522. #endif
  2523. #if HAVE_sgt
  2524.   if (HAVE_sgt)
  2525.     setcc_gen_fctn[(int) GT] = gen_sgt;
  2526. #endif
  2527. #if HAVE_sge
  2528.   if (HAVE_sge)
  2529.     setcc_gen_fctn[(int) GE] = gen_sge;
  2530. #endif
  2531. #if HAVE_sgtu
  2532.   if (HAVE_sgtu)
  2533.     setcc_gen_fctn[(int) GTU] = gen_sgtu;
  2534. #endif
  2535. #if HAVE_sgeu
  2536.   if (HAVE_sgeu)
  2537.     setcc_gen_fctn[(int) GEU] = gen_sgeu;
  2538. #endif
  2539. #if HAVE_slt
  2540.   if (HAVE_slt)
  2541.     setcc_gen_fctn[(int) LT] = gen_slt;
  2542. #endif
  2543. #if HAVE_sle
  2544.   if (HAVE_sle)
  2545.     setcc_gen_fctn[(int) LE] = gen_sle;
  2546. #endif
  2547. #if HAVE_sltu
  2548.   if (HAVE_sltu)
  2549.     setcc_gen_fctn[(int) LTU] = gen_sltu;
  2550. #endif
  2551. #if HAVE_sleu
  2552.   if (HAVE_sleu)
  2553.     setcc_gen_fctn[(int) LEU] = gen_sleu;
  2554. #endif
  2555. }
  2556.  
  2557.  
  2558. init_optabs2()
  2559. {
  2560. #define INIT_OPTABS
  2561. #include "init.c"
  2562. }
  2563.