1/*
2 * QuickThreads -- Threads-building toolkit.
3 * Copyright (c) 1993 by David Keppel
4 *
5 * Permission to use, copy, modify and distribute this software and
6 * its documentation for any purpose and without fee is hereby
7 * granted, provided that the above copyright notice and this notice
8 * appear in all copies.  This software is provided as a
9 * proof-of-concept and for demonstration purposes; there is no
10 * representation about the suitability of this software for any
11 * purpose.
12 */
13
14	.text
15	.globl _b_call_reg
16	.globl _b_call_imm
17	.globl _b_add
18	.globl _b_load
19
20_b_null:
21	jmp   r1
22
23_b_call_reg:
24	subu r31, r31,8			/* Alloc ret pc save space. */
25	st r1, r31,32			/* Save ret pc. */
26	or.u r3, r0,hi16(_b_null)	/* Put call addr in a reg. */
27	or r3, r3,lo16(_b_null)
28	jsr r3
29L0:
30	jsr r3
31	jsr r3
32	jsr r3
33	jsr.n r3
34	subu r2, r2,5			/* Decrement #of iter to go. */
35	bcnd.n gt0,r2,L0
36	jsr r3
37
38	ld r1, r31,32
39	jmp r1
40
41
42_b_call_imm:
43	subu r31, r31,8			/* Alloc ret pc save space. */
44	st r1, r31,32			/* Save ret pc. */
45	bsr _b_null
46L1:
47	bsr _b_null
48	bsr _b_null
49	bsr _b_null
50	bsr.n _b_null
51	subu r2, r2,5			/* Decrement #of iter to go. */
52	bcnd.n gt0,r2,L1
53	bsr _b_null
54
55	ld r1, r31,32
56	jmp r1
57
58_b_add:
59	add r0, r3,r4
60L2:
61	add r3, r4,r5
62	add r4, r5,r6
63	add r5, r6,r7
64	add r8, r9,r0
65	add r0, r3,r4
66	add r3, r4,r5
67	add r4, r5,r6
68	add r5, r6,r7
69	add r8, r9,r0
70
71	add r0, r3,r4
72	add r3, r4,r5
73	add r4, r5,r6
74	add r5, r6,r7
75	add r8, r9,r0
76	add r0, r3,r4
77	add r3, r4,r5
78	add r4, r5,r6
79	add r5, r6,r7
80	add r8, r9,r0
81
82	subu r2, r2,20			/* Decrement #of iter to go. */
83	bcnd.n gt0,r2,L2
84	add r0, r3,r4
85
86	jmp r1
87
88
89_b_load:
90	ld r0, r31,0
91L3:
92	ld r3, r31,4
93	ld r4, r31,8
94	ld r5, r31,12
95	ld r6, r31,16
96	ld r0, r31,0
97	ld r3, r31,4
98	ld r4, r31,8
99	ld r5, r31,12
100	ld r6, r31,16
101
102	ld r0, r31,0
103	ld r3, r31,4
104	ld r4, r31,8
105	ld r5, r31,12
106	ld r6, r31,16
107	ld r0, r31,0
108	ld r3, r31,4
109	ld r4, r31,8
110	ld r5, r31,12
111	ld r6, r31,16
112
113	subu r2, r2,20			/* Decrement #of iter to go. */
114	bcnd.n gt0,r2,L3
115	ld r0, r31,0
116
117	jmp   r1
118