home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / GCC / GCC258_5.LHA / gcc-2.5.8-amiga / config / rs6000 / rs6000.md < prev    next >
Encoding:
Text File  |  1994-01-26  |  173.3 KB  |  5,518 lines

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