home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gcc-2.6.0-src.lha / GNU / src / amiga / gcc-2.6.0 / config / rs6000 / rs6000.md < prev    next >
Encoding:
Text File  |  1994-07-13  |  202.4 KB  |  6,480 lines

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