xref: /original-bsd/sys/vax/inline/machpats.c (revision 241757c4)
1 /*
2  * Copyright (c) 1984, 1986 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)machpats.c	7.1 (Berkeley) 06/05/86";
9 #endif not lint
10 
11 #include "inline.h"
12 
13 /*
14  * Pattern table for special VAX instructions.
15  */
16 struct pats machine_ptab[] = {
17 
18 #ifdef vax
19 	{ 3, "_blkcpy\n",
20 "	movl	(sp)+,r1\n\
21 	movl	(sp)+,r3\n\
22 	jbr	2f\n\
23 1:\n\
24 	subl2	r0,(sp)\n\
25 	movc3	r0,(r1),(r3)\n\
26 2:\n\
27 	movzwl	$65535,r0\n\
28 	cmpl	(sp),r0\n\
29 	jgtr	1b\n\
30 	movl	(sp)+,r0\n\
31 	movc3	r0,(r1),(r3)\n" },
32 
33 	{ 3, "_bcopy\n",
34 "	movl	(sp)+,r1\n\
35 	movl	(sp)+,r3\n\
36 	movl	(sp)+,r5\n\
37 	movc3	r5,(r1),(r3)\n" },
38 
39 	{ 3, "_ovbcopy\n",
40 "	movl	(sp)+,r3\n\
41 	movl	(sp)+,r4\n\
42 	movl	(sp)+,r5\n\
43 	movc3	r5,(r3),(r4)\n" },
44 
45 	{ 2, "_blkclr\n",
46 "	movl	(sp)+,r3\n\
47 	jbr	2f\n\
48 1:\n\
49 	subl2	r0,(sp)\n\
50 	movc5	$0,(r3),$0,r0,(r3)\n\
51 2:\n\
52 	movzwl	$65535,r0\n\
53 	cmpl	(sp),r0\n\
54 	jgtr	1b\n\
55 	movl	(sp)+,r0\n\
56 	movc5	$0,(r3),$0,r0,(r3)\n" },
57 
58 	{ 2, "_bzero\n",
59 "	movl	(sp)+,r3\n\
60 	movl	(sp)+,r5\n\
61 	movc5	$0,(r3),$0,r5,(r3)\n" },
62 
63 	{ 2, "_insque\n",
64 "	movl	(sp)+,r4\n\
65 	movl	(sp)+,r5\n\
66 	insque	(r4),(r5)\n" },
67 
68 	{ 1, "_remque\n",
69 "	movl	(sp)+,r5\n\
70 	remque	(r5),r0\n" },
71 #endif vax
72 
73 #ifdef mc68000
74 /* someday... */
75 #endif mc68000
76 
77 	{ 0, "", "" }
78 };
79 
80 #ifdef vax
81 
82 struct pats vax_ptab[] = {
83 
84 	{ 3, "_blkcmp\n",
85 "	movl	(sp)+,r1\n\
86 	movl	(sp)+,r3\n\
87 	jbr	2f\n\
88 1:\n\
89 	subl2	r0,(sp)\n\
90 	cmpc3	r0,(r1),(r3)\n\
91 	bneq	3f\n\
92 2:\n\
93 	movzwl	$65535,r0\n\
94 	cmpl	(sp),r0\n\
95 	jgtr	1b\n\
96 	movl	(sp)+,r0\n\
97 	cmpc3	r0,(r1),(r3)\n\
98 3:\n" },
99 
100 	{ 3, "_bcmp\n",
101 "	movl	(sp)+,r1\n\
102 	movl	(sp)+,r3\n\
103 	movl	(sp)+,r5\n\
104 	cmpc3	r5,(r1),(r3)\n" },
105 
106 	{ 3, "_llocc\n",
107 "	movl	(sp)+,r4\n\
108 	movl	(sp)+,r5\n\
109 	movl	(sp)+,r1\n\
110 1:\n\
111 	movzwl	$65535,r0\n\
112 	cmpl	r5,r0\n\
113 	jleq	1f\n\
114 	subl2	r0,r5\n\
115 	locc	r4,r0,(r1)\n\
116 	jeql	1b\n\
117 	addl2	r5,r0\n\
118 	jbr	2f\n\
119 1:\n\
120 	locc	r4,r5,(r1)\n\
121 2:\n" },
122 
123 	{ 3, "_locc\n",
124 "	movl	(sp)+,r3\n\
125 	movl	(sp)+,r4\n\
126 	movl	(sp)+,r5\n\
127 	locc	r3,r4,(r5)\n" },
128 
129 	{ 4, "_scanc\n",
130 "	movl	(sp)+,r2\n\
131 	movl	(sp)+,r3\n\
132 	movl	(sp)+,r4\n\
133 	movl	(sp)+,r5\n\
134 	scanc	r2,(r3),(r4),r5\n" },
135 
136 	{ 3, "_skpc\n",
137 "	movl	(sp)+,r3\n\
138 	movl	(sp)+,r4\n\
139 	movl	(sp)+,r5\n\
140 	skpc	r3,r4,(r5)\n" },
141 
142 	{ 0, "", "" }
143 };
144 
145 struct pats vaxsubset_ptab[] = {
146 
147 	{ 3, "_blkcmp\n",
148 "	movl	(sp)+,r1\n\
149 	movl	(sp)+,r3\n\
150 	movl	(sp)+,r0\n\
151 2:\n\
152 	cmpb	(r1)+,(r3)+\n\
153 	jneq	3f\n\
154 	sobgtr	r0,2b\n\
155 3:\n" },
156 
157 	{ 3, "_bcmp\n",
158 "	movl	(sp)+,r1\n\
159 	movl	(sp)+,r3\n\
160 	movl	(sp)+,r5\n\
161 	movl	r5,r0\n\
162 2:\n\
163 	cmpb	(r1)+,(r3)+\n\
164 	jneq	1f\n\
165 	sobgtr	r0,2b\n\
166 1:\n" },
167 
168 	{ 3, "_llocc\n",
169 "	movl	(sp)+,r4\n\
170 	movl	(sp)+,r5\n\
171 	movl	(sp)+,r1\n\
172 	movl	r5,r0\n\
173 2:\n\
174 	cmpb	r4,(r1)+\n\
175 	jeql	1f\n\
176 	sobgtr	r0,2b\n\
177 1:\n" },
178 
179 	{ 3, "_locc\n",
180 "	movl	(sp)+,r3\n\
181 	movl	(sp)+,r4\n\
182 	movl	(sp)+,r5\n\
183 	movl	r4,r0\n\
184 2:\n\
185 	cmpb	r3,(r5)+\n\
186 	jeql	1f\n\
187 	sobgtr	r0,2b\n\
188 1:\n" },
189 
190 	{ 3, "_skpc\n",
191 "	movl	(sp)+,r3\n\
192 	movl	(sp)+,r4\n\
193 	movl	(sp)+,r5\n\
194 	movl	r4,r0\n\
195 2:\n\
196 	cmpb	r3,(r5)+\n\
197 	jneq	1f\n\
198 	sobgtr	r0,2b\n\
199 1:\n" },
200 
201 	{ 0, "", "" }
202 };
203 #endif
204