home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / config / rs6000.md < prev    next >
Text File  |  1994-02-06  |  149KB  |  4,687 lines

  1. ;;- Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
  2. ;;   Copyright (C) 1990, 1991 Free Software Foundation, Inc.
  3. ;;   Contributed by Richard Kenner (kenner@nyu.edu)
  4.  
  5. ;; This file is part of GNU CC.
  6.  
  7. ;; GNU CC is free software; you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation; either version 2, or (at your option)
  10. ;; any later version.
  11.  
  12. ;; GNU CC is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ;; GNU General Public License for more details.
  16.  
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU CC; see the file COPYING.  If not, write to
  19. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  22.  
  23. ;; Define an insn type attribute.  This is used in function unit delay
  24. ;; computations.
  25. (define_attr "type" "load,integer,fp,compare,delayed_compare,fpcompare,mtlr"
  26.   (const_string "integer"))
  27.  
  28. ;; Memory delivers its result in two cycles.
  29. (define_function_unit "memory" 1 0 (eq_attr "type" "load") 2 0)
  30.  
  31. ;; We consider floating-point insns to deliver their result in two cycles
  32. ;; to try to intersperse integer and FP operations.
  33. (define_function_unit "fp" 1 0 (eq_attr "type" "fp,fpcompare") 2 0)
  34.  
  35. ;; Most integer comparisons are ready in four cycles (a stall of three).
  36. (define_function_unit "compare" 1 0 (eq_attr "type" "compare") 4 0)
  37.  
  38. ;; Some integer comparisons aren't ready for five cycles (a stall of four).
  39. (define_function_unit "compare" 1 0 (eq_attr "type" "delayed_compare") 5 0)
  40.  
  41. ;; Floating-point comparisons take eight cycles.
  42. (define_function_unit "compare" 1 0 (eq_attr "type" "fpcompare") 8 0)
  43.  
  44. ;; Branches on LR cannot be done until five cycles after LR is set.
  45. (define_function_unit "branch" 1 0 (eq_attr "type" "mtlr") 5 0)
  46.  
  47. ;; Start with fixed-point load and store insns.  Here we put only the more
  48. ;; complex forms.  Basic data transfer is done later.
  49.  
  50. (define_expand "zero_extendqisi2"
  51.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  52.     (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
  53.   ""
  54.   "")
  55.  
  56. (define_insn ""
  57.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  58.     (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
  59.   ""
  60.   "@
  61.    lbz%U1%X1 %0,%1
  62.    rlinm %0,%1,0,24,31"
  63.   [(set_attr "type" "load,*")])
  64.  
  65. (define_insn ""
  66.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  67.     (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
  68.             (const_int 0)))
  69.    (clobber (match_scratch:SI 2 "=r"))]
  70.   ""
  71.   "andil. %2,%1,255"
  72.   [(set_attr "type" "compare")])
  73.  
  74. (define_insn ""
  75.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  76.     (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
  77.             (const_int 0)))
  78.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  79.     (zero_extend:SI (match_dup 1)))]
  80.   ""
  81.   "andil. %0,%1,255"
  82.   [(set_attr "type" "compare")])
  83.  
  84. (define_expand "zero_extendqihi2"
  85.   [(set (match_operand:HI 0 "gpc_reg_operand" "")
  86.     (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
  87.   ""
  88.   "")
  89.  
  90. (define_insn ""
  91.   [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
  92.     (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
  93.   ""
  94.   "@
  95.    lbz%U1%X1 %0,%1
  96.    rlinm %0,%1,0,24,31"
  97.   [(set_attr "type" "load,*")])
  98.  
  99. (define_expand "zero_extendhisi2"
  100.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  101.     (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
  102.   ""
  103.   "")
  104.  
  105. (define_insn ""
  106.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  107.     (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
  108.   ""
  109.   "@
  110.    lhz%U1%X1 %0,%1
  111.    rlinm %0,%1,0,16,31"
  112.   [(set_attr "type" "load,*")])
  113.  
  114. (define_insn ""
  115.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  116.     (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
  117.             (const_int 0)))
  118.    (clobber (match_scratch:SI 2 "=r"))]
  119.   ""
  120.   "andil. %2,%1,65535"
  121.   [(set_attr "type" "compare")])
  122.  
  123. (define_insn ""
  124.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  125.     (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
  126.             (const_int 0)))
  127.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  128.     (zero_extend:SI (match_dup 1)))]
  129.   ""
  130.   "andil. %0,%1,65535"
  131.   [(set_attr "type" "compare")])
  132.  
  133. (define_expand "extendhisi2"
  134.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  135.     (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
  136.   ""
  137.   "")
  138.  
  139. (define_insn ""
  140.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  141.     (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
  142.   ""
  143.   "@
  144.    lha%U1%X1 %0,%1
  145.    exts %0,%1"
  146.   [(set_attr "type" "load,*")])
  147.  
  148. (define_insn ""
  149.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  150.     (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
  151.             (const_int 0)))
  152.    (clobber (match_scratch:SI 2 "=r"))]
  153.   ""
  154.   "exts. %2,%1"
  155.   [(set_attr "type" "compare")])
  156.  
  157. (define_insn ""
  158.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  159.     (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
  160.             (const_int 0)))
  161.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  162.     (sign_extend:SI (match_dup 1)))]
  163.   ""
  164.   "exts. %0,%1"
  165.   [(set_attr "type" "compare")])
  166.  
  167. ;; Fixed-point arithmetic insns.
  168. (define_insn "addsi3"
  169.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  170.     (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b")
  171.          (match_operand:SI 2 "add_operand" "rI,J")))]
  172.   ""
  173.   "@
  174.    a%I2 %0,%1,%2
  175.    cau %0,%1,%u2")
  176.  
  177. (define_insn ""
  178.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  179.     (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  180.                  (match_operand:SI 2 "reg_or_short_operand" "rI"))
  181.             (const_int 0)))
  182.    (clobber (match_scratch:SI 3 "=r"))]
  183.   ""
  184.   "a%I2. %3,%1,%2"
  185.   [(set_attr "type" "compare")])
  186.    
  187. (define_insn ""
  188.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  189.     (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  190.                  (match_operand:SI 2 "reg_or_short_operand" "rI"))
  191.             (const_int 0)))
  192.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  193.     (plus:SI (match_dup 1) (match_dup 2)))]
  194.   ""
  195.   "a%I2. %0,%1,%2"
  196.   [(set_attr "type" "compare")])
  197.    
  198. ;; Split an add that we can't do in one insn into two insns, each of which
  199. ;; does one 16-bit part.  This is used by combine.  Note that the low-order
  200. ;; add should be last in case the result gets used in an address.
  201.  
  202. (define_split
  203.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  204.     (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
  205.          (match_operand:SI 2 "non_add_cint_operand" "")))]
  206.   ""
  207.   [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
  208.    (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
  209. "
  210. {
  211.   int low = INTVAL (operands[2]) & 0xffff;
  212.   int high = (unsigned) INTVAL (operands[2]) >> 16;
  213.  
  214.   if (low & 0x8000)
  215.     high++, low |= 0xffff0000;
  216.  
  217.   operands[3] = gen_rtx (CONST_INT, VOIDmode, high << 16);
  218.   operands[4] = gen_rtx (CONST_INT, VOIDmode, low);
  219. }")
  220.  
  221. (define_insn "one_cmplsi2"
  222.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  223.     (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
  224.   ""
  225.   "sfi %0,%1,-1")
  226.  
  227. (define_insn ""
  228.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  229.     (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
  230.           (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
  231.   ""
  232.   "@
  233.    sf %0,%2,%1
  234.    sfi %0,%2,%1")
  235.  
  236. (define_insn ""
  237.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  238.     (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  239.                   (match_operand:SI 2 "gpc_reg_operand" "r"))
  240.             (const_int 0)))
  241.    (clobber (match_scratch:SI 3 "=r"))]
  242.   ""
  243.   "sf. %3,%2,%1"
  244.   [(set_attr "type" "compare")])
  245.  
  246. (define_insn ""
  247.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  248.     (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  249.                   (match_operand:SI 2 "gpc_reg_operand" "r"))
  250.             (const_int 0)))
  251.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  252.     (minus:SI (match_dup 1) (match_dup 2)))]
  253.   ""
  254.   "sf. %0,%2,%1"
  255.   [(set_attr "type" "compare")])
  256.  
  257. (define_expand "subsi3"
  258.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  259.     (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
  260.           (match_operand:SI 2 "reg_or_cint_operand" "")))]
  261.   ""
  262.   "
  263. {
  264.   if (GET_CODE (operands[2]) == CONST_INT)
  265.     {
  266.       emit_insn (gen_addsi3 (operands[0], operands[1],
  267.                  negate_rtx (SImode, operands[2])));
  268.       DONE;
  269.     }
  270. }")
  271.  
  272. ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
  273. ;; instruction and some auxiliary computations.  Then we just have a single
  274. ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
  275. ;; combine.
  276.  
  277. (define_expand "sminsi3"
  278.   [(set (match_dup 3)
  279.     (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
  280.                 (match_operand:SI 2 "reg_or_short_operand" ""))
  281.              (const_int 0)
  282.              (minus:SI (match_dup 2) (match_dup 1))))
  283.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  284.     (minus:SI (match_dup 2) (match_dup 3)))]
  285.   ""
  286.   "
  287. { operands[3] = gen_reg_rtx (SImode); }")
  288.  
  289. (define_split
  290.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  291.     (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
  292.          (match_operand:SI 2 "reg_or_short_operand" "")))
  293.    (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
  294.   ""
  295.   [(set (match_dup 3)
  296.     (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
  297.              (const_int 0)
  298.              (minus:SI (match_dup 2) (match_dup 1))))
  299.    (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
  300.   "")
  301.  
  302. (define_expand "smaxsi3"
  303.   [(set (match_dup 3)
  304.     (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
  305.                 (match_operand:SI 2 "reg_or_short_operand" ""))
  306.              (const_int 0)
  307.              (minus:SI (match_dup 2) (match_dup 1))))
  308.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  309.     (plus:SI (match_dup 3) (match_dup 1)))]
  310.   ""
  311.   "
  312. { operands[3] = gen_reg_rtx (SImode); }")
  313.  
  314. (define_split
  315.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  316.     (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
  317.          (match_operand:SI 2 "reg_or_short_operand" "")))
  318.    (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
  319.   ""
  320.   [(set (match_dup 3)
  321.     (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
  322.              (const_int 0)
  323.              (minus:SI (match_dup 2) (match_dup 1))))
  324.    (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
  325.   "")
  326.  
  327. (define_expand "uminsi3"
  328.   [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  329.                   (const_int -2147483648)))
  330.    (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
  331.                   (const_int -2147483648)))
  332.    (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
  333.                        (const_int 0)
  334.                        (minus:SI (match_dup 4) (match_dup 3))))
  335.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  336.     (minus:SI (match_dup 2) (match_dup 3)))]
  337.   ""
  338.   "
  339. { operands[3] = gen_reg_rtx (SImode);  operands[4] = gen_reg_rtx (SImode); }")
  340.  
  341. (define_expand "umaxsi3"
  342.   [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  343.                   (const_int -2147483648)))
  344.    (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
  345.                   (const_int -2147483648)))
  346.    (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
  347.                        (const_int 0)
  348.                        (minus:SI (match_dup 4) (match_dup 3))))
  349.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  350.     (plus:SI (match_dup 3) (match_dup 1)))]
  351.   ""
  352.   "
  353. { operands[3] = gen_reg_rtx (SImode);  operands[4] = gen_reg_rtx (SImode); }")
  354.  
  355. (define_insn ""
  356.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  357.     (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
  358.                  (match_operand:SI 2 "reg_or_short_operand" "rI"))
  359.              (const_int 0)
  360.              (minus:SI (match_dup 2) (match_dup 1))))]
  361.   ""
  362.   "doz%I2 %0,%1,%2")
  363.  
  364. (define_insn ""
  365.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  366.     (compare:CC
  367.      (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
  368.                   (match_operand:SI 2 "reg_or_short_operand" "rI"))
  369.               (const_int 0)
  370.               (minus:SI (match_dup 2) (match_dup 1)))
  371.      (const_int 0)))
  372.    (clobber (match_scratch:SI 3 "=r"))]
  373.   ""
  374.   "doz%I2. %3,%1,%2"
  375.   [(set_attr "type" "delayed_compare")])
  376.  
  377. (define_insn ""
  378.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  379.     (compare:CC
  380.      (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
  381.                   (match_operand:SI 2 "reg_or_short_operand" "rI"))
  382.               (const_int 0)
  383.               (minus:SI (match_dup 2) (match_dup 1)))
  384.      (const_int 0)))
  385.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  386.     (if_then_else:SI (gt (match_dup 1) (match_dup 2))
  387.              (const_int 0)
  388.              (minus:SI (match_dup 2) (match_dup 1))))]
  389.   ""
  390.   "doz%I2. %0,%1,%2"
  391.   [(set_attr "type" "delayed_compare")])
  392.  
  393. ;; We don't need abs with condition code because such comparisons should
  394. ;; never be done.
  395. (define_insn "abssi2"
  396.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  397.     (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
  398.   ""
  399.   "abs %0,%1")
  400.  
  401. (define_insn ""
  402.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  403.     (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
  404.   ""
  405.   "nabs %0,%1")
  406.  
  407. (define_insn "negsi2"
  408.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  409.     (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
  410.   ""
  411.   "neg %0,%1")
  412.  
  413. (define_insn ""
  414.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  415.     (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  416.             (const_int 0)))
  417.    (clobber (match_scratch:SI 2 "=r"))]
  418.   ""
  419.   "neg. %2,%1"
  420.   [(set_attr "type" "compare")])
  421.  
  422. (define_insn ""
  423.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  424.     (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  425.             (const_int 0)))
  426.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  427.     (neg:SI (match_dup 1)))]
  428.   ""
  429.   "neg. %0,%1"
  430.   [(set_attr "type" "compare")])
  431.  
  432. (define_insn "ffssi2"
  433.   [(set (match_operand:SI 0 "register_operand" "=&r")
  434.     (ffs:SI (match_operand:SI 1 "register_operand" "r")))]
  435.   ""
  436.   "neg %0,%1\;and %0,%0,%1\;cntlz %0,%0\;sfi %0,%0,32")
  437.  
  438. ;; There is no need for (set (condition) (compare (ffs) 0)) because that
  439. ;; can be simplified to an ordinary comparison.  A parallel set and compare
  440. ;; might be used, so include it.
  441.  
  442. (define_insn ""
  443.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  444.     (compare:CC (ffs:SI (match_operand:SI 1 "register_operand" "r"))
  445.             (const_int 0)))
  446.    (set (match_operand:SI 0 "register_operand" "=&r")
  447.     (ffs:SI (match_dup 1)))]
  448.   ""
  449.   "neg %0,%1\;and %0,%0,%1\;cntlz %0,%0\;sfi. %0,%0,32"
  450.   [(set_attr "type" "compare")])
  451.  
  452. (define_insn "mulsi3"
  453.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  454.     (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
  455.          (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  456.    (clobber (match_scratch:SI 3 "=q,q"))]
  457.   ""
  458.   "@
  459.    muls %0,%1,%2
  460.    muli %0,%1,%2")
  461.  
  462. (define_insn ""
  463.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  464.     (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  465.                  (match_operand:SI 2 "gpc_reg_operand" "r"))
  466.             (const_int 0)))
  467.    (clobber (match_scratch:SI 3 "=r"))
  468.    (clobber (match_scratch:SI 4 "=q"))]
  469.   ""
  470.   "muls. %3,%1,%2"
  471.   [(set_attr "type" "delayed_compare")])
  472.  
  473. (define_insn ""
  474.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  475.     (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  476.                  (match_operand:SI 2 "gpc_reg_operand" "r"))
  477.             (const_int 0)))
  478.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  479.     (mult:SI (match_dup 1) (match_dup 2)))
  480.    (clobber (match_scratch:SI 4 "=q"))]
  481.   ""
  482.   "muls. %0,%1,%2"
  483.   [(set_attr "type" "delayed_compare")])
  484.  
  485. ;; Operand 1 is divided by operand 2; quotient goes to operand
  486. ;; 0 and remainder to operand 3.
  487. ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
  488.  
  489. (define_insn "divmodsi4"
  490.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  491.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  492.         (match_operand:SI 2 "gpc_reg_operand" "r")))
  493.    (set (match_operand:SI 3 "gpc_reg_operand" "=q")
  494.     (mod:SI (match_dup 1) (match_dup 2)))]
  495.   ""
  496.   "divs %0,%1,%2")
  497.  
  498. ;; For powers of two we can do srai/aze for divide and then adjust for
  499. ;; modulus.  If it isn't a power of two, FAIL so divmodsi4 will be used.
  500. (define_expand "divsi3"
  501.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  502.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
  503.         (match_operand:SI 2 "reg_or_cint_operand" "")))]
  504.   ""
  505.   "
  506. {
  507.   if (GET_CODE (operands[2]) != CONST_INT
  508.       || exact_log2 (INTVAL (operands[2])) < 0)
  509.     FAIL;
  510. }")
  511.  
  512. (define_expand "modsi3"
  513.   [(set (match_dup 3)
  514.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
  515.         (match_operand:SI 2 "reg_or_cint_operand" "")))
  516.    (parallel [(set (match_dup 4) (ashift:SI (match_dup 3) (match_dup 5)))
  517.           (clobber (scratch:SI))])
  518.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  519.     (minus:SI (match_dup 1) (match_dup 4)))]
  520.   ""
  521.   "
  522. {
  523.   int i = exact_log2 (INTVAL (operands[2]));
  524.  
  525.   if (GET_CODE (operands[2]) != CONST_INT || i < 0)
  526.     FAIL;
  527.  
  528.   operands[3] = gen_reg_rtx (SImode);
  529.   operands[4] = gen_reg_rtx (SImode);
  530.   operands[5] = gen_rtx (CONST_INT, VOIDmode, i);
  531. }")
  532.  
  533. (define_insn ""
  534.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  535.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  536.         (match_operand:SI 2 "const_int_operand" "N")))]
  537.   "exact_log2 (INTVAL (operands[2])) >= 0"
  538.   "srai %0,%1,%p2\;aze %0,%0")
  539.  
  540. (define_insn ""
  541.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  542.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  543.         (match_operand:SI 2 "const_int_operand" "N")))
  544.    (clobber (match_scratch:SI 3 "=r"))]
  545.   "exact_log2 (INTVAL (operands[2])) >= 0"
  546.   "srai %3,%1,%p2\;aze. %3,%3"
  547.   [(set_attr "type" "compare")])
  548.  
  549. (define_insn ""
  550.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  551.     (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  552.         (match_operand:SI 2 "const_int_operand" "N")))
  553.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  554.     (div:SI (match_dup 1) (match_dup 2)))]
  555.   "exact_log2 (INTVAL (operands[2])) >= 0"
  556.   "srai %0,%1,%p2\;aze. %0,%0"
  557.   [(set_attr "type" "compare")])
  558.  
  559. (define_insn ""
  560.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  561.     (udiv:SI
  562.      (plus:DI (lshift:DI
  563.            (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
  564.            (const_int 32))
  565.           (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
  566.      (match_operand:SI 3 "gpc_reg_operand" "r")))
  567.    (set (match_operand:SI 2 "register_operand" "=*q")
  568.     (umod:SI
  569.      (plus:DI (lshift:DI
  570.            (zero_extend:DI (match_dup 1)) (const_int 32))
  571.           (zero_extend:DI (match_dup 4)))
  572.      (match_dup 3)))]
  573.   
  574.   ""
  575.   "div %0,%1,%3")
  576.  
  577. ;; To do unsigned divide we handle the cases of the divisor looking like a
  578. ;; negative number.  If it is a constant that is less than 2**31, we don't
  579. ;; have to worry about the branches.  So make a few subroutines here.
  580. ;;
  581. ;; First comes the normal case.
  582. (define_expand "udivmodsi4_normal"
  583.   [(set (match_dup 4) (const_int 0))
  584.    (parallel [(set (match_operand:SI 0 "" "")
  585.            (udiv:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4))
  586.                         (const_int 32))
  587.                      (zero_extend:DI (match_operand:SI 1 "" "")))
  588.                 (match_operand:SI 2 "" "")))
  589.           (set (match_operand:SI 3 "" "")
  590.            (umod:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4))
  591.                         (const_int 32))
  592.                      (zero_extend:DI (match_dup 1)))
  593.                 (match_dup 2)))])]
  594.   ""
  595.   "
  596. { operands[4] = gen_reg_rtx (SImode); }")
  597.  
  598. ;; This handles the branches.
  599. (define_expand "udivmodsi4_tests"
  600.   [(set (match_operand:SI 0 "" "") (const_int 0))
  601.    (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
  602.    (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
  603.    (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
  604.                (label_ref (match_operand:SI 4 "" "")) (pc)))
  605.    (set (match_dup 0) (const_int 1))
  606.    (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
  607.    (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
  608.    (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
  609.                (label_ref (match_dup 4)) (pc)))]
  610.   ""
  611.   "
  612. { operands[5] = gen_reg_rtx (CCUNSmode);
  613.   operands[6] = gen_reg_rtx (CCmode);
  614. }")
  615.  
  616. (define_expand "udivmodsi4"
  617.   [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
  618.            (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
  619.                 (match_operand:SI 2 "reg_or_cint_operand" "")))
  620.           (set (match_operand:SI 3 "gpc_reg_operand" "")
  621.            (umod:SI (match_dup 1) (match_dup 2)))])]
  622.   ""
  623.   "
  624. {
  625.   rtx label = 0;
  626.  
  627.   if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
  628.     {
  629.       operands[2] = force_reg (SImode, operands[2]);
  630.       label = gen_label_rtx ();
  631.       emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
  632.                   operands[3], label));
  633.     }
  634.   else
  635.     operands[2] = force_reg (SImode, operands[2]);
  636.  
  637.   emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
  638.                    operands[3]));
  639.   if (label)
  640.     emit_label (label);
  641.  
  642.   DONE;
  643. }")
  644.     
  645. (define_insn "andsi3"
  646.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
  647.     (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
  648.         (match_operand:SI 2 "and_operand" "?r,L,K,J")))
  649.    (clobber (match_scratch:CC 3 "=X,X,x,x"))]
  650.   ""
  651.   "@
  652.    and %0,%1,%2
  653.    rlinm %0,%1,0,%m2,%M2
  654.    andil. %0,%1,%b2
  655.    andiu. %0,%1,%u2")
  656.  
  657. (define_insn ""
  658.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
  659.     (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
  660.                 (match_operand:SI 2 "and_operand" "r,K,J,L"))
  661.             (const_int 0)))
  662.    (clobber (match_scratch:SI 3 "=r,r,r,r"))]
  663.   ""
  664.   "@
  665.    and. %3,%1,%2
  666.    andil. %3,%1,%b2
  667.    andiu. %3,%1,%u2
  668.    rlinm. %3,%1,0,%m2,%M2"
  669.   [(set_attr "type" "compare,compare,compare,delayed_compare")])
  670.  
  671. (define_insn ""
  672.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
  673.     (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
  674.                 (match_operand:SI 2 "and_operand" "r,K,J,L"))
  675.             (const_int 0)))
  676.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
  677.     (and:SI (match_dup 1) (match_dup 2)))]
  678.   ""
  679.   "@
  680.    and. %0,%1,%2
  681.    andil. %0,%1,%b2
  682.    andiu. %0,%1,%u2
  683.    rlinm. %0,%1,0,%m2,%M2"
  684.   [(set_attr "type" "compare,compare,compare,delayed_compare")]) 
  685.  
  686. ;; Take a AND with a constant that cannot be done in a single insn and try to
  687. ;; split it into two insns.  This does not verify that the insns are valid
  688. ;; since this need not be done as combine will do it.
  689.  
  690. (define_split
  691.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  692.     (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
  693.         (match_operand:SI 2 "non_and_cint_operand" "")))]
  694.   ""
  695.   [(set (match_dup 0) (and:SI (match_dup 1) (match_dup 3)))
  696.    (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))]
  697.   "
  698. {
  699.   int maskval = INTVAL (operands[2]);
  700.   int i, transitions, last_bit_value;
  701.   int orig = maskval, first_c = maskval, second_c;
  702.  
  703.   /* We know that MASKVAL must have more than 2 bit-transitions.  Start at
  704.      the low-order bit and count for the third transition.  When we get there,
  705.      make a first mask that has everything to the left of that position
  706.      a one.  Then make the second mask to turn off whatever else is needed.  */
  707.  
  708.   for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
  709.     {
  710.       if (((maskval >>= 1) & 1) != last_bit_value)
  711.     last_bit_value ^= 1, transitions++;
  712.  
  713.       if (transitions > 2)
  714.     {
  715.       first_c |= (~0) << i;
  716.       break;
  717.     }
  718.     }
  719.  
  720.   second_c = orig | ~ first_c;
  721.  
  722.   operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
  723.   operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
  724. }")
  725.  
  726. (define_insn "iorsi3"
  727.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
  728.     (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
  729.         (match_operand:SI 2 "logical_operand" "r,K,J")))]
  730.   ""
  731.   "@
  732.    or %0,%1,%2
  733.    oril %0,%1,%b2
  734.    oriu %0,%1,%u2")
  735.  
  736. (define_insn ""
  737.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  738.     (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  739.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  740.             (const_int 0)))
  741.    (clobber (match_scratch:SI 3 "=r"))]
  742.   ""
  743.   "or. %3,%1,%2"
  744.   [(set_attr "type" "compare")])
  745.  
  746. (define_insn ""
  747.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  748.     (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  749.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  750.             (const_int 0)))
  751.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  752.     (ior:SI (match_dup 1) (match_dup 2)))]
  753.   ""
  754.   "or. %0,%1,%2"
  755.   [(set_attr "type" "compare")])
  756.  
  757. ;; Split an IOR that we can't do in one insn into two insns, each of which
  758. ;; does one 16-bit part.  This is used by combine.
  759.  
  760. (define_split
  761.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  762.     (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
  763.         (match_operand:SI 2 "non_logical_cint_operand" "")))]
  764.   ""
  765.   [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))
  766.    (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))]
  767. "
  768. {
  769.   operands[3] = gen_rtx (CONST_INT, VOIDmode,
  770.              INTVAL (operands[2]) & 0xffff0000);
  771.   operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
  772. }")
  773.  
  774. (define_insn "xorsi3"
  775.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
  776.     (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
  777.         (match_operand:SI 2 "logical_operand" "r,K,J")))]
  778.   ""
  779.   "@
  780.    xor %0,%1,%2
  781.    xoril %0,%1,%b2
  782.    xoriu %0,%1,%u2")
  783.  
  784. (define_insn ""
  785.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  786.     (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  787.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  788.             (const_int 0)))
  789.    (clobber (match_scratch:SI 3 "=r"))]
  790.   ""
  791.   "xor. %3,%1,%2"
  792.   [(set_attr "type" "compare")])
  793.  
  794. (define_insn ""
  795.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  796.     (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  797.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  798.             (const_int 0)))
  799.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  800.     (xor:SI (match_dup 1) (match_dup 2)))]
  801.   ""
  802.   "xor. %0,%1,%2"
  803.   [(set_attr "type" "compare")])
  804.  
  805. ;; Split an XOR that we can't do in one insn into two insns, each of which
  806. ;; does one 16-bit part.  This is used by combine.
  807.  
  808. (define_split
  809.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  810.     (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  811.         (match_operand:SI 2 "non_logical_cint_operand" "")))]
  812.   ""
  813.   [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3)))
  814.    (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))]
  815. "
  816. {
  817.   operands[3] = gen_rtx (CONST_INT, VOIDmode,
  818.              INTVAL (operands[2]) & 0xffff0000);
  819.   operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
  820. }")
  821.  
  822. (define_insn ""
  823.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  824.     (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
  825.             (match_operand:SI 2 "gpc_reg_operand" "r"))))]
  826.    ""
  827.    "eqv %0,%1,%2")
  828.  
  829. (define_insn ""
  830.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  831.     (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
  832.                     (match_operand:SI 2 "gpc_reg_operand" "r")))
  833.             (const_int 0)))
  834.    (clobber (match_scratch:SI 3 "=r"))]
  835.    ""
  836.    "eqv. %3,%1,%2"
  837.    [(set_attr "type" "compare")])
  838.  
  839. (define_insn ""
  840.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  841.     (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
  842.                     (match_operand:SI 2 "gpc_reg_operand" "r")))
  843.             (const_int 0)))
  844.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  845.     (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
  846.    ""
  847.    "eqv. %0,%1,%2"
  848.    [(set_attr "type" "compare")])
  849.  
  850. (define_insn ""
  851.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  852.     (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  853.         (match_operand:SI 2 "gpc_reg_operand" "r")))]
  854.   ""
  855.   "andc %0,%2,%1")
  856.  
  857. (define_insn ""
  858.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  859.     (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  860.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  861.             (const_int 0)))
  862.    (clobber (match_scratch:SI 3 "=r"))]
  863.   ""
  864.   "andc. %3,%2,%1"
  865.   [(set_attr "type" "compare")])
  866.  
  867. (define_insn ""
  868.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  869.     (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  870.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  871.             (const_int 0)))
  872.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  873.     (and:SI (not:SI (match_dup 1)) (match_dup 2)))]
  874.   ""
  875.   "andc. %0,%2,%1"
  876.   [(set_attr "type" "compare")])
  877.  
  878. (define_insn ""
  879.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  880.     (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  881.         (match_operand:SI 2 "gpc_reg_operand" "r")))]
  882.   ""
  883.   "orc %0,%2,%1")
  884.  
  885. (define_insn ""
  886.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  887.     (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  888.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  889.             (const_int 0)))
  890.    (clobber (match_scratch:SI 3 "=r"))]
  891.   ""
  892.   "orc. %3,%2,%1"
  893.   [(set_attr "type" "compare")])
  894.  
  895. (define_insn ""
  896.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  897.     (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  898.                 (match_operand:SI 2 "gpc_reg_operand" "r"))
  899.             (const_int 0)))
  900.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  901.     (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
  902.   ""
  903.   "orc. %0,%2,%1"
  904.   [(set_attr "type" "compare")])
  905.  
  906. (define_insn ""
  907.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  908.     (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  909.         (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
  910.   ""
  911.   "nand %0,%1,%2")
  912.  
  913. (define_insn ""
  914.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  915.     (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  916.                 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
  917.             (const_int 0)))
  918.    (clobber (match_scratch:SI 3 "=r"))]
  919.   ""
  920.   "nand. %3,%1,%2"
  921.   [(set_attr "type" "compare")])
  922.  
  923. (define_insn ""
  924.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  925.     (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  926.                 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
  927.             (const_int 0)))
  928.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  929.     (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
  930.   ""
  931.   "nand. %0,%1,%2"
  932.   [(set_attr "type" "compare")])
  933.  
  934. (define_insn ""
  935.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  936.     (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  937.         (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
  938.   ""
  939.   "nor %0,%1,%2")
  940.  
  941. (define_insn ""
  942.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  943.     (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  944.                 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
  945.             (const_int 0)))
  946.    (clobber (match_scratch:SI 3 "=r"))]
  947.   ""
  948.   "nor. %3,%1,%2"
  949.   [(set_attr "type" "compare")])
  950.  
  951. (define_insn ""
  952.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  953.     (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  954.                 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
  955.             (const_int 0)))
  956.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  957.     (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
  958.   ""
  959.   "nor. %0,%1,%2"
  960.   [(set_attr "type" "compare")])
  961.  
  962. ;; maskir insn.  We need four forms because things might be in arbitrary
  963. ;; orders.  Don't define forms that only set CR fields because these
  964. ;; would modify an input register.
  965.  
  966. (define_insn ""
  967.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  968.     (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
  969.             (match_operand:SI 1 "gpc_reg_operand" "0"))
  970.         (and:SI (match_dup 2)
  971.             (match_operand:SI 3 "gpc_reg_operand" "r"))))]
  972.   ""
  973.   "maskir %0,%3,%2")
  974.  
  975. (define_insn ""
  976.   [(set (match_operand:SI 0 "register_operand" "=r")
  977.     (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
  978.             (match_operand:SI 1 "gpc_reg_operand" "0"))
  979.         (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
  980.             (match_dup 2))))]
  981.   ""
  982.   "maskir %0,%3,%2")
  983.  
  984. (define_insn ""
  985.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  986.     (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  987.             (match_operand:SI 3 "gpc_reg_operand" "r"))
  988.         (and:SI (not:SI (match_dup 2))
  989.             (match_operand:SI 1 "gpc_reg_operand" "0"))))]
  990.   ""
  991.   "maskir %0,%3,%2")
  992.  
  993. (define_insn ""
  994.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  995.     (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
  996.             (match_operand:SI 2 "gpc_reg_operand" "r"))
  997.         (and:SI (not:SI (match_dup 2))
  998.             (match_operand:SI 1 "gpc_reg_operand" "0"))))]
  999.   ""
  1000.   "maskir %0,%3,%2")
  1001.  
  1002. (define_insn ""
  1003.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1004.     (compare:CC
  1005.      (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
  1006.              (match_operand:SI 1 "gpc_reg_operand" "0"))
  1007.          (and:SI (match_dup 2)
  1008.              (match_operand:SI 3 "gpc_reg_operand" "r")))
  1009.      (const_int 0)))
  1010.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1011.     (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
  1012.         (and:SI (match_dup 2) (match_dup 3))))]
  1013.   ""
  1014.   "maskir. %0,%3,%2"
  1015.   [(set_attr "type" "compare")])
  1016.  
  1017. (define_insn ""
  1018.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1019.     (compare:CC
  1020.      (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
  1021.              (match_operand:SI 1 "gpc_reg_operand" "0"))
  1022.          (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
  1023.              (match_dup 2)))
  1024.      (const_int 0)))
  1025.    (set (match_operand:SI 0 "register_operand" "=r")
  1026.     (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
  1027.         (and:SI (match_dup 3) (match_dup 2))))]
  1028.   ""
  1029.   "maskir. %0,%3,%2"
  1030.   [(set_attr "type" "compare")])
  1031.  
  1032. (define_insn ""
  1033.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1034.     (compare:CC
  1035.      (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  1036.              (match_operand:SI 3 "gpc_reg_operand" "r"))
  1037.          (and:SI (not:SI (match_dup 2))
  1038.              (match_operand:SI 1 "gpc_reg_operand" "0")))
  1039.      (const_int 0)))
  1040.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1041.     (ior:SI (and:SI (match_dup 2) (match_dup 3))
  1042.         (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
  1043.   ""
  1044.   "maskir. %0,%3,%2"
  1045.   [(set_attr "type" "compare")])
  1046.  
  1047. (define_insn ""
  1048.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1049.     (compare:CC
  1050.      (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
  1051.              (match_operand:SI 2 "gpc_reg_operand" "r"))
  1052.          (and:SI (not:SI (match_dup 2))
  1053.              (match_operand:SI 1 "gpc_reg_operand" "0")))
  1054.      (const_int 0)))
  1055.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1056.     (ior:SI (and:SI (match_dup 3) (match_dup 2))
  1057.         (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
  1058.   ""
  1059.   "maskir. %0,%3,%2"
  1060.   [(set_attr "type" "compare")])
  1061.  
  1062. ;; Rotate and shift insns, in all their variants.  These support shifts,
  1063. ;; field inserts and extracts, and various combinations thereof.
  1064. (define_insn "insv"
  1065.   [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
  1066.              (match_operand:SI 1 "const_int_operand" "i")
  1067.              (match_operand:SI 2 "const_int_operand" "i"))
  1068.     (match_operand:SI 3 "gpc_reg_operand" "r"))]
  1069.   ""
  1070.   "*
  1071. {
  1072.   int start = INTVAL (operands[2]) & 31;
  1073.   int size = INTVAL (operands[1]) & 31;
  1074.  
  1075.   operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size);
  1076.   operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
  1077.   return \"rlimi %0,%3,%4,%h2,%h1\";
  1078. }")
  1079.  
  1080. (define_insn "extzv"
  1081.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1082.     (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1083.              (match_operand:SI 2 "const_int_operand" "i")
  1084.              (match_operand:SI 3 "const_int_operand" "i")))]
  1085.   ""
  1086.   "*
  1087. {
  1088.   int start = INTVAL (operands[3]) & 31;
  1089.   int size = INTVAL (operands[2]) & 31;
  1090.  
  1091.   if (start + size >= 32)
  1092.     operands[3] = const0_rtx;
  1093.   else
  1094.     operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
  1095.   return \"rlinm %0,%1,%3,%s2,31\";
  1096. }")
  1097.  
  1098. (define_insn ""
  1099.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1100.     (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1101.              (match_operand:SI 2 "const_int_operand" "i")
  1102.              (match_operand:SI 3 "const_int_operand" "i"))
  1103.             (const_int 0)))
  1104.    (clobber (match_scratch:SI 4 "=r"))]
  1105.   ""
  1106.   "*
  1107. {
  1108.   int start = INTVAL (operands[3]) & 31;
  1109.   int size = INTVAL (operands[2]) & 31;
  1110.  
  1111.   /* If the bitfield being tested fits in the upper or lower half of a
  1112.      word, it is possible to use andiu. or andil. to test it.  This is
  1113.      useful because the condition register set-use delay is smaller for
  1114.      andi[ul]. than for rlinm.  This doesn't work when the starting bit
  1115.      position is 0 because the LT and GT bits may be set wrong.  */
  1116.  
  1117.   if ((start > 0 && start + size <= 16) || start >= 16)
  1118.     {
  1119.       operands[3] = gen_rtx (CONST_INT, VOIDmode,
  1120.                  ((1 << (16 - (start & 15)))
  1121.                   - (1 << (16 - (start & 15) - size))));
  1122.       if (start < 16)
  1123.     return \"andiu. %4,%1,%3\";
  1124.       else
  1125.     return \"andil. %4,%1,%3\";
  1126.     }
  1127.   
  1128.   if (start + size >= 32)
  1129.     operands[3] = const0_rtx;
  1130.   else
  1131.     operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
  1132.   return \"rlinm. %4,%1,%3,%s2,31\";
  1133. }"
  1134.   [(set_attr "type" "compare")])
  1135.  
  1136. (define_insn ""
  1137.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1138.     (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1139.              (match_operand:SI 2 "const_int_operand" "i")
  1140.              (match_operand:SI 3 "const_int_operand" "i"))
  1141.             (const_int 0)))
  1142.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1143.     (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
  1144.   ""
  1145.   "*
  1146. {
  1147.   int start = INTVAL (operands[3]) & 31;
  1148.   int size = INTVAL (operands[2]) & 31;
  1149.  
  1150.   if (start >= 16 && start + size == 32)
  1151.     {
  1152.       operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1);
  1153.       return \"andil. %0,%1,%3\";
  1154.     }
  1155.   
  1156.   if (start + size >= 32)
  1157.     operands[3] = const0_rtx;
  1158.   else
  1159.     operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
  1160.   return \"rlinm. %0,%1,%3,%s2,31\";
  1161. }"
  1162.   [(set_attr "type" "delayed_compare")])
  1163.  
  1164. (define_insn "rotlsi3"
  1165.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1166.     (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1167.            (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
  1168.   ""
  1169.   "rl%I2nm %0,%1,%h2,0,31")
  1170.  
  1171. (define_insn ""
  1172.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1173.     (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1174.                    (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1175.             (const_int 0)))
  1176.    (clobber (match_scratch:SI 3 "=r"))]
  1177.   ""
  1178.   "rl%I2nm. %3,%1,%h2,0,31"
  1179.   [(set_attr "type" "delayed_compare")])
  1180.  
  1181. (define_insn ""
  1182.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1183.     (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1184.                    (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1185.             (const_int 0)))
  1186.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1187.     (rotate:SI (match_dup 1) (match_dup 2)))]
  1188.   ""
  1189.   "rl%I2nm. %0,%1,%h2,0,31"
  1190.   [(set_attr "type" "delayed_compare")])
  1191.  
  1192. (define_insn ""
  1193.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1194.     (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1195.                (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1196.         (match_operand:SI 3 "mask_operand" "L")))]
  1197.   ""
  1198.   "rl%I2nm %0,%1,%h2,%m3,%M3")
  1199.  
  1200. (define_insn ""
  1201.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1202.     (compare:CC (and:SI
  1203.              (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1204.                 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1205.              (match_operand:SI 3 "mask_operand" "L"))
  1206.             (const_int 0)))
  1207.    (clobber (match_scratch:SI 4 "=r"))]
  1208.   ""
  1209.   "rl%I2nm. %4,%1,%h2,%m3,%M3"
  1210.   [(set_attr "type" "delayed_compare")])
  1211.  
  1212. (define_insn ""
  1213.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1214.     (compare:CC (and:SI
  1215.              (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1216.                 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
  1217.              (match_operand:SI 3 "mask_operand" "L"))
  1218.             (const_int 0)))
  1219.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1220.     (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
  1221.   ""
  1222.   "rl%I2nm. %0,%1,%h2,%m3,%M3"
  1223.   [(set_attr "type" "delayed_compare")])
  1224.  
  1225. (define_insn ""
  1226.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1227.     (zero_extend:SI
  1228.      (subreg:QI
  1229.       (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1230.              (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
  1231.   ""
  1232.   "rl%I2nm %0,%1,%h2,24,31")
  1233.  
  1234. (define_insn ""
  1235.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1236.     (compare:CC (zero_extend:SI
  1237.              (subreg:QI
  1238.               (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1239.                  (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
  1240.             (const_int 0)))
  1241.    (clobber (match_scratch:SI 3 "=r"))]
  1242.   ""
  1243.   "rl%I2nm. %3,%1,%h2,24,31"
  1244.   [(set_attr "type" "delayed_compare")])
  1245.  
  1246. (define_insn ""
  1247.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1248.     (compare:CC (zero_extend:SI
  1249.              (subreg:QI
  1250.               (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1251.                  (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
  1252.             (const_int 0)))
  1253.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1254.     (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
  1255.   ""
  1256.   "rl%I2nm. %0,%1,%h2,24,31"
  1257.   [(set_attr "type" "delayed_compare")])
  1258.  
  1259. (define_insn ""
  1260.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1261.     (zero_extend:SI
  1262.      (subreg:HI
  1263.       (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1264.              (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
  1265.   ""
  1266.   "rl%I2nm %0,%1,%h2,16,31")
  1267.  
  1268. (define_insn ""
  1269.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1270.     (compare:CC (zero_extend:SI
  1271.              (subreg:HI
  1272.               (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1273.                  (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
  1274.             (const_int 0)))
  1275.    (clobber (match_scratch:SI 3 "=r"))]
  1276.   ""
  1277.   "rl%I2nm. %3,%1,%h2,16,31"
  1278.   [(set_attr "type" "delayed_compare")])
  1279.  
  1280. (define_insn ""
  1281.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1282.     (compare:CC (zero_extend:SI
  1283.              (subreg:HI
  1284.               (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1285.                  (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
  1286.             (const_int 0)))
  1287.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1288.     (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
  1289.   ""
  1290.   "rl%I2nm. %0,%1,%h2,16,31"
  1291.   [(set_attr "type" "delayed_compare")])
  1292.  
  1293. ;; Note that we use "sle." instead of "sl." so that we can set
  1294. ;; SHIFT_COUNT_TRUNCATED.
  1295.  
  1296. (define_insn "ashlsi3"
  1297.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1298.     (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1299.            (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
  1300.    (clobber (match_scratch:SI 3 "=q,X"))]
  1301.   ""
  1302.   "@
  1303.    sle %0,%1,%2
  1304.    sli %0,%1,%h2")
  1305.  
  1306. (define_insn ""
  1307.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  1308.     (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1309.                    (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1310.             (const_int 0)))
  1311.    (clobber (match_scratch:SI 3 "=r,r"))
  1312.    (clobber (match_scratch:SI 4 "=q,X"))]
  1313.   ""
  1314.   "@
  1315.    sle. %3,%1,%2
  1316.    sli. %3,%1,%h2"
  1317.   [(set_attr "type" "delayed_compare")])
  1318.  
  1319. (define_insn ""
  1320.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  1321.     (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1322.                    (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1323.             (const_int 0)))
  1324.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1325.     (ashift:SI (match_dup 1) (match_dup 2)))
  1326.    (clobber (match_scratch:SI 4 "=q,X"))]
  1327.   ""
  1328.   "@
  1329.    sle. %0,%1,%2
  1330.    sli. %0,%1,%h2"
  1331.   [(set_attr "type" "delayed_compare")])
  1332.  
  1333. (define_insn ""
  1334.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1335.     (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1336.                (match_operand:SI 2 "const_int_operand" "i"))
  1337.         (match_operand:SI 3 "mask_operand" "L")))]
  1338.   "includes_lshift_p (operands[2], operands[3])"
  1339.   "rlinm %0,%h1,%h2,%m3,%M3")
  1340.  
  1341. (define_insn ""
  1342.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1343.     (compare:CC
  1344.      (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1345.                 (match_operand:SI 2 "const_int_operand" "i"))
  1346.          (match_operand:SI 3 "mask_operand" "L"))
  1347.      (const_int 0)))
  1348.    (clobber (match_scratch:SI 4 "=r"))]
  1349.   "includes_lshift_p (operands[2], operands[3])"
  1350.   "rlinm. %4,%h1,%h2,%m3,%M3"
  1351.   [(set_attr "type" "delayed_compare")])
  1352.  
  1353. (define_insn ""
  1354.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1355.     (compare:CC
  1356.      (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1357.                 (match_operand:SI 2 "const_int_operand" "i"))
  1358.          (match_operand:SI 3 "mask_operand" "L"))
  1359.      (const_int 0)))
  1360.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1361.     (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
  1362.   "includes_lshift_p (operands[2], operands[3])"
  1363.   "rlinm. %0,%h1,%h2,%m3,%M3"
  1364.   [(set_attr "type" "delayed_compare")])
  1365.  
  1366. ;; The RS/6000 assembler mis-handles "sri x,x,0", so write that case as
  1367. ;; "sli x,x,0".
  1368. (define_insn "lshrsi3"
  1369.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1370.     (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1371.              (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
  1372.    (clobber (match_scratch:SI 3 "=q,X"))]
  1373.   ""
  1374.   "@
  1375.   sre %0,%1,%2
  1376.   s%A2i %0,%1,%h2")
  1377.  
  1378. (define_insn ""
  1379.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  1380.     (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1381.                  (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1382.             (const_int 0)))
  1383.    (clobber (match_scratch:SI 3 "=r,r"))
  1384.    (clobber (match_scratch:SI 4 "=q,X"))]
  1385.   ""
  1386.   "@
  1387.   sre. %3,%1,%2
  1388.   s%A2i. %3,%1,%h2"
  1389.   [(set_attr "type" "delayed_compare")])
  1390.  
  1391. (define_insn ""
  1392.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  1393.     (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1394.                  (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1395.             (const_int 0)))
  1396.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1397.     (lshiftrt:SI (match_dup 1) (match_dup 2)))
  1398.    (clobber (match_scratch:SI 4 "=q,X"))]
  1399.   ""
  1400.   "@
  1401.   sre. %0,%1,%2
  1402.   s%A2i. %0,%1,%h2"
  1403.   [(set_attr "type" "delayed_compare")])
  1404.  
  1405. (define_insn ""
  1406.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1407.     (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1408.                  (match_operand:SI 2 "const_int_operand" "i"))
  1409.         (match_operand:SI 3 "mask_operand" "L")))]
  1410.   "includes_rshift_p (operands[2], operands[3])"
  1411.   "rlinm %0,%1,%s2,%m3,%M3")
  1412.  
  1413. (define_insn ""
  1414.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1415.     (compare:CC
  1416.      (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1417.                   (match_operand:SI 2 "const_int_operand" "i"))
  1418.          (match_operand:SI 3 "mask_operand" "L"))
  1419.      (const_int 0)))
  1420.    (clobber (match_scratch:SI 4 "=r"))]
  1421.   "includes_rshift_p (operands[2], operands[3])"
  1422.   "rlinm. %4,%1,%s2,%m3,%M3"
  1423.   [(set_attr "type" "delayed_compare")])
  1424.  
  1425. (define_insn ""
  1426.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  1427.     (compare:CC
  1428.      (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1429.                   (match_operand:SI 2 "const_int_operand" "i"))
  1430.          (match_operand:SI 3 "mask_operand" "L"))
  1431.      (const_int 0)))
  1432.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1433.     (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
  1434.   "includes_rshift_p (operands[2], operands[3])"
  1435.   "rlinm. %0,%1,%s2,%m3,%M3"
  1436.   [(set_attr "type" "delayed_compare")])
  1437.  
  1438. (define_insn ""
  1439.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1440.     (zero_extend:SI
  1441.      (subreg:QI
  1442.       (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1443.                (match_operand:SI 2 "const_int_operand" "i")) 0)))]
  1444.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
  1445.   "rlinm %0,%1,%s2,24,31")
  1446.  
  1447. (define_insn ""
  1448.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1449.     (compare:CC
  1450.      (zero_extend:SI
  1451.       (subreg:QI
  1452.        (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1453.             (match_operand:SI 2 "const_int_operand" "i")) 0))
  1454.      (const_int 0)))
  1455.    (clobber (match_scratch:SI 3 "=r"))]
  1456.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
  1457.   "rlinm. %3,%1,%s2,24,31"
  1458.   [(set_attr "type" "delayed_compare")])
  1459.  
  1460. (define_insn ""
  1461.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1462.     (compare:CC
  1463.      (zero_extend:SI
  1464.       (subreg:QI
  1465.        (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1466.             (match_operand:SI 2 "const_int_operand" "i")) 0))
  1467.      (const_int 0)))
  1468.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1469.     (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
  1470.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
  1471.   "rlinm. %0,%1,%s2,24,31"
  1472.   [(set_attr "type" "delayed_compare")])
  1473.  
  1474. (define_insn ""
  1475.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1476.     (zero_extend:SI
  1477.      (subreg:HI
  1478.       (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1479.                (match_operand:SI 2 "const_int_operand" "i")) 0)))]
  1480.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
  1481.   "rlinm %0,%1,%s2,16,31")
  1482.  
  1483. (define_insn ""
  1484.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  1485.     (compare:CC
  1486.      (zero_extend:SI
  1487.       (subreg:HI
  1488.        (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1489.             (match_operand:SI 2 "const_int_operand" "i")) 0))
  1490.      (const_int 0)))
  1491.    (clobber (match_scratch:SI 3 "=r"))]
  1492.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
  1493.   "rlinm. %3,%1,%s2,16,31"
  1494.   [(set_attr "type" "delayed_compare")])
  1495.  
  1496. (define_insn ""
  1497.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  1498.     (compare:CC
  1499.      (zero_extend:SI
  1500.       (subreg:HI
  1501.        (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  1502.             (match_operand:SI 2 "const_int_operand" "i")) 0))
  1503.      (const_int 0)))
  1504.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  1505.     (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
  1506.   "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
  1507.   "rlinm. %0,%1,%s2,16,31"
  1508.   [(set_attr "type" "delayed_compare")])
  1509.  
  1510. (define_insn ""
  1511.   [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
  1512.              (const_int 1)
  1513.              (match_operand:SI 1 "gpc_reg_operand" "r"))
  1514.     (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  1515.              (const_int 31)))]
  1516.   ""
  1517.   "rrib %0,%1,%2")
  1518.  
  1519. (define_insn ""
  1520.   [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
  1521.              (const_int 1)
  1522.              (match_operand:SI 1 "gpc_reg_operand" "r"))
  1523.     (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  1524.              (const_int 31)))]
  1525.   ""
  1526.   "rrib %0,%1,%2")
  1527.  
  1528. (define_insn ""
  1529.   [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
  1530.              (const_int 1)
  1531.              (match_operand:SI 1 "gpc_reg_operand" "r"))
  1532.     (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
  1533.              (const_int 1)
  1534.              (const_int 0)))]
  1535.   ""
  1536.   "rrib %0,%1,%2")
  1537.  
  1538. (define_insn "ashrsi3"
  1539.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1540.     (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1541.              (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
  1542.    (clobber (match_scratch:SI 3 "=q,X"))]
  1543.   ""
  1544.   "@
  1545.    srea %0,%1,%2
  1546.    srai %0,%1,%h2")
  1547.  
  1548. (define_insn ""
  1549.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  1550.     (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1551.                  (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1552.             (const_int 0)))
  1553.    (clobber (match_scratch:SI 3 "=r,r"))
  1554.    (clobber (match_scratch:SI 4 "=q,X"))]
  1555.   ""
  1556.   "@
  1557.    srea. %3,%1,%2
  1558.    srai. %3,%1,%h2"
  1559.   [(set_attr "type" "delayed_compare")])
  1560.  
  1561. (define_insn ""
  1562.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  1563.     (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  1564.                  (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
  1565.             (const_int 0)))
  1566.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  1567.     (ashiftrt:SI (match_dup 1) (match_dup 2)))
  1568.    (clobber (match_scratch:SI 4 "=q,X"))]
  1569.   ""
  1570.   "@
  1571.    srea. %0,%1,%2
  1572.    srai. %0,%1,%h2"
  1573.   [(set_attr "type" "delayed_compare")])
  1574.  
  1575. (define_expand "extendqisi2"
  1576.   [(parallel [(set (match_dup 2)
  1577.            (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
  1578.                   (const_int 24)))
  1579.           (clobber (scratch:SI))])
  1580.    (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
  1581.            (ashiftrt:SI (match_dup 2)
  1582.                 (const_int 24)))
  1583.           (clobber (scratch:SI))])]
  1584.   ""
  1585.   "
  1586. { operands[1] = gen_lowpart (SImode, operands[1]);
  1587.   operands[2] = gen_reg_rtx (SImode); }")
  1588.  
  1589. (define_expand "extendqihi2"
  1590.   [(parallel [(set (match_dup 2)
  1591.            (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
  1592.                   (const_int 24)))
  1593.           (clobber (scratch:SI))])
  1594.    (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
  1595.            (ashiftrt:SI (match_dup 2)
  1596.                 (const_int 24)))
  1597.           (clobber (scratch:SI))])]
  1598.   ""
  1599.   "
  1600. { operands[0] = gen_lowpart (SImode, operands[0]);
  1601.   operands[1] = gen_lowpart (SImode, operands[1]);
  1602.   operands[2] = gen_reg_rtx (SImode); }")
  1603.  
  1604. ;; Floating-point insns, excluding normal data motion.
  1605. ;;
  1606. ;; We pretend that we have both SFmode and DFmode insns, while, in fact,
  1607. ;; all fp insns are actually done in double.  The only conversions we will
  1608. ;; do will be when storing to memory.  In that case, we will use the "frsp"
  1609. ;; instruction before storing.
  1610. ;;
  1611. ;; Note that when we store into a single-precision memory location, we need to
  1612. ;; use the frsp insn first.  If the register being stored isn't dead, we
  1613. ;; need a scratch register for the frsp.  But this is difficult when the store
  1614. ;; is done by reload.  It is not incorrect to do the frsp on the register in
  1615. ;; this case, we just lose precision that we would have otherwise gotten but
  1616. ;; is not guaranteed.  Perhaps this should be tightened up at some point.
  1617.  
  1618. (define_insn "extendsfdf2"
  1619.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1620.     (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
  1621.   ""
  1622.   "*
  1623. {
  1624.   if (REGNO (operands[0]) == REGNO (operands[1]))
  1625.     return \"\";
  1626.   else
  1627.     return \"fmr %0,%1\";
  1628. }"
  1629.   [(set_attr "type" "fp")])
  1630.  
  1631. (define_insn "truncdfsf2"
  1632.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1633.     (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
  1634.   ""
  1635.   "*
  1636. {
  1637.   if (REGNO (operands[0]) == REGNO (operands[1]))
  1638.     return \"\";
  1639.   else
  1640.     return \"fmr %0,%1\";
  1641. }"
  1642.   [(set_attr "type" "fp")])
  1643.  
  1644. (define_insn "negsf2"
  1645.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1646.     (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
  1647.   ""
  1648.   "fneg %0,%1"
  1649.   [(set_attr "type" "fp")])
  1650.  
  1651. (define_insn "abssf2"
  1652.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1653.     (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
  1654.   ""
  1655.   "fabs %0,%1"
  1656.   [(set_attr "type" "fp")])
  1657.  
  1658. (define_insn ""
  1659.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1660.     (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
  1661.   ""
  1662.   "fnabs %0,%1"
  1663.   [(set_attr "type" "fp")])
  1664.  
  1665. (define_insn "addsf3"
  1666.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1667.     (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  1668.          (match_operand:SF 2 "gpc_reg_operand" "f")))]
  1669.   ""
  1670.   "fa %0,%1,%2"
  1671.   [(set_attr "type" "fp")])
  1672.  
  1673. (define_insn "subsf3"
  1674.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1675.     (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
  1676.           (match_operand:SF 2 "gpc_reg_operand" "f")))]
  1677.   ""
  1678.   "fs %0,%1,%2"
  1679.   [(set_attr "type" "fp")])
  1680.  
  1681. (define_insn "mulsf3"
  1682.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1683.     (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  1684.          (match_operand:SF 2 "gpc_reg_operand" "f")))]
  1685.   ""
  1686.   "fm %0,%1,%2"
  1687.   [(set_attr "type" "fp")])
  1688.  
  1689. (define_insn "divsf3"
  1690.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1691.     (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
  1692.         (match_operand:SF 2 "gpc_reg_operand" "f")))]
  1693.   ""
  1694.   "fd %0,%1,%2"
  1695.   [(set_attr "type" "fp")])
  1696.  
  1697. (define_insn ""
  1698.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1699.     (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  1700.               (match_operand:SF 2 "gpc_reg_operand" "f"))
  1701.          (match_operand:SF 3 "gpc_reg_operand" "f")))]
  1702.   ""
  1703.   "fma %0,%1,%2,%3"
  1704.   [(set_attr "type" "fp")])
  1705.  
  1706. (define_insn ""
  1707.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1708.     (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  1709.                (match_operand:SF 2 "gpc_reg_operand" "f"))
  1710.           (match_operand:SF 3 "gpc_reg_operand" "f")))]
  1711.   ""
  1712.   "fms %0,%1,%2,%3"
  1713.   [(set_attr "type" "fp")])
  1714.  
  1715. (define_insn ""
  1716.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1717.     (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  1718.                   (match_operand:SF 2 "gpc_reg_operand" "f"))
  1719.              (match_operand:SF 3 "gpc_reg_operand" "f"))))]
  1720.   ""
  1721.   "fnma %0,%1,%2,%3"
  1722.   [(set_attr "type" "fp")])
  1723.  
  1724. (define_insn ""
  1725.   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
  1726.     (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
  1727.                    (match_operand:SF 2 "gpc_reg_operand" "f"))
  1728.               (match_operand:SF 3 "gpc_reg_operand" "f"))))]
  1729.   ""
  1730.   "fnms %0,%1,%2,%3"
  1731.   [(set_attr "type" "fp")])
  1732.  
  1733. (define_insn "negdf2"
  1734.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1735.     (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
  1736.   ""
  1737.   "fneg %0,%1"
  1738.   [(set_attr "type" "fp")])
  1739.  
  1740. (define_insn "absdf2"
  1741.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1742.     (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
  1743.   ""
  1744.   "fabs %0,%1"
  1745.   [(set_attr "type" "fp")])
  1746.  
  1747. (define_insn ""
  1748.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1749.     (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
  1750.   ""
  1751.   "fnabs %0,%1"
  1752.   [(set_attr "type" "fp")])
  1753.  
  1754. (define_insn "adddf3"
  1755.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1756.     (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  1757.          (match_operand:DF 2 "gpc_reg_operand" "f")))]
  1758.   ""
  1759.   "fa %0,%1,%2"
  1760.   [(set_attr "type" "fp")])
  1761.  
  1762. (define_insn "subdf3"
  1763.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1764.     (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
  1765.           (match_operand:DF 2 "gpc_reg_operand" "f")))]
  1766.   ""
  1767.   "fs %0,%1,%2"
  1768.   [(set_attr "type" "fp")])
  1769.  
  1770. (define_insn "muldf3"
  1771.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1772.     (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  1773.          (match_operand:DF 2 "gpc_reg_operand" "f")))]
  1774.   ""
  1775.   "fm %0,%1,%2"
  1776.   [(set_attr "type" "fp")])
  1777.  
  1778. (define_insn "divdf3"
  1779.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1780.     (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
  1781.         (match_operand:DF 2 "gpc_reg_operand" "f")))]
  1782.   ""
  1783.   "fd %0,%1,%2"
  1784.   [(set_attr "type" "fp")])
  1785.  
  1786. (define_insn ""
  1787.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1788.     (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  1789.               (match_operand:DF 2 "gpc_reg_operand" "f"))
  1790.          (match_operand:DF 3 "gpc_reg_operand" "f")))]
  1791.   ""
  1792.   "fma %0,%1,%2,%3"
  1793.   [(set_attr "type" "fp")])
  1794.  
  1795. (define_insn ""
  1796.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1797.     (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  1798.                (match_operand:DF 2 "gpc_reg_operand" "f"))
  1799.           (match_operand:DF 3 "gpc_reg_operand" "f")))]
  1800.   ""
  1801.   "fms %0,%1,%2,%3"
  1802.   [(set_attr "type" "fp")])
  1803.  
  1804. (define_insn ""
  1805.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1806.     (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  1807.                   (match_operand:DF 2 "gpc_reg_operand" "f"))
  1808.              (match_operand:DF 3 "gpc_reg_operand" "f"))))]
  1809.   ""
  1810.   "fnma %0,%1,%2,%3"
  1811.   [(set_attr "type" "fp")])
  1812.  
  1813. (define_insn ""
  1814.   [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
  1815.     (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
  1816.                    (match_operand:DF 2 "gpc_reg_operand" "f"))
  1817.               (match_operand:DF 3 "gpc_reg_operand" "f"))))]
  1818.   ""
  1819.   "fnms %0,%1,%2,%3"
  1820.   [(set_attr "type" "fp")])
  1821.  
  1822. ;; Conversions to and from floating-point.
  1823. (define_expand "floatsidf2"
  1824.   [(set (match_dup 2)
  1825.     (plus:DI (zero_extend:DI
  1826.           (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  1827.               (match_dup 3)))
  1828.          (match_dup 4)))
  1829.    (set (match_operand:DF 0 "gpc_reg_operand" "")
  1830.     (minus:DF (subreg:DF (match_dup 2) 0)
  1831.           (match_dup 5)))]
  1832.   ""
  1833.   "
  1834. {
  1835. #if HOST_BITS_PER_INT != BITS_PER_WORD
  1836.   /* Maybe someone can figure out how to do this in that case.  I don't
  1837.      want to right now.  */
  1838.   abort ();
  1839. #endif
  1840.  
  1841.   operands[2] = gen_reg_rtx (DImode);
  1842.   operands[3] = gen_rtx (CONST_INT, VOIDmode, 0x80000000);
  1843.   operands[4] = immed_double_const (0, 0x43300000, DImode);
  1844.   operands[5] = force_reg (DFmode, immed_double_const (0x43300000,
  1845.                                0x80000000, DFmode));
  1846. }")
  1847.  
  1848. (define_expand "floatunssidf2"
  1849.   [(set (match_dup 2)
  1850.     (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
  1851.          (match_dup 3)))
  1852.    (set (match_operand:DF 0 "gpc_reg_operand" "")
  1853.     (minus:DF (subreg:DF (match_dup 2) 0)
  1854.           (match_dup 4)))]
  1855.   ""
  1856.   "
  1857. {
  1858. #if HOST_BITS_PER_INT != BITS_PER_WORD
  1859.   /* Maybe someone can figure out how to do this in that case.  I don't
  1860.      want to right now.  */
  1861.   abort ();
  1862. #endif
  1863.  
  1864.   operands[2] = gen_reg_rtx (DImode);
  1865.   operands[3] = immed_double_const (0, 0x43300000, DImode);
  1866.   operands[4] = force_reg (DFmode, immed_double_const (0x43300000, 0, DFmode));
  1867. }")
  1868.  
  1869. ;; For the above two cases, we always split.
  1870. (define_split
  1871.   [(set (match_operand:DI 0 "gpc_reg_operand" "")
  1872.     (plus:DI (zero_extend:DI
  1873.           (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
  1874.               (match_operand:SI 2 "logical_operand" "")))
  1875.          (match_operand:DI 3 "immediate_operand" "")))]
  1876.   "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD
  1877.    && GET_CODE (operands[3]) == CONST_DOUBLE
  1878.    && CONST_DOUBLE_LOW (operands[3]) == 0"
  1879.   [(set (match_dup 6) (xor:SI (match_dup 1) (match_dup 2)))
  1880.    (set (match_dup 4) (match_dup 5))]
  1881.   "
  1882. { operands[4] = operand_subword (operands[0], 0, 0, DImode);
  1883.   operands[5] = operand_subword (operands[3], 0, 0, DImode);
  1884.   operands[6] = operand_subword (operands[0], 1, 0, DImode);
  1885. }")
  1886.  
  1887. (define_insn ""
  1888.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  1889.     (plus:DI (zero_extend:DI
  1890.           (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
  1891.               (match_operand:SI 2 "logical_operand" "rKJ")))
  1892.          (match_operand:DI 3 "immediate_operand" "n")))]
  1893.   "HOST_BITS_PER_INT == BITS_PER_WORD
  1894.    && GET_CODE (operands[3]) == CONST_DOUBLE
  1895.    && CONST_DOUBLE_LOW (operands[3]) == 0"
  1896.   "#")
  1897.   
  1898. (define_split
  1899.   [(set (match_operand:DI 0 "gpc_reg_operand" "=")
  1900.     (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
  1901.          (match_operand:DI 2 "immediate_operand" "")))]
  1902.   "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD
  1903.    && GET_CODE (operands[2]) == CONST_DOUBLE
  1904.    && CONST_DOUBLE_LOW (operands[2]) == 0"
  1905.   [(set (match_dup 3) (match_dup 4))
  1906.    (set (match_dup 5) (match_dup 1))]
  1907.   "
  1908. { operands[3] = operand_subword (operands[0], 0, 0, DImode);
  1909.   operands[4] = operand_subword (operands[2], 0, 0, DImode);
  1910.   operands[5] = operand_subword (operands[0], 1, 0, DImode);
  1911.  
  1912.   if (rtx_equal_p (operands[1], operands[5]))
  1913.     {
  1914.       emit_move_insn (operands[3], operands[4]);
  1915.       DONE;
  1916.     }
  1917.  
  1918.   if (rtx_equal_p (operands[1], operands[3]))
  1919.     {
  1920.       rtx temp;
  1921.  
  1922.       temp = operands[3]; operands[3] = operands[5]; operands[5] = temp;
  1923.       temp = operands[4]; operands[4] = operands[1]; operands[1] = temp;
  1924.     }
  1925. }")
  1926.  
  1927. (define_insn ""
  1928.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  1929.     (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
  1930.          (match_operand:DI 2 "immediate_operand" "n")))]
  1931.   "HOST_BITS_PER_INT == BITS_PER_WORD
  1932.    && GET_CODE (operands[2]) == CONST_DOUBLE
  1933.    && CONST_DOUBLE_LOW (operands[2]) == 0"
  1934.   "#")
  1935.  
  1936. (define_expand "fix_truncdfsi2"
  1937.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  1938.     (fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
  1939.   ""
  1940.   "
  1941. {
  1942.   emit_insn (gen_trunc_call (operands[0], operands[1],
  1943.                  gen_rtx (SYMBOL_REF, Pmode, \"itrunc\")));
  1944.   DONE;
  1945. }")
  1946.  
  1947. (define_expand "fixuns_truncdfsi2"
  1948.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  1949.     (unsigned_fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
  1950.   ""
  1951.   "
  1952. {
  1953.   emit_insn (gen_trunc_call (operands[0], operands[1],
  1954.                  gen_rtx (SYMBOL_REF, Pmode, \"uitrunc\")));
  1955.   DONE;
  1956. }")
  1957.  
  1958.  
  1959. (define_expand "trunc_call"
  1960.   [(parallel [(set (match_operand:SI 0 "" "")
  1961.            (fix:DF (match_operand:DF 1 "" "")))
  1962.           (use (match_operand:SI 2 "" ""))])]
  1963.   ""
  1964.   "
  1965. {
  1966.   rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
  1967.   rtx first = XVECEXP (insns, 0, 0);
  1968.   rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
  1969.  
  1970.   REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
  1971.                    REG_NOTES (first));
  1972.   REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
  1973.  
  1974.   emit_insn (insns);
  1975.   DONE;
  1976. }")
  1977.  
  1978. (define_expand "trunc_call_rtl"
  1979.   [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
  1980.    (use (reg:DF 33))
  1981.    (parallel [(set (reg:SI 3)
  1982.            (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
  1983.           (clobber (scratch:SI))])
  1984.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  1985.     (reg:SI 3))]
  1986.   ""
  1987.   "
  1988.   rs6000_trunc_used = 1;
  1989. }")
  1990.  
  1991. ;; Define the DImode operations that can be done in a small number
  1992. ;; of instructions.
  1993. (define_insn "adddi3"
  1994.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  1995.     (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
  1996.          (match_operand:DI 2 "gpc_reg_operand" "r")))]
  1997.   ""
  1998.   "a %L0,%L1,%L2\;ae %0,%1,%2")
  1999.  
  2000. (define_insn "subdi3"
  2001.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2002.     (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
  2003.           (match_operand:DI 2 "gpc_reg_operand" "r")))]
  2004.   ""
  2005.   "sf %L0,%L2,%L1\;sfe %0,%2,%1")
  2006.  
  2007. (define_insn "negdi2"
  2008.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2009.     (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
  2010.   ""
  2011.   "sfi %L0,%L1,0\;sfze %0,%1")
  2012.  
  2013. (define_insn "mulsidi3"
  2014.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
  2015.     (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
  2016.          (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
  2017.    (clobber (match_scratch:SI 3 "=q"))]
  2018.   ""
  2019.   "mul %0,%1,%2\;mfmq %L0")
  2020.  
  2021. ;; If operands 0 and 2 are in the same register, we have a problem.  But
  2022. ;; operands 0 and 1 (the usual case) can be in the same register.  That's
  2023. ;; why we have the strange constraints below.
  2024. (define_insn "ashldi3"
  2025.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
  2026.     (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
  2027.            (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
  2028.    (clobber (match_scratch:SI 3 "=X,q,q,q"))]
  2029.   ""
  2030.   "@
  2031.    sli %0,%L1,%h2\;cal %L0,0(0)
  2032.    sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
  2033.    sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
  2034.    sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2")
  2035.  
  2036. (define_insn "lshrdi3"
  2037.   [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r")
  2038.     (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
  2039.              (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
  2040.    (clobber (match_scratch:SI 3 "=X,q,q,q"))]
  2041.   ""
  2042.   "@
  2043.    cal %0,0(0)\;s%A2i %L0,%1,%h2
  2044.    sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
  2045.    sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
  2046.    sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2")
  2047.  
  2048. ;; Shift by a variable amount is too complex to be worth open-coding.  We
  2049. ;; just handle shifts by constants.
  2050.  
  2051. (define_expand "ashrdi3"
  2052.   [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=")
  2053.            (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
  2054.                 (match_operand:SI 2 "general_operand" "")))
  2055.           (clobber (match_scratch:SI 3 ""))])]
  2056.   ""
  2057.   "
  2058. { if (GET_CODE (operands[2]) != CONST_INT)
  2059.     FAIL;
  2060. }")
  2061.  
  2062. (define_insn ""
  2063.   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
  2064.     (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
  2065.              (match_operand:SI 2 "const_int_operand" "M,i")))
  2066.    (clobber (match_scratch:SI 3 "=X,q"))]
  2067.   ""
  2068.   "@
  2069.    srai %0,%1,31\;srai %L0,%1,%h2
  2070.    sraiq %0,%1,%h2\;srliq %L0,%L1,%h2")
  2071.  
  2072. ;; Now define ways of moving data around.
  2073. ;;
  2074. ;; For SI, we special-case integers that can't be loaded in one insn.  We
  2075. ;; do the load 16-bits at a time.  We could do this by loading from memory,
  2076. ;; and this is even supposed to be faster, but it is simpler not to get
  2077. ;; integers in the TOC.
  2078. (define_expand "movsi"
  2079.   [(set (match_operand:SI 0 "general_operand" "")
  2080.     (match_operand:SI 1 "any_operand" ""))]
  2081.   ""
  2082.   "
  2083. {
  2084.   if (GET_CODE (operands[0]) != REG)
  2085.     operands[1] = force_reg (SImode, operands[1]);
  2086.  
  2087.   if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
  2088.     operands[1] = force_const_mem (SImode, operands[1]);
  2089.  
  2090.   if (GET_CODE (operands[1]) == CONST_INT
  2091.       && (unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
  2092.       && (INTVAL (operands[1]) & 0xffff) != 0)
  2093.     {
  2094.       emit_move_insn (operands[0],
  2095.               gen_rtx (CONST_INT, VOIDmode,
  2096.                    INTVAL (operands[1]) & 0xffff0000));
  2097.       emit_insn (gen_iorsi3 (operands[0], operands[0],
  2098.                  gen_rtx (CONST_INT, VOIDmode,
  2099.                       INTVAL (operands[1]) & 0xffff)));
  2100.       DONE;
  2101.     }
  2102. }")
  2103.  
  2104. (define_insn ""
  2105.   [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,m,r,r,r,*c*q,*l")
  2106.     (match_operand:SI 1 "input_operand" "r,m,r,I,J,*h,r,r"))]
  2107.   "gpc_reg_operand (operands[0], SImode)
  2108.    || gpc_reg_operand (operands[1], SImode)"
  2109.   "@
  2110.    ai %0,%1,0
  2111.    l%U1%X1 %0,%1
  2112.    st%U0%X0 %1,%0
  2113.    cal %0,%1(0)
  2114.    cau %0,0,%u1
  2115.    mf%1 %0
  2116.    mt%0 %1
  2117.    mt%0 %1"
  2118.   [(set_attr "type" "*,load,*,*,*,*,*,mtlr")])
  2119.  
  2120. ;; Split a load of a large constant into the appropriate two-insn
  2121. ;; sequence.
  2122.  
  2123. (define_split
  2124.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  2125.     (match_operand:SI 1 "const_int_operand" ""))]
  2126.   "(unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
  2127.    && (INTVAL (operands[1]) & 0xffff) != 0"
  2128.   [(set (match_dup 0)
  2129.     (match_dup 2))
  2130.    (set (match_dup 0)
  2131.     (ior:SI (match_dup 0)
  2132.         (match_dup 3)))]
  2133.   "
  2134. {
  2135.   operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2136.              INTVAL (operands[1]) & 0xffff0000);
  2137.   operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
  2138. }")
  2139.  
  2140. (define_insn ""
  2141.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  2142.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
  2143.             (const_int 0)))
  2144.    (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
  2145.   ""
  2146.   "ai. %0,%1,0"
  2147.   [(set_attr "type" "compare")])
  2148.  
  2149. (define_expand "movhi"
  2150.   [(set (match_operand:HI 0 "general_operand" "")
  2151.     (match_operand:HI 1 "any_operand" ""))]
  2152.   ""
  2153.   "
  2154. {
  2155.   if (GET_CODE (operands[0]) != REG)
  2156.     operands[1] = force_reg (HImode, operands[1]);
  2157.  
  2158.   if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
  2159.     operands[1] = force_const_mem (HImode, operands[1]);
  2160. }")
  2161.  
  2162. (define_insn ""
  2163.   [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*h")
  2164.     (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r"))]
  2165.   "gpc_reg_operand (operands[0], HImode)
  2166.    || gpc_reg_operand (operands[1], HImode)"
  2167.   "@
  2168.    oril %0,%1,0
  2169.    lhz%U1%X1 %0,%1
  2170.    sth%U0%X0 %1,%0
  2171.    cal %0,%w1(0)
  2172.    mf%1 %0
  2173.    mt%0 %1"
  2174.   [(set_attr "type" "*,load,*,*,*,*")])
  2175.  
  2176. (define_expand "movqi"
  2177.   [(set (match_operand:QI 0 "general_operand" "")
  2178.     (match_operand:QI 1 "any_operand" ""))]
  2179.   ""
  2180.   "
  2181. {
  2182.   if (GET_CODE (operands[0]) != REG)
  2183.     operands[1] = force_reg (QImode, operands[1]);
  2184.  
  2185.   if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
  2186.     operands[1] = force_const_mem (QImode, operands[1]);
  2187. }")
  2188.  
  2189. (define_insn ""
  2190.   [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*h")
  2191.     (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r"))]
  2192.   "gpc_reg_operand (operands[0], QImode)
  2193.    || gpc_reg_operand (operands[1], QImode)"
  2194.   "@
  2195.    oril %0,%1,0
  2196.    lbz%U1%X1 %0,%1
  2197.    stb%U0%X0 %1,%0
  2198.    cal %0,%1(0)
  2199.    mf%1 %0
  2200.    mt%0 %1"
  2201.   [(set_attr "type" "*,load,*,*,*,*")])
  2202.  
  2203. ;; Here is how to move condition codes around.  When we store CC data in
  2204. ;; an integer register or memory, we store just the high-order 4 bits.
  2205. ;; This lets us not shift in the most common case of CR0.
  2206. (define_expand "movcc"
  2207.   [(set (match_operand:CC 0 "nonimmediate_operand" "")
  2208.     (match_operand:CC 1 "nonimmediate_operand" ""))]
  2209.   ""
  2210.   "")
  2211.  
  2212. (define_insn ""
  2213.   [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
  2214.     (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
  2215.   "register_operand (operands[0], CCmode)
  2216.    || register_operand (operands[1], CCmode)"
  2217.   "@
  2218.    mcrf %0,%1
  2219.    mtcrf 128,%1
  2220.    rlinm %1,%1,%F0,0,31\;mtcrf %R0,%1\;rlinm %1,%1,%f0,0,31
  2221.    mfcr %0
  2222.    mfcr %0\;rlinm %0,%0,%f1,0,3
  2223.    ai %0,%1,0
  2224.    l%U1%X1 %0,%1
  2225.    st%U0%U1 %1,%0"
  2226.   [(set_attr "type" "*,*,*,compare,*,*,load,*")])
  2227.  
  2228. ;; For floating-point, we normally deal with the floating-point registers.
  2229. ;; The sole exception is that parameter passing can produce floating-point
  2230. ;; values in fixed-point registers.  Unless the value is a simple constant
  2231. ;; or already in memory, we deal with this by allocating memory and copying
  2232. ;; the value explicitly via that memory location.
  2233. (define_expand "movsf"
  2234.   [(set (match_operand:SF 0 "nonimmediate_operand" "")
  2235.     (match_operand:SF 1 "any_operand" ""))]
  2236.   ""
  2237.   "
  2238. {
  2239.   /* If we are called from reload, we might be getting a SUBREG of a hard
  2240.      reg.  So expand it.  */
  2241.   if (GET_CODE (operands[0]) == SUBREG
  2242.       && GET_CODE (SUBREG_REG (operands[0])) == REG
  2243.       && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
  2244.     operands[0] = alter_subreg (operands[0]);
  2245.   if (GET_CODE (operands[1]) == SUBREG
  2246.       && GET_CODE (SUBREG_REG (operands[1])) == REG
  2247.       && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
  2248.     operands[1] = alter_subreg (operands[1]);
  2249.  
  2250.   /* If we are being called from reload, it is possible that operands[1]
  2251.      is a hard non-fp register.  So handle those cases.  */
  2252.   if (reload_in_progress && GET_CODE (operands[1]) == REG
  2253.       && REGNO (operands[1]) < 32)
  2254.     {
  2255.       rtx stack_slot;
  2256.  
  2257.       /* Remember that we only see a pseudo here if it didn't get a hard
  2258.      register, so it is memory.  */
  2259.       if (GET_CODE (operands[0]) == MEM
  2260.       || (GET_CODE (operands[0]) == REG
  2261.           && (REGNO (operands[0]) < 32
  2262.           || REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
  2263.       || (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32))
  2264.     {
  2265.       emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
  2266.               operand_subword (operands[1], 0, 0, SFmode));
  2267.       DONE;
  2268.     }
  2269.  
  2270.       stack_slot = gen_rtx (MEM, SFmode, plus_constant (stack_pointer_rtx, 4));
  2271.       emit_move_insn (stack_slot, operands[1]);
  2272.       emit_move_insn (operands[0], stack_slot);
  2273.       DONE;
  2274.     }
  2275.  
  2276.   if (GET_CODE (operands[0]) == MEM)
  2277.     operands[1] = force_reg (SFmode, operands[1]);
  2278.  
  2279.   if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
  2280.     {
  2281.       rtx stack_slot;
  2282.  
  2283.       if (GET_CODE (operands[1]) == MEM
  2284. #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
  2285.       || GET_CODE (operands[1]) == CONST_DOUBLE
  2286. #endif
  2287.       || (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
  2288.       || (reload_in_progress && GET_CODE (operands[1]) == REG
  2289.           && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))
  2290.     {
  2291.       emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
  2292.               operand_subword (operands[1], 0, 0, SFmode));
  2293.       DONE;
  2294.     }
  2295.  
  2296.       if (reload_in_progress)
  2297.     stack_slot = gen_rtx (MEM, SFmode,
  2298.                   plus_constant (stack_pointer_rtx, 4));
  2299.       else
  2300.     stack_slot = assign_stack_temp (SFmode, 4, 0);
  2301.       emit_move_insn (stack_slot, operands[1]);
  2302.       emit_move_insn (operands[0], stack_slot);
  2303.       DONE;
  2304.     }
  2305.  
  2306.   if (CONSTANT_P (operands[1]))
  2307.     {
  2308.       operands[1] = force_const_mem (SFmode, operands[1]);
  2309.       if (! memory_address_p (SFmode, XEXP (operands[1], 0))
  2310.       && ! reload_in_progress)
  2311.     operands[1] = change_address (operands[1], SFmode,
  2312.                       XEXP (operands[1], 0));
  2313.     }
  2314. }")
  2315.  
  2316. (define_insn ""
  2317.   [(set (match_operand:SF 0 "gpc_reg_operand" "=r,r")
  2318.     (match_operand:SF 1 "mem_or_easy_const_operand" "G,m"))]
  2319.   "REGNO (operands[0]) <= 31"
  2320.   "@
  2321.    #
  2322.    l%U1%X1 %0,%1"
  2323.   [(set_attr "type" "*,load")])
  2324.  
  2325. (define_split
  2326.   [(set (match_operand:SF 0 "gpc_reg_operand" "")
  2327.     (match_operand:SF 1 "easy_fp_constant" ""))]
  2328.   "reload_completed && REGNO (operands[0]) <= 31"
  2329.   [(set (match_dup 2) (match_dup 3))]
  2330.   "
  2331. { operands[2] = operand_subword (operands[0], 0, 0, SFmode);
  2332.   operands[3] = operand_subword (operands[1], 0, 0, SFmode); }")
  2333.   
  2334. (define_insn ""
  2335.   [(set (match_operand:SF 0 "fp_reg_or_mem_operand" "=f,f,m")
  2336.     (match_operand:SF 1 "input_operand" "f,m,f"))]
  2337.   "gpc_reg_operand (operands[0], SFmode)
  2338.    || gpc_reg_operand (operands[1], SFmode)"
  2339.   "@
  2340.    fmr %0,%1
  2341.    lfs%U1%X1 %0,%1
  2342.    frsp %1,%1\;stfs%U0%X0 %1,%0"
  2343.   [(set_attr "type" "fp,load,*")])
  2344.  
  2345. (define_expand "movdf"
  2346.   [(set (match_operand:DF 0 "nonimmediate_operand" "")
  2347.     (match_operand:DF 1 "any_operand" ""))]
  2348.   ""
  2349.   "
  2350. {
  2351.   /* If we are called from reload, we might be getting a SUBREG of a hard
  2352.      reg.  So expand it.  */
  2353.   if (GET_CODE (operands[0]) == SUBREG
  2354.       && GET_CODE (SUBREG_REG (operands[0])) == REG
  2355.       && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
  2356.     operands[0] = alter_subreg (operands[0]);
  2357.   if (GET_CODE (operands[1]) == SUBREG
  2358.       && GET_CODE (SUBREG_REG (operands[1])) == REG
  2359.       && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
  2360.     operands[1] = alter_subreg (operands[1]);
  2361.  
  2362.   /* If we are being called from reload, it is possible that operands[1]
  2363.      is a hard non-fp register.  So handle those cases.  */
  2364.   if (reload_in_progress && GET_CODE (operands[1]) == REG
  2365.       && REGNO (operands[1]) < 32)
  2366.     {
  2367.       rtx stack_slot;
  2368.  
  2369.       /* Remember that we only see a pseudo here if it didn't get a hard
  2370.      register, so it is memory.  */
  2371.       if (GET_CODE (operands[0]) == MEM
  2372.       || (GET_CODE (operands[0]) == REG
  2373.           && (REGNO (operands[0]) < 32
  2374.           || REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)))
  2375.     {
  2376.       emit_move_insn (operand_subword (operands[0], 0, 0, DFmode),
  2377.               operand_subword (operands[1], 0, 0, DFmode));
  2378.       emit_move_insn (operand_subword (operands[0], 1, 0, DFmode),
  2379.               operand_subword (operands[1], 1, 0, DFmode));
  2380.       DONE;
  2381.     }
  2382.  
  2383.       stack_slot = gen_rtx (MEM, DFmode, plus_constant (stack_pointer_rtx, 8));
  2384.       emit_move_insn (stack_slot, operands[1]);
  2385.       emit_move_insn (operands[0], stack_slot);
  2386.       DONE;
  2387.     }
  2388.  
  2389.   if (GET_CODE (operands[0]) == MEM)
  2390.     {
  2391.       if (GET_CODE (operands[1]) == MEM)
  2392.     {
  2393.       emit_move_insn (operand_subword (operands[0], 0, 0, DFmode),
  2394.               operand_subword (operands[1], 0, 0, DFmode));
  2395.       emit_move_insn (operand_subword (operands[0], 1, 0, DFmode),
  2396.               operand_subword (operands[1], 1, 0, DFmode));
  2397.       DONE;
  2398.     }
  2399.       
  2400.       operands[1] = force_reg (DFmode, operands[1]);
  2401.     }
  2402.  
  2403.   if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
  2404.     {
  2405.       rtx stack_slot;
  2406.  
  2407.       if (GET_CODE (operands[1]) == MEM
  2408. #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
  2409.       || GET_CODE (operands[1]) == CONST_DOUBLE
  2410. #endif
  2411.       || (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
  2412.       || (reload_in_progress && GET_CODE (operands[1]) == REG
  2413.           && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))
  2414.     {
  2415.       emit_move_insn (operand_subword (operands[0], 0, 0, DFmode),
  2416.               operand_subword (operands[1], 0, 0, DFmode));
  2417.       emit_move_insn (operand_subword (operands[0], 1, 0, DFmode),
  2418.               operand_subword (operands[1], 1, 0, DFmode));
  2419.       DONE;
  2420.     }
  2421.  
  2422.       if (reload_in_progress)
  2423.     stack_slot = gen_rtx (MEM, DFmode,
  2424.                   plus_constant (stack_pointer_rtx, 8));
  2425.       else
  2426.     stack_slot = assign_stack_temp (DFmode, 8, 0);
  2427.       emit_move_insn (stack_slot, operands[1]);
  2428.       emit_move_insn (operands[0], stack_slot);
  2429.       DONE;
  2430.     }
  2431.  
  2432.   if (CONSTANT_P (operands[1]))
  2433.     {
  2434.       operands[1] = force_const_mem (DFmode, operands[1]);
  2435.       if (! memory_address_p (DFmode, XEXP (operands[1], 0))
  2436.       && ! reload_in_progress)
  2437.     operands[1] = change_address (operands[1], DFmode,
  2438.                       XEXP (operands[1], 0));
  2439.     }
  2440. }")
  2441.  
  2442. (define_insn ""
  2443.   [(set (match_operand:DF 0 "gpc_reg_operand" "=r,r")
  2444.     (match_operand:DF 1 "mem_or_easy_const_operand" "G,m"))]
  2445.   "REGNO (operands[0]) <= 31"
  2446.   "@
  2447.    #
  2448.    l %0,%1\;l %L0,%L1"
  2449.   [(set_attr "type" "*,load")])
  2450.  
  2451. (define_split
  2452.   [(set (match_operand:DF 0 "gpc_reg_operand" "")
  2453.     (match_operand:DF 1 "easy_fp_constant" ""))]
  2454.   "reload_completed && REGNO (operands[0]) <= 31"
  2455.   [(set (match_dup 2) (match_dup 3))
  2456.    (set (match_dup 4) (match_dup 5))]
  2457.   "
  2458. { operands[2] = operand_subword (operands[0], 0, 0, DFmode);
  2459.   operands[3] = operand_subword (operands[1], 0, 0, DFmode);
  2460.   operands[4] = operand_subword (operands[0], 1, 0, DFmode);
  2461.   operands[5] = operand_subword (operands[1], 1, 0, DFmode); }")
  2462.   
  2463. (define_insn ""
  2464.   [(set (match_operand:DF 0 "fp_reg_or_mem_operand" "=f,f,m")
  2465.     (match_operand:DF 1 "fp_reg_or_mem_operand" "f,m,f"))]
  2466.   "gpc_reg_operand (operands[0], DFmode)
  2467.    || gpc_reg_operand (operands[1], DFmode)"
  2468.   "@
  2469.    fmr %0,%1
  2470.    lfd%U1%X1 %0,%1
  2471.    stfd%U0%X0 %1,%0"
  2472.   [(set_attr "type" "fp,load,*")])
  2473.  
  2474. ;; Next come the multi-word integer load and store and the load and store
  2475. ;; multiple insns.
  2476. (define_expand "movdi"
  2477.   [(set (match_operand:DI 0 "general_operand" "")
  2478.     (match_operand:DI 1 "general_operand" ""))]
  2479.   ""
  2480.   "
  2481. {
  2482.   if (GET_CODE (operands[1]) == CONST_DOUBLE
  2483.       || GET_CODE (operands[1]) == CONST_INT)
  2484.     {
  2485.       emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
  2486.               operand_subword (operands[1], 0, 0, DImode));
  2487.       emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
  2488.               operand_subword (operands[1], 1, 0, DImode));
  2489.       DONE;
  2490.     }
  2491.  
  2492.   if (GET_CODE (operands[0]) == MEM)
  2493.     operands[1] = force_reg (DImode, operands[1]);
  2494. }")
  2495.  
  2496. (define_insn ""
  2497.   [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m")
  2498.     (match_operand:DI 1 "input_operand" "r,m,r"))]
  2499.   "gpc_reg_operand (operands[0], DImode)
  2500.    || gpc_reg_operand (operands[1], DImode)"
  2501.   "*
  2502. {
  2503.   switch (which_alternative)
  2504.     {
  2505.     case 0:
  2506.       /* We normally copy the low-numbered register first.  However, if
  2507.      the first register operand 0 is the same as the second register of
  2508.      operand 1, we must copy in the opposite order.  */
  2509.       if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
  2510.     return \"oril %L0,%L1,0\;oril %0,%1,0\";
  2511.       else
  2512.     return \"oril %0,%1,0\;oril %L0,%L1,0\";
  2513.     case 1:
  2514.       /* If the low-address word is used in the address, we must load it
  2515.      last.  Otherwise, load it first.  Note that we cannot have
  2516.      auto-increment in that case since the address register is known to be
  2517.      dead.  */
  2518.       if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
  2519.                  operands [1], 0))
  2520.     return \"l %L0,%L1\;l %0,%1\";
  2521.       else
  2522.     return \"l%U1 %0,%1\;l %L0,%L1\";
  2523.     case 2:
  2524.       return \"st%U0 %1,%0\;st %L1,%L0\";
  2525.     }
  2526. }"
  2527.   [(set_attr "type" "*,load,*")])
  2528.  
  2529. ;; TImode is similar, except that we usually want to compute the address into
  2530. ;; a register and use lsi/stsi (the exception is during reload).  MQ is also
  2531. ;; clobbered in stsi, so we need a SCRATCH for it.
  2532. (define_expand "movti"
  2533.   [(parallel [(set (match_operand:TI 0 "general_operand" "")
  2534.            (match_operand:TI 1 "general_operand" ""))
  2535.           (clobber (scratch:SI))])]
  2536.   ""
  2537.   "
  2538. {
  2539.   if (GET_CODE (operands[0]) == MEM)
  2540.     operands[1] = force_reg (TImode, operands[1]);
  2541.  
  2542.   if (GET_CODE (operands[0]) == MEM
  2543.       && GET_CODE (XEXP (operands[0], 0)) != REG
  2544.       && ! reload_in_progress)
  2545.     operands[0] = change_address (operands[0], TImode,
  2546.                   copy_addr_to_reg (XEXP (operands[0], 0)));
  2547.  
  2548.   if (GET_CODE (operands[1]) == MEM
  2549.       && GET_CODE (XEXP (operands[1], 0)) != REG
  2550.       && ! reload_in_progress)
  2551.     operands[1] = change_address (operands[1], TImode,
  2552.                   copy_addr_to_reg (XEXP (operands[1], 0)));
  2553. }")
  2554.  
  2555. ;; We say that MQ is clobbered in the last alternative because the first
  2556. ;; alternative would never get used otherwise since it would need a reload
  2557. ;; while the 2nd alternative would not.  We put memory cases first so they
  2558. ;; are preferred.  Otherwise, we'd try to reload the output instead of
  2559. ;; giving the SCRATCH mq.
  2560. (define_insn ""
  2561.   [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,r,r,r")
  2562.     (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
  2563.    (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
  2564.   "gpc_reg_operand (operands[0], TImode)
  2565.    || gpc_reg_operand (operands[1], TImode)"
  2566.   "*
  2567. {
  2568.   switch (which_alternative)
  2569.     {
  2570.     case 0:
  2571.       return \"stsi %1,%P0,16\";
  2572.  
  2573.     case 1:
  2574.       return \"st%U0 %1,%0\;st %L1,%L0\;st %Y1,%Y0\;st %Z1,%Z0\";
  2575.  
  2576.     case 2:
  2577.       /* Normally copy registers with lowest numbered register copied first.
  2578.      But copy in the other order if the first register of the output
  2579.      is the second, third, or fourth register in the input.  */
  2580.       if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
  2581.       && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
  2582.     return \"oril %Z0,%Z1,0\;oril %Y0,%Y1,0\;oril %L0,%L1,0\;oril %0,%1,0\";
  2583.       else
  2584.     return \"oril %0,%1,0\;oril %L0,%L1,0\;oril %Y0,%Y1,0\;oril %Z0,%Z1,0\";
  2585.     case 3:
  2586.       /* If the address is not used in the output, we can use lsi.  Otherwise,
  2587.      fall through to generating four loads.  */
  2588.       if (! reg_overlap_mentioned_p (operands[0], operands[1]))
  2589.     return \"lsi %0,%P1,16\";
  2590.       /* ... fall through ... */
  2591.     case 4:
  2592.       /* If the address register is the same as the register for the lowest-
  2593.      addressed word, load it last.  Similarly for the next two words.
  2594.      Otherwise load lowest address to highest.  */
  2595.       if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
  2596.                  operands[1], 0))
  2597.     return \"l %L0,%L1\;l %Y0,%Y1\;l %Z0,%Z1\;l %0,%1\";
  2598.       else if (refers_to_regno_p (REGNO (operands[0]) + 1,
  2599.                   REGNO (operands[0]) + 2, operands[1], 0))
  2600.     return \"l %0,%1\;l %Y0,%Y1\;l %Z0,%Z1\;l %L0,%L1\";
  2601.       else if (refers_to_regno_p (REGNO (operands[0]) + 2,
  2602.                   REGNO (operands[0]) + 3, operands[1], 0))
  2603.     return \"l %0,%1\;l %L0,%L1\;l %Z0,%Z1\;l %Y0,%Y1\";
  2604.       else
  2605.     return \"l%U1 %0,%1\;l %L0,%L1\;l %Y0,%Y1\;l %Z0,%Z1\";
  2606.     }
  2607. }"
  2608.   [(set_attr "type" "*,load,load,*,*")])
  2609.  
  2610. (define_expand "load_multiple"
  2611.   [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
  2612.               (match_operand:SI 1 "" ""))
  2613.              (use (match_operand:SI 2 "" ""))])]
  2614.   ""
  2615.   "
  2616. {
  2617.   int regno;
  2618.   int count;
  2619.   rtx from;
  2620.   int i;
  2621.  
  2622.   /* Support only loading a constant number of fixed-point registers from
  2623.      memory and only bother with this if more than two; the machine
  2624.      doesn't support more than eight.  */
  2625.   if (GET_CODE (operands[2]) != CONST_INT
  2626.       || INTVAL (operands[2]) <= 2
  2627.       || INTVAL (operands[2]) > 8
  2628.       || GET_CODE (operands[1]) != MEM
  2629.       || GET_CODE (operands[0]) != REG
  2630.       || REGNO (operands[0]) >= 32)
  2631.     FAIL;
  2632.  
  2633.   count = INTVAL (operands[2]);
  2634.   regno = REGNO (operands[0]);
  2635.  
  2636.   operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
  2637.   from = force_reg (SImode, XEXP (operands[1], 0));
  2638.  
  2639.   for (i = 0; i < count; i++)
  2640.     XVECEXP (operands[3], 0, i)
  2641.       = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
  2642.          gen_rtx (MEM, SImode, plus_constant (from, i * 4)));
  2643. }")
  2644.  
  2645. (define_insn ""
  2646.   [(match_parallel 0 "load_multiple_operation"
  2647.            [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
  2648.              (match_operand:SI 2 "indirect_operand" "Q"))])]
  2649.   ""
  2650.   "*
  2651. {
  2652.   /* We have to handle the case where the pseudo used to contain the address
  2653.      is assigned to one of the output registers.  In that case, do the
  2654.      lsi, but then load the correct value.  This is a bit of a mess, but is
  2655.      the best we can do.  */
  2656.   static char result[100];
  2657.   char newload[40];
  2658.   int i;
  2659.  
  2660.   strcpy (result, \"lsi %1,%P2,%N0\");
  2661.   for (i = 0; i < XVECLEN (operands[0], 0); i++)
  2662.     if (refers_to_regno_p (REGNO (operands[1]) + i,
  2663.                REGNO (operands[1]) + i + 1, operands[2], 0))
  2664.       {
  2665.     sprintf (newload, \"\;l %d,%d(%d)\",
  2666.          REGNO (operands[1]) + i,
  2667.          i * 4, REGNO (XEXP (operands[2], 0)));
  2668.     strcat (result, newload);
  2669.       }
  2670.  
  2671.   return result;
  2672. }"
  2673.   [(set_attr "type" "load")])
  2674.  
  2675. (define_expand "store_multiple"
  2676.   [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
  2677.               (match_operand:SI 1 "" ""))
  2678.              (clobber (scratch:SI))
  2679.              (use (match_operand:SI 2 "" ""))])]
  2680.   ""
  2681.   "
  2682. {
  2683.   int regno;
  2684.   int count;
  2685.   rtx to;
  2686.   int i;
  2687.  
  2688.   /* Support only storing a constant number of fixed-point registers to
  2689.      memory and only bother with this if more than two; the machine
  2690.      doesn't support more than eight.  */
  2691.   if (GET_CODE (operands[2]) != CONST_INT
  2692.       || INTVAL (operands[2]) <= 2
  2693.       || INTVAL (operands[2]) > 8
  2694.       || GET_CODE (operands[0]) != MEM
  2695.       || GET_CODE (operands[1]) != REG
  2696.       || REGNO (operands[1]) >= 32)
  2697.     FAIL;
  2698.  
  2699.   count = INTVAL (operands[2]);
  2700.   regno = REGNO (operands[1]);
  2701.  
  2702.   operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
  2703.   to = force_reg (SImode, XEXP (operands[0], 0));
  2704.  
  2705.   XVECEXP (operands[3], 0, 0)
  2706.     = gen_rtx (SET, VOIDmode, gen_rtx (MEM, SImode, to), operands[1]);
  2707.   XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
  2708.                           gen_rtx (SCRATCH, SImode));
  2709.  
  2710.   for (i = 1; i < count; i++)
  2711.     XVECEXP (operands[3], 0, i + 1)
  2712.       = gen_rtx (SET, VOIDmode,
  2713.          gen_rtx (MEM, SImode, plus_constant (to, i * 4)),
  2714.          gen_rtx (REG, SImode, regno + i));
  2715. }")
  2716.  
  2717. (define_insn ""
  2718.   [(match_parallel 0 "store_multiple_operation"
  2719.            [(set (match_operand:SI 1 "indirect_operand" "=Q")
  2720.              (match_operand:SI 2 "gpc_reg_operand" "r"))
  2721.             (clobber (match_scratch:SI 3 "=q"))])]
  2722.   ""
  2723.   "stsi %2,%P1,%O0")
  2724.  
  2725. ;; Define insns that do load or store with update.  Some of these we can 
  2726. ;; get by using pre-decrement or pre-increment, but the hardware can also
  2727. ;; do cases where the increment is not the size of the object.
  2728. ;;
  2729. ;; In all these cases, we use operands 0 and 1 for the register being
  2730. ;; incremented because those are the operands that local-alloc will
  2731. ;; tie and these are the pair most likely to be tieable (and the ones
  2732. ;; that will benefit the most).
  2733.  
  2734. (define_insn ""
  2735.   [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
  2736.     (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2737.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  2738.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2739.     (plus:SI (match_dup 1) (match_dup 2)))]
  2740.   ""
  2741.   "@
  2742.    lux %3,%0,%2
  2743.    lu %3,%2(%0)"
  2744.   [(set_attr "type" "load,load")])
  2745.  
  2746. (define_insn ""
  2747.   [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2748.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  2749.     (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  2750.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2751.     (plus:SI (match_dup 1) (match_dup 2)))]
  2752.   ""
  2753.   "@
  2754.    stux %3,%0,%2
  2755.    stu %3,%2(%0)")
  2756.  
  2757. (define_insn ""
  2758.   [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
  2759.     (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2760.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  2761.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2762.     (plus:SI (match_dup 1) (match_dup 2)))]
  2763.   ""
  2764.   "@
  2765.    lhzux %3,%0,%2
  2766.    lhzu %3,%2(%0)"
  2767.   [(set_attr "type" "load,load")])
  2768.  
  2769. (define_insn ""
  2770.   [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
  2771.     (zero_extend:SI
  2772.      (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2773.               (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
  2774.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2775.     (plus:SI (match_dup 1) (match_dup 2)))]
  2776.   ""
  2777.   "@
  2778.    lhzux %3,%0,%2
  2779.    lhzu %3,%2(%0)"
  2780.   [(set_attr "type" "load,load")])
  2781.  
  2782. (define_insn ""
  2783.   [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
  2784.     (sign_extend:SI
  2785.      (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2786.               (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
  2787.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2788.     (plus:SI (match_dup 1) (match_dup 2)))]
  2789.   ""
  2790.   "@
  2791.    lhaux %3,%0,%2
  2792.    lhau %3,%2(%0)"
  2793.   [(set_attr "type" "load,load")])
  2794.  
  2795. (define_insn ""
  2796.   [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2797.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  2798.     (match_operand:HI 3 "gpc_reg_operand" "r,r"))
  2799.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2800.     (plus:SI (match_dup 1) (match_dup 2)))]
  2801.   ""
  2802.   "@
  2803.    sthux %3,%0,%2
  2804.    sthu %3,%2(%0)"
  2805.   [(set_attr "type" "load,load")])
  2806.  
  2807. (define_insn ""
  2808.   [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
  2809.     (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2810.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  2811.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2812.     (plus:SI (match_dup 1) (match_dup 2)))]
  2813.   ""
  2814.   "@
  2815.    lbzux %3,%0,%2
  2816.    lbzu %3,%2(%0)"
  2817.   [(set_attr "type" "load,load")])
  2818.  
  2819. (define_insn ""
  2820.   [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
  2821.     (zero_extend:SI
  2822.      (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2823.               (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
  2824.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2825.     (plus:SI (match_dup 1) (match_dup 2)))]
  2826.   ""
  2827.   "@
  2828.    lbzux %3,%0,%2
  2829.    lbzu %3,%2(%0)"
  2830.   [(set_attr "type" "load,load")])
  2831.  
  2832. (define_insn ""
  2833.   [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2834.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  2835.     (match_operand:QI 3 "gpc_reg_operand" "r,r"))
  2836.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2837.     (plus:SI (match_dup 1) (match_dup 2)))]
  2838.   ""
  2839.   "@
  2840.    stbux %3,%0,%2
  2841.    stbu %3,%2(%0)")
  2842.  
  2843. (define_insn ""
  2844.   [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
  2845.     (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2846.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  2847.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2848.     (plus:SI (match_dup 1) (match_dup 2)))]
  2849.   ""
  2850.   "@
  2851.    lfsux %3,%0,%2
  2852.    lfsu %3,%2(%0)"
  2853.   [(set_attr "type" "load,load")])
  2854.  
  2855. (define_insn ""
  2856.   [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2857.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  2858.     (match_operand:SF 3 "gpc_reg_operand" "f,f"))
  2859.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2860.     (plus:SI (match_dup 1) (match_dup 2)))]
  2861.   ""
  2862.   "@
  2863.    frsp %3,%3\;stfsux %3,%0,%2
  2864.    frsp %3,%3\;stfsu %3,%2(%0)")
  2865.  
  2866. (define_insn ""
  2867.   [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
  2868.     (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2869.              (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
  2870.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2871.     (plus:SI (match_dup 1) (match_dup 2)))]
  2872.   ""
  2873.   "@
  2874.    lfdux %3,%0,%2
  2875.    lfdu %3,%2(%0)"
  2876.   [(set_attr "type" "load,load")])
  2877.  
  2878. (define_insn ""
  2879.   [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
  2880.              (match_operand:SI 2 "reg_or_short_operand" "r,I")))
  2881.     (match_operand:DF 3 "gpc_reg_operand" "f,f"))
  2882.    (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
  2883.     (plus:SI (match_dup 1) (match_dup 2)))]
  2884.   ""
  2885.   "@
  2886.    stfdux %3,%0,%2
  2887.    stfdu %3,%2(%0)")
  2888.  
  2889. ;; Next come insns related to the calling sequence.
  2890. ;;
  2891. ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
  2892. ;; We move the back-chain and decrement the stack pointer.  
  2893.  
  2894. (define_expand "allocate_stack"
  2895.   [(set (reg:SI 1)
  2896.     (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))]
  2897.   ""
  2898.   "
  2899. { rtx chain = gen_reg_rtx (SImode);
  2900.   rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
  2901.  
  2902.   emit_move_insn (chain, stack_bot);
  2903.   emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, operands[0]));
  2904.   emit_move_insn (stack_bot, chain);
  2905.   DONE;
  2906. }")
  2907.  
  2908. ;; These patterns say how to save and restore the stack pointer.  We need not
  2909. ;; save the stack pointer at function level since we are careful to
  2910. ;; preserve the backchain.  At block level, we have to restore the backchain
  2911. ;; when we restore the stack pointer.
  2912. ;;
  2913. ;; For nonlocal gotos, we must save both the stack pointer and its
  2914. ;; backchain and restore both.  Note that in the nonlocal case, the
  2915. ;; save area is a memory location.
  2916.  
  2917. (define_expand "save_stack_function"
  2918.   [(use (const_int 0))]
  2919.   ""
  2920.   "")
  2921.  
  2922. (define_expand "restore_stack_function"
  2923.   [(use (const_int 0))]
  2924.   ""
  2925.   "")
  2926.  
  2927. (define_expand "restore_stack_block"
  2928.   [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
  2929.    (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
  2930.    (set (mem:SI (match_dup 0)) (match_dup 2))]
  2931.   ""
  2932.   "
  2933. { operands[2] = gen_reg_rtx (SImode); }")
  2934.  
  2935. (define_expand "save_stack_nonlocal"
  2936.   [(match_operand:DI 0 "memory_operand" "")
  2937.    (match_operand:SI 1 "register_operand" "")]
  2938.   ""
  2939.   "
  2940. {
  2941.   rtx temp = gen_reg_rtx (SImode);
  2942.  
  2943.   /* Copy the backchain to the first word, sp to the second.  */
  2944.   emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
  2945.   emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
  2946.   emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
  2947.   DONE;
  2948. }")
  2949.           
  2950. (define_expand "restore_stack_nonlocal"
  2951.   [(match_operand:SI 0 "register_operand" "")
  2952.    (match_operand:DI 1 "memory_operand" "")]
  2953.   ""
  2954.   "
  2955. {
  2956.   rtx temp = gen_reg_rtx (SImode);
  2957.  
  2958.   /* Restore the backchain from the first word, sp from the second.  */
  2959.   emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
  2960.   emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
  2961.   emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
  2962.   DONE;
  2963. }")
  2964.  
  2965. ;; A function pointer is a pointer to a data area whose first word contains
  2966. ;; the actual address of the function, whose second word contains a pointer
  2967. ;; to its TOC, and whose third word contains a value to place in the static
  2968. ;; chain register (r11).  Note that if we load the static chain, our 
  2969. ;; "trampoline" need not have any executable code.
  2970. ;;
  2971. ;; operands[0] is an SImode pseudo in which we place the address of the
  2972. ;;            function.
  2973. ;; operands[1] is the address of data area of the function to call
  2974.  
  2975. (define_expand "call_via_ptr"
  2976.   [(set (match_operand:SI 0 "gpc_reg_operand" "")
  2977.     (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
  2978.    (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
  2979.     (reg:SI 2))
  2980.    (set (reg:SI 2)
  2981.     (mem:SI (plus:SI (match_dup 1)
  2982.              (const_int 4))))
  2983.    (set (reg:SI 11)
  2984.     (mem:SI (plus:SI (match_dup 1)
  2985.              (const_int 8))))
  2986.    (use (reg:SI 2))
  2987.    (use (reg:SI 11))]
  2988.   ""
  2989.   "")
  2990.  
  2991. (define_expand "call"
  2992.   [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
  2993.             (match_operand 1 "" ""))
  2994.           (clobber (scratch:SI))])]
  2995.   ""
  2996.   "
  2997. {
  2998.   if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
  2999.     abort ();
  3000.  
  3001.   operands[0] = XEXP (operands[0], 0);
  3002.   if (GET_CODE (operands[0]) != SYMBOL_REF)
  3003.     {
  3004.       rtx temp = gen_reg_rtx (SImode);
  3005.  
  3006.       emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[0])));
  3007.       operands[0] = temp;
  3008.     }
  3009. }")
  3010.  
  3011. (define_expand "call_value"
  3012.   [(parallel [(set (match_operand 0 "" "")
  3013.            (call (mem:SI (match_operand:SI 1 "address_operand" ""))
  3014.              (match_operand 2 "" "")))
  3015.           (clobber (scratch:SI))])]
  3016.   ""
  3017.   "
  3018. {
  3019.   if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
  3020.     abort ();
  3021.  
  3022.   operands[1] = XEXP (operands[1], 0);
  3023.   if (GET_CODE (operands[1]) != SYMBOL_REF)
  3024.     {
  3025.       rtx temp = gen_reg_rtx (SImode);
  3026.  
  3027.       emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[1])));
  3028.       operands[1] = temp;
  3029.     }
  3030. }")
  3031.  
  3032. (define_insn ""
  3033.   [(call (mem:SI (match_operand:SI 0 "call_operand" "l,s"))
  3034.      (match_operand 1 "" "fg,fg"))
  3035.    (clobber (match_scratch:SI 2 "=l,l"))]
  3036.   ""
  3037.   "@
  3038.    brl\;l 2,20(1)
  3039.    bl %z0\;cror 15,15,15")
  3040.  
  3041. (define_insn ""
  3042.   [(set (match_operand 0 "" "=fg,fg")
  3043.     (call (mem:SI (match_operand:SI 1 "call_operand" "l,s"))
  3044.           (match_operand 2 "" "fg,fg")))
  3045.    (clobber (match_scratch:SI 3 "=l,l"))]
  3046.   ""
  3047.   "@
  3048.    brl\;l 2,20(1)
  3049.    bl %z1\;cror 15,15,15")
  3050.  
  3051. ;; Compare insns are next.  Note that the RS/6000 has two types of compares,
  3052. ;; signed & unsigned, and one type of branch.  
  3053. ;;
  3054. ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
  3055. ;; insns, and branches.  We store the operands of compares until we see
  3056. ;; how it is used.
  3057. (define_expand "cmpsi"
  3058.   [(set (cc0)
  3059.         (compare (match_operand:SI 0 "gpc_reg_operand" "")
  3060.            (match_operand:SI 1 "reg_or_short_operand" "")))]
  3061.   ""
  3062.   "
  3063. {
  3064.   /* Take care of the possibility that operands[1] might be negative but
  3065.      this might be a logical operation.  That insn doesn't exist.  */
  3066.   if (GET_CODE (operands[1]) == CONST_INT
  3067.       && INTVAL (operands[1]) < 0)
  3068.     operands[1] = force_reg (SImode, operands[1]);
  3069.  
  3070.   rs6000_compare_op0 = operands[0];
  3071.   rs6000_compare_op1 = operands[1];
  3072.   rs6000_compare_fp_p = 0;
  3073.   DONE;
  3074. }")
  3075.  
  3076. (define_expand "cmpsf"
  3077.   [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
  3078.                (match_operand:SF 1 "gpc_reg_operand" "")))]
  3079.   ""
  3080.   "
  3081. {
  3082.   rs6000_compare_op0 = operands[0];
  3083.   rs6000_compare_op1 = operands[1];
  3084.   rs6000_compare_fp_p = 1;
  3085.   DONE;
  3086. }")
  3087.  
  3088. (define_expand "cmpdf"
  3089.   [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
  3090.                (match_operand:DF 1 "gpc_reg_operand" "")))]
  3091.   ""
  3092.   "
  3093. {
  3094.   rs6000_compare_op0 = operands[0];
  3095.   rs6000_compare_op1 = operands[1];
  3096.   rs6000_compare_fp_p = 1;
  3097.   DONE;
  3098. }")
  3099.  
  3100. (define_expand "beq"
  3101.   [(set (match_dup 2) (match_dup 1))
  3102.    (set (pc)
  3103.     (if_then_else (eq (match_dup 2)
  3104.               (const_int 0))
  3105.               (label_ref (match_operand 0 "" ""))
  3106.               (pc)))]
  3107.   ""
  3108.   "
  3109. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3110.   operands[1] = gen_rtx (COMPARE, mode,
  3111.              rs6000_compare_op0, rs6000_compare_op1);
  3112.   operands[2] = gen_reg_rtx (mode);
  3113. }")
  3114.  
  3115. (define_expand "bne"
  3116.   [(set (match_dup 2) (match_dup 1))
  3117.    (set (pc)
  3118.     (if_then_else (ne (match_dup 2)
  3119.               (const_int 0))
  3120.               (label_ref (match_operand 0 "" ""))
  3121.               (pc)))]
  3122.   ""
  3123.   "
  3124. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3125.   operands[1] = gen_rtx (COMPARE, mode,
  3126.              rs6000_compare_op0, rs6000_compare_op1);
  3127.   operands[2] = gen_reg_rtx (mode);
  3128. }")
  3129.  
  3130. (define_expand "blt"
  3131.   [(set (match_dup 2) (match_dup 1))
  3132.    (set (pc)
  3133.     (if_then_else (lt (match_dup 2)
  3134.               (const_int 0))
  3135.               (label_ref (match_operand 0 "" ""))
  3136.               (pc)))]
  3137.   ""
  3138.   "
  3139. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3140.   operands[1] = gen_rtx (COMPARE, mode,
  3141.              rs6000_compare_op0, rs6000_compare_op1);
  3142.   operands[2] = gen_reg_rtx (mode);
  3143. }")
  3144.  
  3145. (define_expand "bgt"
  3146.   [(set (match_dup 2) (match_dup 1))
  3147.    (set (pc)
  3148.     (if_then_else (gt (match_dup 2)
  3149.               (const_int 0))
  3150.               (label_ref (match_operand 0 "" ""))
  3151.               (pc)))]
  3152.   ""
  3153.   "
  3154. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3155.   operands[1] = gen_rtx (COMPARE, mode,
  3156.              rs6000_compare_op0, rs6000_compare_op1);
  3157.   operands[2] = gen_reg_rtx (mode);
  3158. }")
  3159.  
  3160. (define_expand "ble"
  3161.   [(set (match_dup 2) (match_dup 1))
  3162.    (set (pc)
  3163.     (if_then_else (le (match_dup 2)
  3164.               (const_int 0))
  3165.               (label_ref (match_operand 0 "" ""))
  3166.               (pc)))]
  3167.   ""
  3168.   "
  3169. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3170.   operands[1] = gen_rtx (COMPARE, mode,
  3171.              rs6000_compare_op0, rs6000_compare_op1);
  3172.   operands[2] = gen_reg_rtx (mode);
  3173. }")
  3174.  
  3175. (define_expand "bge"
  3176.   [(set (match_dup 2) (match_dup 1))
  3177.    (set (pc)
  3178.     (if_then_else (ge (match_dup 2)
  3179.               (const_int 0))
  3180.               (label_ref (match_operand 0 "" ""))
  3181.               (pc)))]
  3182.   ""
  3183.   "
  3184. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3185.   operands[1] = gen_rtx (COMPARE, mode,
  3186.              rs6000_compare_op0, rs6000_compare_op1);
  3187.   operands[2] = gen_reg_rtx (mode);
  3188. }")
  3189.  
  3190. (define_expand "bgtu"
  3191.   [(set (match_dup 2) (match_dup 1))
  3192.    (set (pc)
  3193.     (if_then_else (gtu (match_dup 2)
  3194.                (const_int 0))
  3195.               (label_ref (match_operand 0 "" ""))
  3196.               (pc)))]
  3197.   ""
  3198.   "
  3199. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3200.              rs6000_compare_op0, rs6000_compare_op1);
  3201.   operands[2] = gen_reg_rtx (CCUNSmode);
  3202. }")
  3203.  
  3204. (define_expand "bltu"
  3205.   [(set (match_dup 2) (match_dup 1))
  3206.    (set (pc)
  3207.     (if_then_else (ltu (match_dup 2)
  3208.                (const_int 0))
  3209.               (label_ref (match_operand 0 "" ""))
  3210.               (pc)))]
  3211.   ""
  3212.   "
  3213. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3214.              rs6000_compare_op0, rs6000_compare_op1);
  3215.   operands[2] = gen_reg_rtx (CCUNSmode);
  3216. }")
  3217.  
  3218. (define_expand "bgeu"
  3219.   [(set (match_dup 2) (match_dup 1))
  3220.    (set (pc)
  3221.     (if_then_else (geu (match_dup 2)
  3222.                (const_int 0))
  3223.               (label_ref (match_operand 0 "" ""))
  3224.               (pc)))]
  3225.   ""
  3226.   "
  3227. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3228.              rs6000_compare_op0, rs6000_compare_op1);
  3229.   operands[2] = gen_reg_rtx (CCUNSmode);
  3230. }")
  3231.  
  3232. (define_expand "bleu"
  3233.   [(set (match_dup 2) (match_dup 1))
  3234.    (set (pc)
  3235.     (if_then_else (leu (match_dup 2)
  3236.                (const_int 0))
  3237.               (label_ref (match_operand 0 "" ""))
  3238.               (pc)))]
  3239.   ""
  3240.   "
  3241. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3242.              rs6000_compare_op0, rs6000_compare_op1);
  3243.   operands[2] = gen_reg_rtx (CCUNSmode);
  3244. }")
  3245.  
  3246. ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
  3247. ;; For SEQ, likewise, except that comparisons with zero should be done
  3248. ;; with an scc insns.  However, due to the order that combine see the
  3249. ;; resulting insns, we must, in fact, allow SEQ for integers.  Fail in
  3250. ;; the cases we don't want to handle.
  3251. (define_expand "seq"
  3252.   [(set (match_dup 2) (match_dup 1))
  3253.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3254.     (eq:SI (match_dup 2) (const_int 0)))]
  3255.   ""
  3256.   "
  3257. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3258.   operands[1] = gen_rtx (COMPARE, mode,
  3259.              rs6000_compare_op0, rs6000_compare_op1);
  3260.   operands[2] = gen_reg_rtx (mode);
  3261. }")
  3262.  
  3263. (define_expand "sne"
  3264.   [(set (match_dup 2) (match_dup 1))
  3265.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3266.     (ne:SI (match_dup 2) (const_int 0)))]
  3267.   ""
  3268.   "
  3269. { if (! rs6000_compare_fp_p)
  3270.     FAIL;
  3271.  
  3272.   operands[1] = gen_rtx (COMPARE, CCFPmode,
  3273.              rs6000_compare_op0, rs6000_compare_op1);
  3274.   operands[2] = gen_reg_rtx (CCFPmode);
  3275. }")
  3276.  
  3277. ;; A > 0 is best done using the portable sequence, so fail in that case.
  3278. (define_expand "sgt"
  3279.   [(set (match_dup 2) (match_dup 1))
  3280.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3281.     (gt:SI (match_dup 2) (const_int 0)))]
  3282.   ""
  3283.   "
  3284. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3285.  
  3286.   if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
  3287.     FAIL;
  3288.  
  3289.   operands[1] = gen_rtx (COMPARE, mode,
  3290.              rs6000_compare_op0, rs6000_compare_op1);
  3291.   operands[2] = gen_reg_rtx (mode);
  3292. }")
  3293.  
  3294. ;; A < 0 is best done in the portable way for A an integer.
  3295. (define_expand "slt"
  3296.   [(set (match_dup 2) (match_dup 1))
  3297.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3298.     (lt:SI (match_dup 2) (const_int 0)))]
  3299.   ""
  3300.   "
  3301. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3302.  
  3303.   if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
  3304.     FAIL;
  3305.  
  3306.   operands[1] = gen_rtx (COMPARE, mode,
  3307.              rs6000_compare_op0, rs6000_compare_op1);
  3308.   operands[2] = gen_reg_rtx (mode);
  3309. }")
  3310.  
  3311. (define_expand "sge"
  3312.   [(set (match_dup 2) (match_dup 1))
  3313.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3314.     (ge:SI (match_dup 2) (const_int 0)))]
  3315.   ""
  3316.   "
  3317. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3318.   operands[1] = gen_rtx (COMPARE, mode,
  3319.              rs6000_compare_op0, rs6000_compare_op1);
  3320.   operands[2] = gen_reg_rtx (mode);
  3321. }")
  3322.  
  3323. ;; A <= 0 is best done the portable way for A an integer.
  3324. (define_expand "sle"
  3325.   [(set (match_dup 2) (match_dup 1))
  3326.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3327.     (le:SI (match_dup 2) (const_int 0)))]
  3328.   ""
  3329.   "
  3330. { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  3331.  
  3332.   if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
  3333.     FAIL;
  3334.  
  3335.   operands[1] = gen_rtx (COMPARE, mode,
  3336.              rs6000_compare_op0, rs6000_compare_op1);
  3337.   operands[2] = gen_reg_rtx (mode);
  3338. }")
  3339.  
  3340. (define_expand "sgtu"
  3341.   [(set (match_dup 2) (match_dup 1))
  3342.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3343.     (gtu:SI (match_dup 2) (const_int 0)))]
  3344.   ""
  3345.   "
  3346. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3347.              rs6000_compare_op0, rs6000_compare_op1);
  3348.   operands[2] = gen_reg_rtx (CCUNSmode);
  3349. }")
  3350.  
  3351. (define_expand "sltu"
  3352.   [(set (match_dup 2) (match_dup 1))
  3353.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3354.     (ltu:SI (match_dup 2) (const_int 0)))]
  3355.   ""
  3356.   "
  3357. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3358.              rs6000_compare_op0, rs6000_compare_op1);
  3359.   operands[2] = gen_reg_rtx (CCUNSmode);
  3360. }")
  3361.  
  3362. (define_expand "sgeu"
  3363.   [(set (match_dup 2) (match_dup 1))
  3364.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3365.     (geu:SI (match_dup 2) (const_int 0)))]
  3366.   ""
  3367.   "
  3368. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3369.              rs6000_compare_op0, rs6000_compare_op1);
  3370.   operands[2] = gen_reg_rtx (CCUNSmode);
  3371. }")
  3372.  
  3373. (define_expand "sleu"
  3374.   [(set (match_dup 2) (match_dup 1))
  3375.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3376.     (leu:SI (match_dup 2) (const_int 0)))]
  3377.   ""
  3378.   "
  3379. { operands[1] = gen_rtx (COMPARE, CCUNSmode,
  3380.              rs6000_compare_op0, rs6000_compare_op1);
  3381.   operands[2] = gen_reg_rtx (CCUNSmode);
  3382. }")
  3383.  
  3384. ;; Here are the actual compare insns.
  3385. (define_insn ""
  3386.   [(set (match_operand:CC 0 "cc_reg_operand" "=y")
  3387.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
  3388.             (match_operand:SI 2 "reg_or_short_operand" "rI")))]
  3389.   ""
  3390.   "cmp%I2 %0,%1,%2"
  3391.   [(set_attr "type" "compare")])
  3392.  
  3393. ;; If we are comparing a register for equality with a large constant,
  3394. ;; we can do this with an XOR followed by a compare.  But we need a scratch
  3395. ;; register for the result of the XOR.
  3396.  
  3397. (define_split
  3398.   [(set (match_operand:CC 0 "cc_reg_operand" "")
  3399.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
  3400.             (match_operand:SI 2 "non_short_cint_operand" "")))
  3401.    (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
  3402.   "find_single_use (operands[0], insn, 0)
  3403.    && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
  3404.        || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
  3405.   [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
  3406.    (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
  3407.   "
  3408. {
  3409.   /* Get the constant we are comparing against, C,  and see what it looks like
  3410.      sign-extended to 16 bits.  Then see what constant could be XOR'ed
  3411.      with C to get the sign-extended value.  */
  3412.  
  3413.   int c = INTVAL (operands[2]);
  3414.   int sextc = (c << 16) >> 16;
  3415.   int xorv = c ^ sextc;
  3416.  
  3417.   operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
  3418.   operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
  3419. }")
  3420.  
  3421. (define_insn ""
  3422.   [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
  3423.     (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
  3424.                (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
  3425.   ""
  3426.   "cmpl%I2 %0,%1,%W2"
  3427.   [(set_attr "type" "compare")])
  3428.  
  3429. ;; The following two insns don't exist as single insns, but if we provide
  3430. ;; them, we can swap an add and compare, which will enable us to overlap more
  3431. ;; of the required delay between a compare and branch.  We generate code for
  3432. ;; them by splitting.
  3433.  
  3434. (define_insn ""
  3435.   [(set (match_operand:CC 3 "cc_reg_operand" "=y")
  3436.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
  3437.             (match_operand:SI 2 "short_cint_operand" "i")))
  3438.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3439.     (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
  3440.   ""
  3441.   "#")
  3442.    
  3443. (define_insn ""
  3444.   [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
  3445.     (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
  3446.                (match_operand:SI 2 "u_short_cint_operand" "i")))
  3447.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3448.     (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
  3449.   ""
  3450.   "#")
  3451.    
  3452. (define_split
  3453.   [(set (match_operand:CC 3 "cc_reg_operand" "")
  3454.     (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
  3455.             (match_operand:SI 2 "short_cint_operand" "")))
  3456.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3457.     (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
  3458.   ""
  3459.   [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
  3460.    (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
  3461.  
  3462. (define_split
  3463.   [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
  3464.     (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
  3465.                (match_operand:SI 2 "u_short_cint_operand" "")))
  3466.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  3467.     (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
  3468.   ""
  3469.   [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
  3470.    (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
  3471.  
  3472. (define_insn ""
  3473.   [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
  3474.     (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
  3475.               (match_operand:SF 2 "gpc_reg_operand" "f")))]
  3476.   ""
  3477.   "fcmpu %0,%1,%2"
  3478.   [(set_attr "type" "fpcompare")])
  3479.  
  3480. (define_insn ""
  3481.   [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
  3482.     (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
  3483.               (match_operand:DF 2 "gpc_reg_operand" "f")))]
  3484.   ""
  3485.   "fcmpu %0,%1,%2"
  3486.   [(set_attr "type" "fpcompare")])
  3487.  
  3488. ;; Now we have the scc insns.  We can do some combinations because of the
  3489. ;; way the machine works.
  3490. ;;
  3491. ;; Note that this is probably faster if we can put an insn between the
  3492. ;; mfcr and rlinm, but this is tricky.  Let's leave it for now.  In most
  3493. ;; cases the insns below which don't use an intermediate CR field will
  3494. ;; be used instead.
  3495. (define_insn ""
  3496.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3497.     (match_operator:SI 1 "scc_comparison_operator"
  3498.                [(match_operand 2 "cc_reg_operand" "y")
  3499.                 (const_int 0)]))]
  3500.   ""
  3501.   "%D1mfcr %0\;rlinm %0,%0,%J1,31,31")
  3502.  
  3503. (define_insn ""
  3504.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  3505.     (compare:CC (match_operator:SI 1 "scc_comparison_operator"
  3506.                        [(match_operand 2 "cc_reg_operand" "y")
  3507.                     (const_int 0)])
  3508.             (const_int 0)))
  3509.    (set (match_operand:SI 3 "gpc_reg_operand" "=r")
  3510.     (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
  3511.   ""
  3512.   "%D1mfcr %3\;rlinm. %3,%3,%J1,30,31"
  3513.   [(set_attr "type" "delayed_compare")])
  3514.  
  3515. (define_insn ""
  3516.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3517.     (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
  3518.                       [(match_operand 2 "cc_reg_operand" "y")
  3519.                        (const_int 0)])
  3520.            (match_operand:SI 3 "const_int_operand" "n")))]
  3521.   ""
  3522.   "*
  3523. {
  3524.   int is_bit = ccr_bit (operands[1], 1);
  3525.   int put_bit = 31 - (INTVAL (operands[3]) & 31);
  3526.   int count;
  3527.  
  3528.   if (is_bit >= put_bit)
  3529.     count = is_bit - put_bit;
  3530.   else
  3531.     count = 32 - (put_bit - is_bit);
  3532.  
  3533.   operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
  3534.   operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
  3535.  
  3536.   return \"%D1mfcr %0\;rlinm %0,%0,%4,%5,%5\";
  3537. }")
  3538.  
  3539. (define_insn ""
  3540.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  3541.     (compare:CC
  3542.      (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
  3543.                        [(match_operand 2 "cc_reg_operand" "y")
  3544.                     (const_int 0)])
  3545.             (match_operand:SI 3 "const_int_operand" "n"))
  3546.      (const_int 0)))
  3547.    (set (match_operand:SI 4 "gpc_reg_operand" "=r")
  3548.     (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
  3549.            (match_dup 3)))]
  3550.   ""
  3551.   "*
  3552. {
  3553.   int is_bit = ccr_bit (operands[1], 1);
  3554.   int put_bit = 31 - (INTVAL (operands[3]) & 31);
  3555.   int count;
  3556.  
  3557.   if (is_bit >= put_bit)
  3558.     count = is_bit - put_bit;
  3559.   else
  3560.     count = 32 - (put_bit - is_bit);
  3561.  
  3562.   operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
  3563.   operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
  3564.  
  3565.   return \"%D1mfcr %4\;rlinm. %4,%4,%5,%6,%6\";
  3566. }"
  3567.   [(set_attr "type" "delayed_compare")])
  3568.  
  3569. ;; If we are comparing the result of two comparisons, this can be done
  3570. ;; using creqv or crxor.
  3571.  
  3572. (define_insn ""
  3573.   [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
  3574.     (compare:CCEQ (match_operator 1 "scc_comparison_operator"
  3575.                   [(match_operand 2 "cc_reg_operand" "y")
  3576.                    (const_int 0)])
  3577.               (match_operator 3 "scc_comparison_operator"
  3578.                   [(match_operand 4 "cc_reg_operand" "y")
  3579.                    (const_int 0)])))]
  3580.   "REGNO (operands[2]) != REGNO (operands[4])"
  3581.   "*
  3582. {
  3583.   enum rtx_code code1, code2;
  3584.  
  3585.   code1 = GET_CODE (operands[1]);
  3586.   code2 = GET_CODE (operands[3]);
  3587.  
  3588.   if ((code1 == EQ || code1 == LT || code1 == GT
  3589.        || code1 == LTU || code1 == GTU
  3590.        || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
  3591.       !=
  3592.       (code2 == EQ || code2 == LT || code2 == GT
  3593.        || code2 == LTU || code2 == GTU
  3594.        || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
  3595.     return \"%C1%C3crxor %E0,%j1,%j3\";
  3596.   else
  3597.     return \"%C1%C3creqv %E0,%j1,%j3\";
  3598. }")
  3599.  
  3600. ;; There is a 3 cycle delay between consecutive mfcr instructions
  3601. ;; so it is useful to combine 2 scc instructions to use only one mfcr.
  3602.  
  3603. (define_peephole
  3604.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3605.     (match_operator:SI 1 "scc_comparison_operator"
  3606.                [(match_operand 2 "cc_reg_operand" "y")
  3607.                 (const_int 0)]))
  3608.    (set (match_operand:SI 3 "gpc_reg_operand" "=r")
  3609.     (match_operator:SI 4 "scc_comparison_operator"
  3610.                [(match_operand 5 "cc_reg_operand" "y")
  3611.                 (const_int 0)]))]
  3612.    "REGNO (operands[2]) != REGNO (operands[5])"
  3613.    "%D1%D4mfcr %3\;rlinm %0,%3,%J1,31,31\;rlinm %3,%3,%J4,31,31")
  3614.  
  3615. ;; There are some scc insns that can be done directly, without a compare.
  3616. ;; These are faster because they don't involve the communications between
  3617. ;; the FXU and branch units.   In fact, we will be replacing all of the
  3618. ;; integer scc insns here or in the portable methods in emit_store_flag.
  3619. ;;
  3620. ;; Also support (neg (scc ..)) since that construct is used to replace
  3621. ;; branches, (plus (scc ..) ..) since that construct is common and
  3622. ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
  3623. ;; cases where it is no more expensive than (neg (scc ..)).
  3624.  
  3625. ;; Have reload force a constant into a register for the simple insns that
  3626. ;; otherwise won't accept constants.  We do this because it is faster than
  3627. ;; the cmp/mfcr sequence we would otherwise generate.
  3628.  
  3629. (define_insn ""
  3630.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  3631.     (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  3632.            (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
  3633.    (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
  3634.   ""
  3635.   "@
  3636.    xor %0,%1,%2\;sfi %3,%0,0\;ae %0,%3,%0
  3637.    sfi %3,%1,0\;ae %0,%3,%1
  3638.    xoril %0,%1,%b2\;sfi %3,%0,0\;ae %0,%3,%0
  3639.    xoriu %0,%1,%u2\;sfi %3,%0,0\;ae %0,%3,%0
  3640.    sfi %0,%1,%2\;sfi %3,%0,0\;ae %0,%3,%0")
  3641.  
  3642. (define_insn ""
  3643.   [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
  3644.     (compare:CC 
  3645.      (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  3646.         (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
  3647.      (const_int 0)))
  3648.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  3649.     (eq:SI (match_dup 1) (match_dup 2)))
  3650.    (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
  3651.   ""
  3652.   "@
  3653.    xor %0,%1,%2\;sfi %3,%0,0\;ae. %0,%3,%0
  3654.    sfi %3,%1,0\;ae. %0,%3,%1
  3655.    xoril %0,%1,%b2\;sfi %3,%0,0\;ae. %0,%3,%0
  3656.    xoriu %0,%1,%u2\;sfi %3,%0,0\;ae. %0,%3,%0
  3657.    sfi %0,%1,%2\;sfi %3,%0,0\;ae. %0,%3,%0"
  3658.   [(set_attr "type" "compare")])
  3659.  
  3660. (define_insn ""
  3661.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  3662.     (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  3663.             (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
  3664.          (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
  3665.    (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
  3666.   ""
  3667.   "@
  3668.    xor %4,%1,%2\;sfi %4,%4,0\;aze %0,%3
  3669.    sfi %4,%1,0\;aze %0,%3
  3670.    xoril %4,%1,%b2\;sfi %4,%4,0\;aze %0,%3
  3671.    xoriu %4,%1,%u2\;sfi %4,%4,0\;aze %0,%3
  3672.    sfi %4,%1,%2\;sfi %4,%4,0\;aze %0,%3")
  3673.  
  3674. (define_insn ""
  3675.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
  3676.     (compare:CC 
  3677.      (plus:SI
  3678.       (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  3679.          (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
  3680.       (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
  3681.      (const_int 0)))
  3682.    (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
  3683.   ""
  3684.   "@
  3685.    xor %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3
  3686.    sfi %4,%1,0\;aze. %0,%3
  3687.    xoril %4,%1,%b2\;sfi %4,%4,0\;aze. %4,%3
  3688.    xoriu %4,%1,%u2\;sfi %4,%4,0\;aze. %4,%3
  3689.    sfi %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3"
  3690.   [(set_attr "type" "compare")])
  3691.  
  3692. (define_insn ""
  3693.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
  3694.     (compare:CC 
  3695.      (plus:SI
  3696.       (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
  3697.          (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
  3698.       (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
  3699.      (const_int 0)))
  3700.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  3701.     (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  3702.    (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
  3703.   ""
  3704.   "@
  3705.    xor %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3
  3706.    sfi %4,%1,0\;aze. %4,%3
  3707.    xoril %4,%1,%b2\;sfi %4,%4,0\;aze. %0,%3
  3708.    xoriu %4,%1,%u2\;sfi %4,%4,0\;aze. %0,%3
  3709.    sfi %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3"
  3710.   [(set_attr "type" "compare")])
  3711.  
  3712. (define_insn ""
  3713.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
  3714.     (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r")
  3715.                (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
  3716.   ""
  3717.   "@
  3718.    xor %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0
  3719.    ai %0,%1,-1\;sfe %0,%0,%0
  3720.    xoril %0,%1,%b2\;ai %0,%0,-1\;sfe %0,%0,%0
  3721.    xoriu %0,%1,%u2\;ai %0,%0,-1\;sfe %0,%0,%0
  3722.    sfi %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0")
  3723.  
  3724. ;; This is what (plus (ne X (const_int 0)) Y) looks like.
  3725. (define_insn ""
  3726.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3727.     (plus:SI (lshiftrt:SI
  3728.           (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
  3729.           (const_int 31))
  3730.          (match_operand:SI 2 "gpc_reg_operand" "r")))
  3731.    (clobber (match_scratch:SI 3 "=&r"))]
  3732.   ""
  3733.   "ai %3,%1,-1\;aze %0,%2")
  3734.  
  3735. (define_insn ""
  3736.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  3737.     (compare:CC
  3738.      (plus:SI (lshiftrt:SI
  3739.            (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
  3740.            (const_int 31))
  3741.           (match_operand:SI 2 "gpc_reg_operand" "r"))
  3742.      (const_int 0)))
  3743.    (clobber (match_scratch:SI 3 "=&r"))]
  3744.   ""
  3745.   "ai %3,%1,-1\;aze. %3,%2"
  3746.   [(set_attr "type" "compare")])
  3747.  
  3748. (define_insn ""
  3749.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  3750.     (compare:CC
  3751.      (plus:SI (lshiftrt:SI
  3752.            (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
  3753.            (const_int 31))
  3754.           (match_operand:SI 2 "gpc_reg_operand" "r"))
  3755.      (const_int 0)))
  3756.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3757.     (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
  3758.          (match_dup 2)))
  3759.    (clobber (match_scratch:SI 3 "=&r"))]
  3760.   ""
  3761.   "ai %3,%1,-1\;aze. %0,%2"
  3762.   [(set_attr "type" "compare")])
  3763.  
  3764. (define_insn ""
  3765.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  3766.     (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  3767.            (match_operand:SI 2 "reg_or_short_operand" "r,O")))
  3768.    (clobber (match_scratch:SI 3 "=r,X"))]
  3769.   ""
  3770.   "@
  3771.    doz %3,%2,%1\;sfi %0,%3,0\;ae %0,%0,%3
  3772.    ai %0,%1,-1\;aze %0,%0\;sri %0,%0,31")
  3773.  
  3774. (define_insn ""
  3775.   [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
  3776.     (compare:CC
  3777.      (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  3778.         (match_operand:SI 2 "reg_or_short_operand" "r,O"))
  3779.      (const_int 0)))
  3780.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  3781.     (le:SI (match_dup 1) (match_dup 2)))
  3782.    (clobber (match_scratch:SI 3 "=r,X"))]
  3783.   ""
  3784.   "@
  3785.    doz %3,%2,%1\;sfi %0,%3,0\;ae. %0,%0,%3
  3786.    ai %0,%1,-1\;aze %0,%0\;sri. %0,%0,31"
  3787.   [(set_attr "type" "delayed_compare,compare")])
  3788.  
  3789. (define_insn ""
  3790.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  3791.     (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  3792.             (match_operand:SI 2 "reg_or_short_operand" "r,O"))
  3793.          (match_operand:SI 3 "gpc_reg_operand" "r,r")))
  3794.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  3795.   ""
  3796.   "@
  3797.    doz %4,%2,%1\;sfi %4,%4,0\;aze %0,%3
  3798.    srai %4,%1,31\;sf %4,%1,%4\;aze %0,%3")
  3799.  
  3800. (define_insn ""
  3801.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  3802.     (compare:CC
  3803.      (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  3804.              (match_operand:SI 2 "reg_or_short_operand" "r,O"))
  3805.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  3806.      (const_int 0)))
  3807.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  3808.   ""
  3809.   "@
  3810.    doz %4,%2,%1\;sfi %4,%4,0\;aze. %4,%3
  3811.    srai %4,%1,31\;sf %4,%1,%4\;aze. %4,%3"
  3812.   [(set_attr "type" "compare")])
  3813.  
  3814. (define_insn ""
  3815.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
  3816.     (compare:CC
  3817.      (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  3818.              (match_operand:SI 2 "reg_or_short_operand" "r,O"))
  3819.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  3820.      (const_int 0)))
  3821.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  3822.     (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  3823.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  3824.   ""
  3825.   "@
  3826.    doz %4,%2,%1\;sfi %4,%4,0\;aze. %0,%3
  3827.    srai %4,%1,31\;sf %4,%1,%4\;aze. %0,%3"
  3828.   [(set_attr "type" "compare")])
  3829.  
  3830. (define_insn ""
  3831.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  3832.     (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  3833.                (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
  3834.   ""
  3835.   "@
  3836.    doz %0,%2,%1\;ai %0,%0,-1\;sfe %0,%0,%0
  3837.    ai %0,%1,-1\;aze %0,%0\;srai %0,%0,31")
  3838.  
  3839. (define_insn ""
  3840.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3841.     (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3842.         (match_operand:SI 2 "reg_or_short_operand" "rI")))]
  3843.   ""
  3844.   "sf%I2 %0,%1,%2\;cal %0,0(0)\;ae %0,%0,%0")
  3845.  
  3846. (define_insn ""
  3847.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  3848.     (compare:CC
  3849.      (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3850.          (match_operand:SI 2 "reg_or_short_operand" "rI"))
  3851.      (const_int 0)))
  3852.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3853.     (leu:SI (match_dup 1) (match_dup 2)))]
  3854.    ""
  3855.   "sf%I2 %0,%1,%2\;cal %0,0(0)\;ae. %0,%0,%0"
  3856.   [(set_attr "type" "compare")])
  3857.  
  3858. (define_insn ""
  3859.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3860.     (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3861.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  3862.          (match_operand:SI 3 "gpc_reg_operand" "r")))
  3863.    (clobber (match_scratch:SI 4 "=&r"))]
  3864.   ""
  3865.   "sf%I2 %4,%1,%2\;aze %0,%3")
  3866.  
  3867. (define_insn ""
  3868.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  3869.     (compare:CC
  3870.      (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3871.               (match_operand:SI 2 "reg_or_short_operand" "rI"))
  3872.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  3873.      (const_int 0)))
  3874.    (clobber (match_scratch:SI 4 "=&r"))]
  3875.   ""
  3876.   "sf%I2 %4,%1,%2\;aze. %4,%3"
  3877.   [(set_attr "type" "compare")])
  3878.  
  3879. (define_insn ""
  3880.   [(set (match_operand:CC 5 "cc_reg_operand" "=x")
  3881.     (compare:CC
  3882.      (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3883.               (match_operand:SI 2 "reg_or_short_operand" "rI"))
  3884.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  3885.      (const_int 0)))
  3886.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3887.     (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  3888.    (clobber (match_scratch:SI 4 "=&r"))]
  3889.   ""
  3890.   "sf%I2 %4,%1,%2\;aze. %0,%3"
  3891.   [(set_attr "type" "compare")])
  3892.  
  3893. (define_insn ""
  3894.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3895.     (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3896.             (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
  3897.   ""
  3898.   "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;nand %0,%0,%0")
  3899.  
  3900. (define_insn ""
  3901.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3902.     (and:SI (neg:SI
  3903.          (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3904.              (match_operand:SI 2 "reg_or_short_operand" "rI")))
  3905.         (match_operand:SI 3 "gpc_reg_operand" "r")))
  3906.    (clobber (match_scratch:SI 4 "=&r"))]
  3907.   ""
  3908.   "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc %0,%3,%4")
  3909.  
  3910. (define_insn ""
  3911.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  3912.     (compare:CC
  3913.      (and:SI (neg:SI
  3914.           (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3915.               (match_operand:SI 2 "reg_or_short_operand" "rI")))
  3916.          (match_operand:SI 3 "gpc_reg_operand" "r"))
  3917.      (const_int 0)))
  3918.    (clobber (match_scratch:SI 4 "=&r"))]
  3919.   ""
  3920.   "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc. %4,%3,%4"
  3921.   [(set_attr "type" "compare")])
  3922.  
  3923. (define_insn ""
  3924.   [(set (match_operand:CC 5 "cc_reg_operand" "=x")
  3925.     (compare:CC
  3926.      (and:SI (neg:SI
  3927.           (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3928.               (match_operand:SI 2 "reg_or_short_operand" "rI")))
  3929.          (match_operand:SI 3 "gpc_reg_operand" "r"))
  3930.      (const_int 0)))
  3931.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3932.     (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
  3933.    (clobber (match_scratch:SI 4 "=&r"))]
  3934.   ""
  3935.   "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc. %0,%3,%4"
  3936.   [(set_attr "type" "compare")])
  3937.  
  3938. (define_insn ""
  3939.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3940.     (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3941.            (match_operand:SI 2 "reg_or_short_operand" "rI")))]
  3942.   ""
  3943.   "doz%I2 %0,%1,%2\;nabs %0,%0\;sri %0,%0,31")
  3944.  
  3945. (define_insn ""
  3946.   [(set (match_operand:SI 3 "cc_reg_operand" "=x")
  3947.     (compare:CC
  3948.      (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3949.         (match_operand:SI 2 "reg_or_short_operand" "rI"))
  3950.      (const_int 0)))
  3951.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3952.     (lt:SI (match_dup 1) (match_dup 2)))]
  3953.   ""
  3954.   "doz%I2 %0,%1,%2\;nabs %0,%0\;sri. %0,%0,31"
  3955.   [(set_attr "type" "delayed_compare")])
  3956.  
  3957. (define_insn ""
  3958.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3959.     (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3960.             (match_operand:SI 2 "reg_or_short_operand" "rI"))
  3961.          (match_operand:SI 3 "gpc_reg_operand" "r")))
  3962.    (clobber (match_scratch:SI 4 "=&r"))]
  3963.   ""
  3964.   "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze %0,%3")
  3965.  
  3966. (define_insn ""
  3967.   [(set (match_operand:SI 0 "cc_reg_operand" "=x")
  3968.     (compare:CC
  3969.      (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3970.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  3971.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  3972.      (const_int 0)))
  3973.    (clobber (match_scratch:SI 4 "=&r"))]
  3974.   ""
  3975.   "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze. %4,%3"
  3976.   [(set_attr "type" "compare")])
  3977.  
  3978. (define_insn ""
  3979.   [(set (match_operand:SI 5 "cc_reg_operand" "=x")
  3980.     (compare:CC
  3981.      (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3982.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  3983.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  3984.      (const_int 0)))
  3985.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3986.     (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  3987.    (clobber (match_scratch:SI 4 "=&r"))]
  3988.   ""
  3989.   "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze. %0,%3"
  3990.   [(set_attr "type" "compare")])
  3991.  
  3992. (define_insn ""
  3993.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  3994.     (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  3995.                (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
  3996.   ""
  3997.   "doz%I2 %0,%1,%2\;nabs %0,%0\;srai %0,%0,31")
  3998.  
  3999. (define_insn ""
  4000.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4001.     (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4002.         (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
  4003.   ""
  4004.   "@
  4005.    sf %0,%2,%1\;sfe %0,%0,%0\;neg %0,%0
  4006.    ai %0,%1,%n2\;sfe %0,%0,%0\;neg %0,%0")
  4007.  
  4008. (define_insn ""
  4009.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  4010.     (compare:CC
  4011.      (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4012.          (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4013.      (const_int 0)))
  4014.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4015.     (ltu:SI (match_dup 1) (match_dup 2)))]
  4016.   ""
  4017.   "@
  4018.    sf %0,%2,%1\;sfe %0,%0,%0\;neg. %0,%0
  4019.    ai %0,%1,%n2\;sfe %0,%0,%0\;neg. %0,%0"
  4020.   [(set_attr "type" "compare")])
  4021.  
  4022. (define_insn ""
  4023.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
  4024.     (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
  4025.              (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
  4026.          (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
  4027.    (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
  4028.   ""
  4029.   "@
  4030.   sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
  4031.   sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
  4032.   ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
  4033.   ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3")
  4034.  
  4035. (define_insn ""
  4036.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
  4037.     (compare:CC
  4038.      (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
  4039.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
  4040.           (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I"))
  4041.      (const_int 0)))
  4042.    (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
  4043.   ""
  4044.   "@
  4045.    sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %4,%4,%3
  4046.    sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %4,%4,%3
  4047.    ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3
  4048.    ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3"
  4049.   [(set_attr "type" "compare")])
  4050.  
  4051. (define_insn ""
  4052.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x")
  4053.     (compare:CC
  4054.      (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
  4055.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
  4056.           (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I"))
  4057.      (const_int 0)))
  4058.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
  4059.     (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4060.    (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
  4061.   ""
  4062.   "@
  4063.    sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
  4064.    sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
  4065.    ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
  4066.    ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3"
  4067.   [(set_attr "type" "compare")])
  4068.  
  4069. (define_insn ""
  4070.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4071.     (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4072.             (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
  4073.   ""
  4074.   "@
  4075.    sf %0,%2,%1\;sfe %0,%0,%0
  4076.    ai %0,%1,%n2\;sfe %0,%0,%0")
  4077.  
  4078. (define_insn ""
  4079.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4080.     (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4081.            (match_operand:SI 2 "reg_or_short_operand" "rI")))
  4082.    (clobber (match_scratch:SI 3 "=r"))]
  4083.   ""
  4084.   "doz%I2 %3,%1,%2\;sfi %0,%3,0\;ae %0,%0,%3")
  4085.  
  4086. (define_insn ""
  4087.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  4088.     (compare:CC
  4089.      (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4090.         (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4091.      (const_int 0)))
  4092.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4093.     (ge:SI (match_dup 1) (match_dup 2)))
  4094.    (clobber (match_scratch:SI 3 "=r"))]
  4095.   ""
  4096.   "doz%I2 %3,%1,%2\;sfi %0,%3,0\;ae. %0,%0,%3"
  4097.   [(set_attr "type" "compare")])
  4098.  
  4099. (define_insn ""
  4100.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4101.     (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4102.             (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4103.          (match_operand:SI 3 "gpc_reg_operand" "r")))
  4104.    (clobber (match_scratch:SI 4 "=&r"))]
  4105.   ""
  4106.   "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze %0,%3")
  4107.  
  4108. (define_insn ""
  4109.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4110.     (compare:CC
  4111.      (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4112.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4113.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4114.      (const_int 0)))
  4115.    (clobber (match_scratch:SI 4 "=&r"))]
  4116.   ""
  4117.   "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3"
  4118.   [(set_attr "type" "compare")])
  4119.  
  4120. (define_insn ""
  4121.   [(set (match_operand:CC 5 "cc_reg_operand" "=x")
  4122.     (compare:CC
  4123.      (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4124.              (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4125.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4126.      (const_int 0)))
  4127.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4128.     (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4129.    (clobber (match_scratch:SI 4 "=&r"))]
  4130.   ""
  4131.   "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3"
  4132.   [(set_attr "type" "compare")])
  4133.  
  4134. (define_insn ""
  4135.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4136.     (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4137.                (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
  4138.   ""
  4139.   "doz%I2 %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0")
  4140.  
  4141. ;; This is (and (neg (ge X (const_int 0))) Y).
  4142. (define_insn ""
  4143.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4144.     (and:SI (neg:SI
  4145.          (lshiftrt:SI
  4146.           (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  4147.           (const_int 31)))
  4148.         (match_operand:SI 2 "gpc_reg_operand" "r")))
  4149.    (clobber (match_scratch:SI 3 "=&r"))]
  4150.   ""
  4151.   "srai %3,%1,31\;andc %0,%2,%3")
  4152.  
  4153. (define_insn ""
  4154.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4155.     (compare:CC
  4156.      (and:SI (neg:SI
  4157.           (lshiftrt:SI
  4158.            (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  4159.            (const_int 31)))
  4160.          (match_operand:SI 2 "gpc_reg_operand" "r"))
  4161.      (const_int 0)))
  4162.    (clobber (match_scratch:SI 3 "=&r"))]
  4163.   ""
  4164.   "srai %3,%1,31\;andc. %3,%2,%3"
  4165.   [(set_attr "type" "compare")])
  4166.  
  4167. (define_insn ""
  4168.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  4169.     (compare:CC
  4170.      (and:SI (neg:SI
  4171.           (lshiftrt:SI
  4172.            (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
  4173.            (const_int 31)))
  4174.          (match_operand:SI 2 "gpc_reg_operand" "r"))
  4175.      (const_int 0)))
  4176.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4177.     (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
  4178.                      (const_int 31)))
  4179.         (match_dup 2)))
  4180.    (clobber (match_scratch:SI 3 "=&r"))]
  4181.   ""
  4182.   "srai %3,%1,31\;andc. %0,%2,%3"
  4183.   [(set_attr "type" "compare")])
  4184.  
  4185. (define_insn ""
  4186.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4187.     (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4188.         (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
  4189.   ""
  4190.   "@
  4191.    sf %0,%2,%1\;cal %0,0(0)\;ae %0,%0,%0
  4192.    ai %0,%1,%n2\;cal %0,0(0)\;ae %0,%0,%0")
  4193.  
  4194. (define_insn ""
  4195.   [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
  4196.     (compare:CC
  4197.      (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4198.          (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4199.      (const_int 0)))
  4200.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4201.     (geu:SI (match_dup 1) (match_dup 2)))]
  4202.   ""
  4203.   "@
  4204.    sf %0,%2,%1\;cal %0,0(0)\;ae. %0,%0,%0
  4205.    ai %0,%1,%n2\;cal %0,0(0)\;ae. %0,%0,%0"
  4206.   [(set_attr "type" "compare")])
  4207.  
  4208. (define_insn ""
  4209.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4210.     (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4211.              (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4212.          (match_operand:SI 3 "gpc_reg_operand" "r,r")))
  4213.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4214.   ""
  4215.   "@
  4216.    sf %4,%2,%1\;aze %0,%3
  4217.    ai %4,%1,%n2\;aze %0,%3")
  4218.  
  4219. (define_insn ""
  4220.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  4221.     (compare:CC
  4222.      (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4223.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4224.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  4225.      (const_int 0)))
  4226.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4227.   ""
  4228.   "@
  4229.    sf %4,%2,%1\;aze. %4,%3
  4230.    ai %4,%1,%n2\;aze. %4,%3"
  4231.   [(set_attr "type" "compare")])
  4232.  
  4233. (define_insn ""
  4234.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
  4235.     (compare:CC
  4236.      (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4237.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
  4238.           (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  4239.      (const_int 0)))
  4240.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4241.     (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4242.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4243.   ""
  4244.   "@
  4245.    sf %4,%2,%1\;aze. %0,%3
  4246.    ai %4,%1,%n2\;aze. %4,%3"
  4247.   [(set_attr "type" "compare")])
  4248.  
  4249. (define_insn ""
  4250.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4251.     (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4252.             (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
  4253.   ""
  4254.   "@
  4255.    sf %0,%2,%1\;sfe %0,%0,%0\;nand %0,%0,%0
  4256.    sfi %0,%1,-1\;a%I2 %0,%0,%2\;sfe %0,%0,%0")
  4257.  
  4258. (define_insn ""
  4259.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4260.     (and:SI (neg:SI
  4261.          (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4262.              (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
  4263.         (match_operand:SI 3 "gpc_reg_operand" "r,r")))
  4264.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4265.   ""
  4266.   "@
  4267.    sf %4,%2,%1\;sfe %4,%4,%4\;andc %0,%3,%4
  4268.    ai %4,%1,%n2\;sfe %4,%4,%4\;andc %0,%3,%4")
  4269.  
  4270. (define_insn ""
  4271.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  4272.     (compare:CC
  4273.      (and:SI (neg:SI
  4274.           (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4275.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
  4276.          (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  4277.      (const_int 0)))
  4278.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4279.   ""
  4280.   "@
  4281.    sf %4,%2,%1\;sfe %4,%4,%4\;andc. %4,%3,%4
  4282.    ai %4,%1,%n2\;sfe %4,%4,%4\;andc. %4,%3,%4"
  4283.   [(set_attr "type" "compare")])
  4284.  
  4285. (define_insn ""
  4286.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
  4287.     (compare:CC
  4288.      (and:SI (neg:SI
  4289.           (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4290.               (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
  4291.          (match_operand:SI 3 "gpc_reg_operand" "r,r"))
  4292.      (const_int 0)))
  4293.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4294.     (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
  4295.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4296.   ""
  4297.   "@
  4298.    sf %4,%2,%1\;sfe %4,%4,%4\;andc. %0,%3,%4
  4299.    ai %4,%1,%n2\;sfe %4,%4,%4\;andc. %0,%3,%4"
  4300.   [(set_attr "type" "compare")])
  4301.  
  4302. (define_insn ""
  4303.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4304.     (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4305.            (const_int 0)))]
  4306.   ""
  4307.   "sfi %0,%1,0\;ame %0,%0\;sri %0,%0,31")
  4308.  
  4309. (define_insn ""
  4310.   [(set (match_operand:CC 2 "cc_reg_operand" "=x")
  4311.     (compare:CC
  4312.      (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4313.         (const_int 0))
  4314.      (const_int 0)))
  4315.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4316.     (gt:SI (match_dup 1) (const_int 0)))]
  4317.   ""
  4318.   "sfi %0,%1,0\;ame %0,%0\;sri. %0,%0,31"
  4319.   [(set_attr "type" "delayed_compare")])
  4320.  
  4321. (define_insn ""
  4322.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4323.     (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4324.            (match_operand:SI 2 "reg_or_short_operand" "r")))]
  4325.   ""
  4326.   "doz %0,%2,%1\;nabs %0,%0\;sri %0,%0,31")
  4327.  
  4328. (define_insn ""
  4329.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  4330.     (compare:CC
  4331.      (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4332.         (match_operand:SI 2 "reg_or_short_operand" "r"))
  4333.      (const_int 0)))
  4334.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4335.     (gt:SI (match_dup 1) (match_dup 2)))]
  4336.   ""
  4337.   "doz %0,%2,%1\;nabs %0,%0\;sri. %0,%0,31"
  4338.   [(set_attr "type" "delayed_compare")])
  4339.  
  4340. (define_insn ""
  4341.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4342.     (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4343.             (const_int 0))
  4344.          (match_operand:SI 2 "gpc_reg_operand" "r")))
  4345.    (clobber (match_scratch:SI 3 "=&r"))]
  4346.   ""
  4347.   "a %3,%1,%1\;sfe %3,%1,%3\;aze %0,%2")
  4348.  
  4349. (define_insn ""
  4350.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4351.     (compare:CC
  4352.      (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4353.              (const_int 0))
  4354.           (match_operand:SI 2 "gpc_reg_operand" "r"))
  4355.      (const_int 0)))
  4356.    (clobber (match_scratch:SI 3 "=&r"))]
  4357.   ""
  4358.   "a %3,%1,%1\;sfe %3,%1,%3\;aze. %0,%2"
  4359.   [(set_attr "type" "compare")])
  4360.  
  4361. (define_insn ""
  4362.   [(set (match_operand:CC 4 "cc_reg_operand" "=x")
  4363.     (compare:CC
  4364.      (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4365.              (const_int 0))
  4366.           (match_operand:SI 2 "gpc_reg_operand" "r"))
  4367.      (const_int 0)))
  4368.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4369.     (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
  4370.    (clobber (match_scratch:SI 3 "=&r"))]
  4371.   ""
  4372.   "a %3,%1,%1\;sfe %3,%1,%3\;aze. %3,%2"
  4373.   [(set_attr "type" "compare")])
  4374.  
  4375. (define_insn ""
  4376.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4377.     (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4378.             (match_operand:SI 2 "reg_or_short_operand" "r"))
  4379.          (match_operand:SI 3 "gpc_reg_operand" "r")))
  4380.    (clobber (match_scratch:SI 4 "=&r"))]
  4381.   ""
  4382.   "doz %4,%2,%1\;ai %4,%4,-1\;aze %0,%3")
  4383.  
  4384. (define_insn ""
  4385.   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
  4386.     (compare:CC
  4387.      (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4388.              (match_operand:SI 2 "reg_or_short_operand" "r"))
  4389.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4390.      (const_int 0)))
  4391.    (clobber (match_scratch:SI 4 "=&r"))]
  4392.   ""
  4393.   "doz %4,%2,%1\;ai %4,%4,-1\;aze. %4,%3"
  4394.   [(set_attr "type" "compare")])
  4395.  
  4396. (define_insn ""
  4397.   [(set (match_operand:CC 5 "cc_reg_operand" "=x")
  4398.     (compare:CC
  4399.      (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4400.              (match_operand:SI 2 "reg_or_short_operand" "r"))
  4401.           (match_operand:SI 3 "gpc_reg_operand" "r"))
  4402.      (const_int 0)))
  4403.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4404.     (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4405.    (clobber (match_scratch:SI 4 "=&r"))]
  4406.   ""
  4407.   "doz %4,%2,%1\;ai %4,%4,-1\;aze. %0,%3"
  4408.   [(set_attr "type" "compare")])
  4409.  
  4410. (define_insn ""
  4411.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4412.     (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4413.                (const_int 0))))]
  4414.   ""
  4415.   "sfi %0,%1,0\;ame %0,%0\;srai %0,%0,31")
  4416.  
  4417. (define_insn ""
  4418.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4419.     (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4420.                (match_operand:SI 2 "reg_or_short_operand" "r"))))]
  4421.   ""
  4422.   "doz %0,%2,%1\;nabs %0,%0\;srai %0,%0,31")
  4423.  
  4424. (define_insn ""
  4425.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4426.     (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4427.         (match_operand:SI 2 "reg_or_short_operand" "rI")))]
  4428.   ""
  4429.   "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;neg %0,%0")
  4430.  
  4431. (define_insn ""
  4432.   [(set (match_operand:CC 3 "cc_reg_operand" "=x")
  4433.     (compare:CC
  4434.      (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4435.          (match_operand:SI 2 "reg_or_short_operand" "rI"))
  4436.      (const_int 0)))
  4437.    (set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4438.     (gtu:SI (match_dup 1) (match_dup 2)))]
  4439.   ""
  4440.   "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;neg. %0,%0"
  4441.   [(set_attr "type" "compare")])
  4442.  
  4443. (define_insn ""
  4444.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4445.     (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4446.              (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
  4447.          (match_operand:SI 3 "reg_or_short_operand" "r,I")))
  4448.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4449.   ""
  4450.   "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3")
  4451.  
  4452. (define_insn ""
  4453.   [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
  4454.     (compare:CC
  4455.      (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4456.               (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
  4457.           (match_operand:SI 3 "reg_or_short_operand" "r,I"))
  4458.      (const_int 0)))
  4459.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4460.   ""
  4461.   "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3"
  4462.   [(set_attr "type" "compare")])
  4463.  
  4464. (define_insn ""
  4465.   [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
  4466.     (compare:CC
  4467.      (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
  4468.               (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
  4469.           (match_operand:SI 3 "reg_or_short_operand" "r,I"))
  4470.      (const_int 0)))
  4471.    (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
  4472.     (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
  4473.    (clobber (match_scratch:SI 4 "=&r,&r"))]
  4474.   ""
  4475.   "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3"
  4476.   [(set_attr "type" "compare")])
  4477.  
  4478. (define_insn ""
  4479.   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
  4480.     (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
  4481.             (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
  4482.   ""
  4483.   "sf%I2 %0,%1,%2\;sfe %0,%0,%0")
  4484.  
  4485. ;; Define both directions of branch and return.  If we need a reload
  4486. ;; register, we'd rather use CR0 since it is much easier to copy a
  4487. ;; register CC value to there.
  4488.  
  4489. (define_insn ""
  4490.   [(set (pc)
  4491.     (if_then_else (match_operator 1 "branch_comparison_operator"
  4492.                       [(match_operand 2
  4493.                               "cc_reg_operand" "x,?y")
  4494.                        (const_int 0)])
  4495.               (label_ref (match_operand 0 "" ""))
  4496.               (pc)))]
  4497.   ""
  4498.   "%C1bc %t1,%j1,%0")
  4499.  
  4500. (define_insn ""
  4501.   [(set (pc)
  4502.     (if_then_else (match_operator 0 "branch_comparison_operator"
  4503.                       [(match_operand 1
  4504.                               "cc_reg_operand" "x,?y")
  4505.                        (const_int 0)])
  4506.               (return)
  4507.               (pc)))]
  4508.   "direct_return ()"
  4509.   "%C0bcr %t0,%j0")
  4510.  
  4511. (define_insn ""
  4512.   [(set (pc)
  4513.     (if_then_else (match_operator 1 "branch_comparison_operator"
  4514.                       [(match_operand 2
  4515.                               "cc_reg_operand" "x,?y")
  4516.                        (const_int 0)])
  4517.               (pc)
  4518.               (label_ref (match_operand 0 "" ""))))]
  4519.   ""
  4520.   "%C1bc %T1,%j1,%0")
  4521.  
  4522. (define_insn ""
  4523.   [(set (pc)
  4524.     (if_then_else (match_operator 0 "branch_comparison_operator"
  4525.                       [(match_operand 1
  4526.                               "cc_reg_operand" "x,?y")
  4527.                        (const_int 0)])
  4528.               (pc)
  4529.               (return)))]
  4530.   "direct_return ()"
  4531.   "%C0bcr %T0,%j0")
  4532.  
  4533. ;; Unconditional branch and return.
  4534.  
  4535. (define_insn "jump"
  4536.   [(set (pc)
  4537.     (label_ref (match_operand 0 "" "")))]
  4538.   ""
  4539.   "b %l0")
  4540.  
  4541. (define_insn "return"
  4542.   [(return)]
  4543.   "direct_return ()"
  4544.   "br")
  4545.  
  4546. (define_insn "indirect_jump"
  4547.   [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
  4548.   ""
  4549.   "@
  4550.    bctr
  4551.    br")
  4552.  
  4553. ;; Table jump for switch statements:
  4554. (define_expand "tablejump"
  4555.   [(set (match_dup 3)
  4556.     (plus:SI (match_operand:SI 0 "" "")
  4557.          (match_dup 2)))
  4558.    (parallel [(set (pc) (match_dup 3))
  4559.           (use (label_ref (match_operand 1 "" "")))])]
  4560.   ""
  4561.   "
  4562. { operands[0] = force_reg (SImode, operands[0]);
  4563.   operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
  4564.   operands[3] = gen_reg_rtx (SImode);
  4565. }")
  4566.  
  4567. (define_insn ""
  4568.   [(set (pc)
  4569.     (match_operand:SI 0 "register_operand" "c,l"))
  4570.    (use (label_ref (match_operand 1 "" "")))]
  4571.   ""
  4572.   "@
  4573.    bctr
  4574.    br")
  4575.  
  4576. (define_insn "nop"
  4577.   [(const_int 0)]
  4578.   ""
  4579.   "cror 0,0,0")
  4580.  
  4581. ;; Define the subtract-one-and-jump insns. 
  4582. ;; We need to be able to do this for any operand, including MEM, or we
  4583. ;; will cause reload to blow up since we don't allow output reloads on
  4584. ;; JUMP_INSNs. 
  4585. (define_insn ""
  4586.   [(set (pc)
  4587.     (if_then_else (ne (match_operand:SI 1 "register_operand" "0,*r,*r")
  4588.               (const_int 1))
  4589.               (label_ref (match_operand 2 "" ""))
  4590.               (pc)))
  4591.    (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
  4592.     (plus:SI (match_dup 1) (const_int -1)))
  4593.    (clobber (match_scratch:CC 3 "=X,&x,&x"))
  4594.    (clobber (match_scratch:SI 4 "=X,X,r"))]
  4595.   ""
  4596.   "@
  4597.    bdn %l2
  4598.    #
  4599.    #")
  4600.                    
  4601. ;; Similar, but we can use GE since we have a REG_NOTES.
  4602. (define_insn ""
  4603.   [(set (pc)
  4604.     (if_then_else (ge (match_operand:SI 1 "register_operand" "0,*r,*r")
  4605.               (const_int 0))
  4606.               (label_ref (match_operand 2 "" ""))
  4607.               (pc)))
  4608.    (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
  4609.     (plus:SI (match_dup 1) (const_int -1)))
  4610.    (clobber (match_scratch:CC 3 "=X,&x,&X"))
  4611.    (clobber (match_scratch:SI 4 "=X,X,r"))]
  4612.   "find_reg_note (insn, REG_NONNEG, 0)"
  4613.   "@
  4614.    bdn %l2
  4615.    #
  4616.    #")
  4617.                    
  4618. (define_insn ""
  4619.   [(set (pc)
  4620.     (if_then_else (eq (match_operand:SI 1 "register_operand" "0,*r,*r")
  4621.               (const_int 1))
  4622.               (label_ref (match_operand 2 "" ""))
  4623.               (pc)))
  4624.    (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
  4625.     (plus:SI (match_dup 1) (const_int -1)))
  4626.    (clobber (match_scratch:CC 3 "=X,&x,&x"))
  4627.    (clobber (match_scratch:SI 4 "=X,X,r"))]
  4628.   ""
  4629.   "@
  4630.    bdz %l2
  4631.    #
  4632.    #")
  4633.  
  4634. (define_split
  4635.   [(set (pc)
  4636.     (if_then_else (match_operator 2 "comparison_operator"
  4637.                       [(match_operand:SI 1 "gpc_reg_operand" "")
  4638.                        (const_int 1)])
  4639.               (match_operand 5 "" "")
  4640.               (match_operand 6 "" "")))
  4641.    (set (match_operand:SI 0 "gpc_reg_operand" "")
  4642.     (plus:SI (match_dup 1) (const_int -1)))
  4643.    (clobber (match_scratch:CC 3 ""))
  4644.    (clobber (match_scratch:SI 4 ""))]
  4645.   "reload_completed"
  4646.   [(parallel [(set (match_dup 3)
  4647.            (compare:CC (plus:SI (match_dup 1) (const_int -1))
  4648.                    (const_int 0)))
  4649.           (set (match_dup 0) (plus:SI (match_dup 1) (const_int -1)))])
  4650.    (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
  4651.   "
  4652. { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
  4653.              const0_rtx); }")
  4654.  
  4655. (define_split
  4656.   [(set (pc)
  4657.     (if_then_else (match_operator 2 "comparison_operator"
  4658.                       [(match_operand:SI 1 "gpc_reg_operand" "")
  4659.                        (const_int 1)])
  4660.               (match_operand 5 "" "")
  4661.               (match_operand 6 "" "")))
  4662.    (set (match_operand:SI 0 "general_operand" "")
  4663.     (plus:SI (match_dup 1) (const_int -1)))
  4664.    (clobber (match_scratch:CC 3 ""))
  4665.    (clobber (match_scratch:SI 4 ""))]
  4666.   "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
  4667.   [(parallel [(set (match_dup 3)
  4668.            (compare:CC (plus:SI (match_dup 1) (const_int -1))
  4669.                    (const_int 0)))
  4670.           (set (match_dup 4) (plus:SI (match_dup 1) (const_int -1)))])
  4671.    (set (match_dup 0) (match_dup 4))
  4672.    (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
  4673.   "
  4674. { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
  4675.              const0_rtx); }")
  4676.  
  4677. ;;- Local variables:
  4678. ;;- mode:emacs-lisp
  4679. ;;- comment-start: ";;- "
  4680. ;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
  4681. ;;- eval: (modify-syntax-entry ?[ "(]")
  4682. ;;- eval: (modify-syntax-entry ?] ")[")
  4683. ;;- eval: (modify-syntax-entry ?{ "(}")
  4684. ;;- eval: (modify-syntax-entry ?} "){")
  4685. ;;- End:
  4686.