home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / vax / inline / machpats.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-08  |  4.7 KB  |  235 lines

  1. /*-
  2.  * Copyright (c) 1984, 1986 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  */
  33.  
  34. #ifndef lint
  35. static char sccsid[] = "@(#)machpats.c    7.4 (Berkeley) 5/8/91";
  36. #endif /* not lint */
  37.  
  38. #include "inline.h"
  39.  
  40. /*
  41.  * Pattern table for special VAX instructions.
  42.  */
  43. struct pats machine_ptab[] = {
  44.  
  45. #ifdef vax
  46.     { 3, "_blkcpy\n",
  47. "    movl    (sp)+,r1\n\
  48.     movl    (sp)+,r3\n\
  49.     jbr    2f\n\
  50. 1:\n\
  51.     subl2    r0,(sp)\n\
  52.     movc3    r0,(r1),(r3)\n\
  53. 2:\n\
  54.     movzwl    $65535,r0\n\
  55.     cmpl    (sp),r0\n\
  56.     jgtr    1b\n\
  57.     movl    (sp)+,r0\n\
  58.     movc3    r0,(r1),(r3)\n" },
  59.  
  60.     { 3, "_bcopy\n",
  61. "    movl    (sp)+,r1\n\
  62.     movl    (sp)+,r3\n\
  63.     movl    (sp)+,r5\n\
  64.     movc3    r5,(r1),(r3)\n" },
  65.  
  66.     { 3, "_ovbcopy\n",
  67. "    movl    (sp)+,r3\n\
  68.     movl    (sp)+,r4\n\
  69.     movl    (sp)+,r5\n\
  70.     movc3    r5,(r3),(r4)\n" },
  71.  
  72.     { 2, "_blkclr\n",
  73. "    movl    (sp)+,r3\n\
  74.     jbr    2f\n\
  75. 1:\n\
  76.     subl2    r0,(sp)\n\
  77.     movc5    $0,(r3),$0,r0,(r3)\n\
  78. 2:\n\
  79.     movzwl    $65535,r0\n\
  80.     cmpl    (sp),r0\n\
  81.     jgtr    1b\n\
  82.     movl    (sp)+,r0\n\
  83.     movc5    $0,(r3),$0,r0,(r3)\n" },
  84.  
  85.     { 2, "_bzero\n",
  86. "    movl    (sp)+,r3\n\
  87.     movl    (sp)+,r5\n\
  88.     movc5    $0,(r3),$0,r5,(r3)\n" },
  89.  
  90.     { 2, "_insque\n",
  91. "    movl    (sp)+,r4\n\
  92.     movl    (sp)+,r5\n\
  93.     insque    (r4),(r5)\n" },
  94.  
  95.     { 1, "_remque\n",
  96. "    movl    (sp)+,r5\n\
  97.     remque    (r5),r0\n" },
  98. #endif vax
  99.  
  100. #ifdef mc68000
  101. /* someday... */
  102. #endif mc68000
  103.  
  104.     { 0, "", "" }
  105. };
  106.  
  107. #ifdef vax
  108.  
  109. struct pats vax_ptab[] = {
  110.  
  111.     { 3, "_blkcmp\n",
  112. "    movl    (sp)+,r1\n\
  113.     movl    (sp)+,r3\n\
  114.     jbr    2f\n\
  115. 1:\n\
  116.     subl2    r0,(sp)\n\
  117.     cmpc3    r0,(r1),(r3)\n\
  118.     bneq    3f\n\
  119. 2:\n\
  120.     movzwl    $65535,r0\n\
  121.     cmpl    (sp),r0\n\
  122.     jgtr    1b\n\
  123.     movl    (sp)+,r0\n\
  124.     cmpc3    r0,(r1),(r3)\n\
  125. 3:\n" },
  126.  
  127.     { 3, "_bcmp\n",
  128. "    movl    (sp)+,r1\n\
  129.     movl    (sp)+,r3\n\
  130.     movl    (sp)+,r5\n\
  131.     cmpc3    r5,(r1),(r3)\n" },
  132.  
  133.     { 3, "_llocc\n",
  134. "    movl    (sp)+,r4\n\
  135.     movl    (sp)+,r5\n\
  136.     movl    (sp)+,r1\n\
  137. 1:\n\
  138.     movzwl    $65535,r0\n\
  139.     cmpl    r5,r0\n\
  140.     jleq    1f\n\
  141.     subl2    r0,r5\n\
  142.     locc    r4,r0,(r1)\n\
  143.     jeql    1b\n\
  144.     addl2    r5,r0\n\
  145.     jbr    2f\n\
  146. 1:\n\
  147.     locc    r4,r5,(r1)\n\
  148. 2:\n" },
  149.  
  150.     { 3, "_locc\n",
  151. "    movl    (sp)+,r3\n\
  152.     movl    (sp)+,r4\n\
  153.     movl    (sp)+,r5\n\
  154.     locc    r3,r4,(r5)\n" },
  155.  
  156.     { 4, "_scanc\n",
  157. "    movl    (sp)+,r2\n\
  158.     movl    (sp)+,r3\n\
  159.     movl    (sp)+,r4\n\
  160.     movl    (sp)+,r5\n\
  161.     scanc    r2,(r3),(r4),r5\n" },
  162.  
  163.     { 3, "_skpc\n",
  164. "    movl    (sp)+,r3\n\
  165.     movl    (sp)+,r4\n\
  166.     movl    (sp)+,r5\n\
  167.     skpc    r3,r4,(r5)\n" },
  168.  
  169.     { 0, "", "" }
  170. };
  171.  
  172. struct pats vaxsubset_ptab[] = {
  173.  
  174.     { 3, "_blkcmp\n",
  175. "    movl    (sp)+,r1\n\
  176.     movl    (sp)+,r3\n\
  177.     movl    (sp)+,r0\n\
  178. 2:\n\
  179.     cmpb    (r1)+,(r3)+\n\
  180.     jneq    3f\n\
  181.     sobgtr    r0,2b\n\
  182. 3:\n" },
  183.  
  184.     { 3, "_bcmp\n",
  185. "    movl    (sp)+,r1\n\
  186.     movl    (sp)+,r3\n\
  187.     movl    (sp)+,r0\n\
  188.     tstl    r0\n\
  189.     jeql    1f\n\
  190. 2:\n\
  191.     cmpb    (r1)+,(r3)+\n\
  192.     jneq    1f\n\
  193.     sobgtr    r0,2b\n\
  194. 1:\n" },
  195.  
  196.     { 3, "_llocc\n",
  197. "    movl    (sp)+,r4\n\
  198.     movl    (sp)+,r0\n\
  199.     tstl    r0\n\
  200.     jeql    1f\n\
  201.     movl    (sp)+,r1\n\
  202. 2:\n\
  203.     cmpb    r4,(r1)+\n\
  204.     jeql    1f\n\
  205.     sobgtr    r0,2b\n\
  206. 1:\n" },
  207.  
  208.     { 3, "_locc\n",
  209. "    movl    (sp)+,r3\n\
  210.     movl    (sp)+,r0\n\
  211.     tstl    r0\n\
  212.     jeql    1f\n\
  213.     movl    (sp)+,r5\n\
  214. 2:\n\
  215.     cmpb    r3,(r5)+\n\
  216.     jeql    1f\n\
  217.     sobgtr    r0,2b\n\
  218. 1:\n" },
  219.  
  220.     { 3, "_skpc\n",
  221. "    movl    (sp)+,r3\n\
  222.     movl    (sp)+,r0\n\
  223.     tstl    r0\n\
  224.     jeql    1f\n\
  225.     movl    (sp)+,r5\n\
  226. 2:\n\
  227.     cmpb    r3,(r5)+\n\
  228.     jneq    1f\n\
  229.     sobgtr    r0,2b\n\
  230. 1:\n" },
  231.  
  232.     { 0, "", "" }
  233. };
  234. #endif
  235.