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 / pyr.md < prev    next >
Text File  |  1994-02-06  |  39KB  |  1,415 lines

  1. ;; GNU C machine description for Pyramid 90x, 9000, MIServer Series
  2. ;; Copyright (C) 1989, 1990 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. ;; Instruction patterns.  When multiple patterns apply,
  21. ;; the first one in the file is chosen.
  22. ;;
  23. ;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
  24. ;;
  25. ;; cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
  26. ;; updates for most instructions.
  27.  
  28. ;; These comments are mostly obsolete.  Written for gcc version 1.XX.
  29. ;; * Try using define_insn instead of some peepholes in more places.
  30. ;; * Set REG_NOTES:REG_EQUIV for cvt[bh]w loads.  This would make the
  31. ;;   backward scan in sign_extend needless.
  32. ;; * Match (pc) (label_ref) case in peephole patterns.
  33. ;; * Should optimize
  34. ;;   "cmpX op1,op2;  b{eq,ne} LY;  ucmpX op1.op2;  b{lt,le,gt,ge} LZ"
  35. ;;   to
  36. ;;   "ucmpX op1,op2;  b{eq,ne} LY;  b{lt,le,gt,ge} LZ"
  37. ;;   by pre-scanning insn and running notice_update_cc for them.
  38. ;; * Is it necessary to do copy_rtx in the test and compare patterns?
  39. ;; * Fix true frame pointer omission.
  40. ;; * Make the jump tables contain branches, not addresses!  This would
  41. ;;   save us one instruction.
  42. ;; * Could the complicated scheme for compares be simplified, if we had
  43. ;;   no named cmpqi or cmphi patterns, and instead anonymous patterns for
  44. ;;   the less-than-word compare cases pyr can handle???
  45. ;; * The jump insn seems to accept more than just IR addressing.  Would
  46. ;;   we win by telling GCC?  Or can we use movw into the global reg which
  47. ;;   is a synonym for pc?
  48. ;; * More DImode patterns.
  49. ;; * Scan backwards in "zero_extendhisi2", "zero_extendqisi2" to find out
  50. ;;   if the extension can be omitted.
  51. ;; * "divmodsi" with Pyramid "ediv" insn.  Is it possible in rtl??
  52. ;; * Would "rcsp tmpreg; u?cmp[bh] op1_regdispl(tmpreg),op2" win in
  53. ;;   comparison with the two extensions and single test generated now?
  54. ;;   The rcsp insn could be expanded, and moved out of loops by the
  55. ;;   optimizer, making 1 (64 bit) insn of 3 (32 bit) insns in loops.
  56. ;;   The rcsp insn could be followed by an add insn, making non-displacement
  57. ;;   IR addressing sufficient.
  58.  
  59. ;______________________________________________________________________
  60. ;
  61. ;    Test and Compare Patterns.
  62. ;______________________________________________________________________
  63.  
  64. ; The argument for the rather complicated test and compare expansion
  65. ; scheme, is the irregular pyramid instructions for these operations.
  66. ; 1) Pyramid has different signed and unsigned compares.  2) HImode
  67. ; and QImode integers are memory-memory and immediate-memory only.  3)
  68. ; Unsigned HImode compares doesn't exist.  4) Only certain
  69. ; combinations of addresses are allowed for memory-memory compares.
  70. ; Whenever necessary, in order to fulfill these addressing
  71. ; constraints, the compare operands are swapped.
  72.  
  73. (define_expand "tstsi"
  74.   [(set (cc0)
  75.     (match_operand:SI 0 "general_operand" ""))]
  76.   "" "operands[0] = force_reg (SImode, operands[0]);")
  77.  
  78. (define_insn ""
  79.   [(set (cc0)
  80.     (compare (match_operand:SI 0 "memory_operand" "m")
  81.          (match_operand:SI 1 "memory_operand" "m")))]
  82.   "weird_memory_memory (operands[0], operands[1])"
  83.   "*
  84. {
  85.   rtx br_insn = NEXT_INSN (insn);
  86.   RTX_CODE br_code;
  87.  
  88.   if (GET_CODE (br_insn) != JUMP_INSN)
  89.     abort();
  90.   br_code =  GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
  91.  
  92.   weird_memory_memory (operands[0], operands[1]);
  93.  
  94.   if (swap_operands)
  95.     {
  96.       cc_status.flags = CC_REVERSED;
  97.       if (TRULY_UNSIGNED_COMPARE_P (br_code))
  98.     {
  99.       cc_status.mdep = CC_VALID_FOR_UNSIGNED;
  100.       return \"ucmpw %0,%1\";
  101.     }
  102.       return \"cmpw %0,%1\";
  103.     }
  104.  
  105.   if (TRULY_UNSIGNED_COMPARE_P (br_code))
  106.     {
  107.       cc_status.mdep = CC_VALID_FOR_UNSIGNED;
  108.       return \"ucmpw %1,%0\";
  109.     }
  110.   return \"cmpw %1,%0\";
  111. }")
  112.  
  113. (define_insn "cmpsi"
  114.   [(set (cc0)
  115.     (compare (match_operand:SI 0 "nonimmediate_operand" "r,g")
  116.          (match_operand:SI 1 "general_operand" "g,r")))]
  117.   ""
  118.   "*
  119. {
  120.   rtx br_insn = NEXT_INSN (insn);
  121.   RTX_CODE br_code;
  122.  
  123.   if (GET_CODE (br_insn) != JUMP_INSN)
  124.     abort();
  125.   br_code =  GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
  126.  
  127.   if (which_alternative != 0)
  128.     {
  129.       cc_status.flags = CC_REVERSED;
  130.       if (TRULY_UNSIGNED_COMPARE_P (br_code))
  131.     {
  132.       cc_status.mdep = CC_VALID_FOR_UNSIGNED;
  133.       return \"ucmpw %0,%1\";
  134.     }
  135.       return \"cmpw %0,%1\";
  136.     }
  137.  
  138.   if (TRULY_UNSIGNED_COMPARE_P (br_code))
  139.     {
  140.       cc_status.mdep = CC_VALID_FOR_UNSIGNED;
  141.       return \"ucmpw %1,%0\";
  142.     }
  143.   return \"cmpw %1,%0\";
  144. }")
  145.  
  146. (define_insn ""
  147.   [(set (cc0)
  148.     (match_operand:SI 0 "nonimmediate_operand" "r"))]
  149.   ""
  150.   "*
  151. {
  152. #if 0
  153.   cc_status.flags |= CC_NO_OVERFLOW;
  154.   return \"cmpw $0,%0\";
  155. #endif
  156.   rtx br_insn = NEXT_INSN (insn);
  157.   RTX_CODE br_code;
  158.  
  159.   if (GET_CODE (br_insn) != JUMP_INSN)
  160.     abort();
  161.   br_code =  GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
  162.  
  163.   if (TRULY_UNSIGNED_COMPARE_P (br_code))
  164.     {
  165.       cc_status.mdep = CC_VALID_FOR_UNSIGNED;
  166.       return \"ucmpw $0,%0\";
  167.     }
  168.   return \"mtstw %0,%0\";
  169. }")
  170.  
  171. (define_expand "cmphi"
  172.   [(set (cc0)
  173.     (compare (match_operand:HI 0 "nonimmediate_operand" "")
  174.          (match_operand:HI 1 "general_operand" "")))]
  175.   ""
  176.   "
  177. {
  178.   extern rtx test_op0, test_op1;  extern enum machine_mode test_mode;
  179.   test_op0 = copy_rtx (operands[0]);
  180.   test_op1 = copy_rtx (operands[1]);
  181.   test_mode = HImode;
  182.   DONE;
  183. }")
  184.  
  185. (define_expand "tsthi"
  186.   [(set (cc0)
  187.     (match_operand:HI 0 "nonimmediate_operand" ""))]
  188.   ""
  189.   "
  190. {
  191.   extern rtx test_op0;  extern enum machine_mode test_mode;
  192.   test_op0 = copy_rtx (operands[0]);
  193.   test_mode = HImode;
  194.   DONE;
  195. }")
  196.  
  197. (define_insn ""
  198.   [(set (cc0)
  199.     (compare (match_operand:HI 0 "memory_operand" "m")
  200.          (match_operand:HI 1 "memory_operand" "m")))]
  201.   "(!TRULY_UNSIGNED_COMPARE_P (GET_CODE (XEXP (SET_SRC (PATTERN (NEXT_INSN (insn))), 0))))
  202.    && weird_memory_memory (operands[0], operands[1])"
  203.   "*
  204. {
  205.   rtx br_insn = NEXT_INSN (insn);
  206.  
  207.   if (GET_CODE (br_insn) != JUMP_INSN)
  208.     abort();
  209.  
  210.   weird_memory_memory (operands[0], operands[1]);
  211.  
  212.   if (swap_operands)
  213.     {
  214.       cc_status.flags = CC_REVERSED;
  215.       return \"cmph %0,%1\";
  216.     }
  217.  
  218.   return \"cmph %1,%0\";
  219. }")
  220.  
  221. (define_insn ""
  222.   [(set (cc0)
  223.     (compare (match_operand:HI 0 "nonimmediate_operand" "r,m")
  224.          (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
  225.   "(!TRULY_UNSIGNED_COMPARE_P (GET_CODE (XEXP (SET_SRC (PATTERN (NEXT_INSN (insn))), 0))))
  226.    && (GET_CODE (operands[0]) != GET_CODE (operands[1]))"
  227.   "*
  228. {
  229.   rtx br_insn = NEXT_INSN (insn);
  230.  
  231.   if (GET_CODE (br_insn) != JUMP_INSN)
  232.     abort();
  233.  
  234.   if (which_alternative != 0)
  235.     {
  236.       cc_status.flags = CC_REVERSED;
  237.       return \"cmph %0,%1\";
  238.     }
  239.  
  240.   return \"cmph %1,%0\";
  241. }")
  242.  
  243. (define_expand "cmpqi"
  244.   [(set (cc0)
  245.     (compare (match_operand:QI 0 "nonimmediate_operand" "")
  246.          (match_operand:QI 1 "general_operand" "")))]
  247.   ""
  248.   "
  249. {
  250.   extern rtx test_op0, test_op1;  extern enum machine_mode test_mode;
  251.   test_op0 = copy_rtx (operands[0]);
  252.   test_op1 = copy_rtx (operands[1]);
  253.   test_mode = QImode;
  254.   DONE;
  255. }")
  256.  
  257. (define_expand "tstqi"
  258.   [(set (cc0)
  259.     (match_operand:QI 0 "nonimmediate_operand" ""))]
  260.   ""
  261.   "
  262. {
  263.   extern rtx test_op0;  extern enum machine_mode test_mode;
  264.   test_op0 = copy_rtx (operands[0]);
  265.   test_mode = QImode;
  266.   DONE;
  267. }")
  268.  
  269. (define_insn ""
  270.   [(set (cc0)
  271.     (compare (match_operand:QI 0 "memory_operand" "m")
  272.          (match_operand:QI 1 "memory_operand" "m")))]
  273.   "weird_memory_memory (operands[0], operands[1])"
  274.   "*
  275. {
  276.   rtx br_insn = NEXT_INSN (insn);
  277.   RTX_CODE br_code;
  278.  
  279.   if (GET_CODE (br_insn) != JUMP_INSN)
  280.     abort();
  281.   br_code =  GET_CODE (XEXP