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

  1. ;;- Machine description for SPUR chip for GNU C compiler
  2. ;;   Copyright (C) 1988 Free Software Foundation, Inc.
  3.  
  4. ;; This file is part of GNU CC.
  5.  
  6. ;; GNU CC is free software; you can redistribute it and/or modify
  7. ;; it under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation; either version 2, or (at your option)
  9. ;; any later version.
  10.  
  11. ;; GNU CC is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ;; GNU General Public License for more details.
  15.  
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with GNU CC; see the file COPYING.  If not, write to
  18. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20.  
  21. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  22.  
  23. ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
  24. ;;- updates for most instructions.
  25.  
  26. ;;- Operand classes for the register allocator:
  27.  
  28. ;; Compare instructions.
  29. ;; This pattern is used for generating an "insn"
  30. ;; which does just a compare and sets a (fictitious) condition code.
  31.  
  32. ;; The actual SPUR insns are compare-and-conditional-jump.
  33. ;; The define_peephole's below recognize the combinations of
  34. ;; compares and jumps, and output each pair as a single assembler insn.
  35.  
  36. ;; This controls RTL generation and register allocation.
  37. (define_insn "cmpsi"
  38.   [(set (cc0)
  39.     (compare (match_operand:SI 0 "register_operand" "rK")
  40.          (match_operand:SI 1 "nonmemory_operand" "rK")))]
  41.   ""
  42.   "*
  43. {
  44.   cc_status.value1 = operands[0], cc_status.value2 = operands[1];
  45.   return \"\";
  46. }")
  47.  
  48. ;; We have to have this because cse can optimize the previous pattern
  49. ;; into this one.
  50.  
  51. (define_insn "tstsi"
  52.   [(set (cc0)
  53.     (match_operand:SI 0 "register_operand" "r"))]
  54.   ""
  55.   "*
  56. {
  57.   cc_status.value1 = operands[0], cc_status.value2 = const0_rtx;
  58.   return \"\";
  59. }")
  60.  
  61.  
  62. ;; These control RTL generation for conditional jump insns
  63. ;; and match them for register allocation.
  64.  
  65. (define_insn "beq"
  66.   [(set (pc)
  67.     (if_then_else (eq (cc0)
  68.               (const_int 0))
  69.               (label_ref (match_operand 0 "" ""))
  70.               (pc)))]
  71.   ""
  72.   "* return output_compare (operands, \"eq\", \"eq\", \"ne\", \"ne\"); ")
  73.  
  74. (define_insn "bne"
  75.   [(set (pc)
  76.     (if_then_else (ne (cc0)
  77.               (const_int 0))
  78.               (label_ref (match_operand 0 "" ""))
  79.               (pc)))]
  80.   ""
  81.   "* return output_compare (operands, \"ne\", \"ne\", \"eq\", \"eq\"); ")
  82.  
  83. (define_insn "bgt"
  84.   [(set (pc)
  85.     (if_then_else (gt (cc0)
  86.               (const_int 0))
  87.               (label_ref (match_operand 0 "" ""))
  88.               (pc)))]
  89.   ""
  90.   "* return output_compare (operands, \"gt\", \"lt\", \"le\", \"ge\"); ")
  91.  
  92. (define_insn "bgtu"
  93.   [(set (pc)
  94.     (if_then_else (gtu (cc0)
  95.                (const_int 0))
  96.               (label_ref (match_operand 0 "" ""))
  97.               (pc)))]
  98.   ""
  99.   "* return output_compare (operands, \"ugt\", \"ult\", \"ule\", \"uge\"); ")
  100.  
  101. (define_insn "blt"
  102.   [(set (pc)
  103.     (if_then_else (lt (cc0)
  104.               (const_int 0))
  105.               (label_ref (match_operand 0 "" ""))
  106.               (pc)))]
  107.   ""
  108.   "* return output_compare (operands, \"lt\", \"gt\", \"ge\", \"le\"); ")
  109.  
  110. (define_insn "bltu"
  111.   [(set (pc)
  112.     (if_then_else (ltu (cc0)
  113.                (const_int 0))
  114.               (label_ref (match_operand 0 "" ""))
  115.               (pc)))]
  116.   ""
  117.   "* return output_compare (operands, \"ult\", \"ugt\", \"uge\", \"ule\"); ")
  118.  
  119. (define_insn "bge"
  120.   [(set (pc)
  121.     (if_then_else (ge (cc0)
  122.               (const_int 0))
  123.               (label_ref (match_operand 0 "" ""))
  124.               (pc)))]
  125.   ""
  126.   "* return output_compare (operands, \"ge\", \"le\", \"lt\", \"gt\"); ")
  127.  
  128. (define_insn "bgeu"
  129.   [(set (pc)
  130.     (if_then_else (geu (cc0)
  131.                (const_int 0))
  132.               (label_ref (match_operand 0 "" ""))
  133.               (pc)))]
  134.   ""
  135.   "* return output_compare (operands, \"uge\", \"ule\", \"ult\", \"ugt\"); ")
  136.  
  137. (define_insn "ble"
  138.   [(set (pc)
  139.     (if_then_else (le (cc0)
  140.               (const_int 0))
  141.               (label_ref (match_operand 0 "" ""))
  142.               (pc)))]
  143.   ""
  144.   "* return output_compare (operands, \"le\", \"ge\", \"gt\", \"lt\"); ")
  145.  
  146. (define_insn "bleu"
  147.   [(set (pc)
  148.     (if_then_else (leu (cc0)
  149.                (const_int 0))
  150.               (label_ref (match_operand 0 "" ""))
  151.               (pc)))]
  152.   ""
  153.   "* return output_compare (operands, \"ule\", \"uge\", \"ugt\", \"ult\"); ")
  154.  
  155. ;; These match inverted jump insns for register allocation.
  156.  
  157. (define_insn ""
  158.   [(set (pc)
  159.     (if_then_else (eq (cc0)
  160.               (const_int 0))
  161.               (pc)
  162.               (label_ref (match_operand 0 "" ""))))]
  163.   ""
  164.   "* return output_compare (operands, \"ne\", \"ne\", \"eq\", \"eq\"); ")
  165.  
  166. (define_insn ""
  167.   [(set (pc)
  168.     (if_then_else (ne (cc0)
  169.               (const_int 0))
  170.               (pc)
  171.               (label_ref (match_operand 0 "" ""))))]
  172.   ""
  173.   "* return output_compare (operands, \"eq\", \"eq\", \"ne\", \"ne\"); ")
  174.  
  175. (define_insn ""
  176.   [(set (pc)
  177.     (if_then_else (gt (cc0)
  178.               (const_int 0))
  179.               (pc)
  180.               (label_ref (match_operand 0 "" ""))))]
  181.   ""
  182.   "* return output_compare (operands, \"le\", \"ge\", \"gt\", \"lt\"); ")
  183.  
  184. (define_insn ""
  185.   [(set (pc)
  186.     (if_then_else (gtu (cc0)
  187.                (const_int 0))
  188.               (pc)
  189.               (label_ref (match_operand 0 "" ""))))]
  190.   ""
  191.   "* return output_compare (operands, \"ule\", \"uge\", \"ugt\", \"ult\"); ")
  192.  
  193. (define_insn ""
  194.   [(set (pc)
  195.     (if_then_else (lt (cc0)
  196.               (const_int 0))
  197.               (pc)
  198.               (label_ref (match_operand 0 "" ""))))]
  199.   ""
  200.   "* return output_compare (operands, \"ge\", \"le\", \"lt\", \"gt\"); ")
  201.  
  202. (define_insn ""
  203.   [(set (pc)
  204.     (if_then_else (ltu (cc0)
  205.                (const_int 0))
  206.               (pc)
  207.               (label_ref (match_operand 0 "" ""))))]
  208.   ""
  209.   "* return output_compare (operands, \"uge\", \"ule\", \"ult\", \"ugt\"); ")
  210.  
  211. (define_insn ""
  212.   [(set (pc)
  213.     (if_then_else (ge (cc0)
  214.               (const_int 0))
  215.               (pc)
  216.               (label_ref (match_operand 0 "" ""))))]
  217.   ""
  218.   "* return output_compare (operands, \"lt\", \"gt\", \"ge\", \"le\"); ")
  219.  
  220. (define_insn ""
  221.   [(set (pc)
  222.     (if_then_else (geu (cc0)
  223.                (const_int 0))
  224.               (pc)
  225.               (label_ref (match_operand 0 "" ""))))]
  226.   ""
  227.   "* return output_compare (operands, \"ult\", \"ugt\", \"uge\", \"ule\"); ")
  228.  
  229. (define_insn ""
  230.   [(set (pc)
  231.     (if_then_else (le (cc0)
  232.               (const_int 0))
  233.               (pc)
  234.               (label_ref (match_operand 0 "" ""))))]
  235.   ""
  236.   "* return output_compare (operands, \"gt\", \"lt\", \"le\", \"ge\"); ")
  237.  
  238. (define_insn ""
  239.   [(set (pc)
  240.     (if_then_else (leu (cc0)
  241.                (const_int 0))
  242.               (pc)
  243.               (label_ref (match_operand 0 "" ""))))]
  244.   ""
  245.   "* return output_compare (operands, \"ugt\", \"ult\", \"ule\", \"uge\"); ")
  246.  
  247. ;; Move instructions
  248.  
  249. (define_insn "movsi"
  250.   [(set (match_operand:SI 0 "general_operand" "=r,m")
  251.     (match_operand:SI 1 "general_operand" "rmi,rJ"))]
  252.   ""
  253.   "*
  254. {
  255.   if (GET_CODE (operands[0]) == MEM)
  256.     return \"st_32 %r1,%0\";
  257.   if (GET_CODE (operands[1]) == MEM)
  258.     return \"ld_32 %0,%1\;nop\";
  259.   if (GET_CODE (operands[1]) == REG)
  260.     return \"add_nt %0,%1,$0\";
  261.   if (GET_CODE (operands[1]) == SYMBOL_REF && operands[1]->unchanging)
  262.     return \"add_nt %0,r24,$(%1-0b)\";
  263.   return \"add_nt %0,r0,%1\";
  264. }")
  265.  
  266. (define_insn ""
  267.   [(set (match_operand:SI 0 "register_operand" "=r")
  268.     (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
  269.              (match_operand:SI 2 "register_operand" "r"))))]
  270.   ""
  271.   "ld_32 %0,%1,%2\;nop")
  272.  
  273. ;; Generate insns for moving single bytes.
  274.  
  275. (define_expand "movqi"
  276.   [(set (match_operand:QI 0 "general_operand" "")
  277.     (match_operand:QI 1 "general_operand" ""))]
  278.   ""
  279.   "
  280. {
  281.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  282.     operands[1] = copy_to_reg (operands[1]);
  283.  
  284.   if (GET_CODE (operands[1]) == MEM)
  285.     {
  286.       rtx tem = gen_reg_rtx (SImode);
  287.       rtx addr = force_reg (SImode, XEXP (operands[1], 0));
  288.       rtx subreg;
  289.  
  290.       emit_move_insn (tem, gen_rtx (MEM, SImode, addr));
  291.       if (GET_CODE (operands[0]) == SUBREG)
  292.     subreg = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[0]),
  293.               SUBREG_WORD (operands[0]));
  294.       else
  295.     subreg = gen_rtx (SUBREG, SImode, operands[0], 0);
  296.  
  297.       emit_insn (gen_rtx (SET, VOIDmode, subreg,
  298.               gen_rtx (ZERO_EXTRACT, SImode, tem,
  299.                    gen_rtx (CONST_INT, VOIDmode, 8),
  300.                    addr)));
  301.     }
  302.   else if (GET_CODE (operands[0]) == MEM)
  303.     {
  304.       rtx tem = gen_reg_rtx (SImode);
  305.       rtx addr = force_reg (