xref: /netbsd-src/lib/libarch/sparc/v8/sparc_v8.S (revision 01a19e2f711592de10539b1cfb15538f97526798)
1/*
2 * GCC generated output for sparc v8 mul/div/rem operations.
3 * Included in the sparc_v8.so shared library for use on sparc v8
4 * machines instead of the libc.so versions.
5 */
6	.file	"sparc_v8.S"
7.section	".text"
8
9
10/*
11 * unsigned .umul(unsigned a, unsigned b)
12 *
13 *     This function computes a * b with unsigned integer
14 *     multiplication.  When .umul returns, the caller's register %o0
15 *     contains the least significant 32 bits of the 64-bit result;
16 *     register %o1 holds the most significant 32 bits of the result.
17 *     Upon return, the integer condition codes and registers %o2
18 *     through %o5 have unspecified values.
19 */
20	.align 4
21	.global .umul
22	.type	 .umul,@function
23.umul:
24	umul	%o0, %o1, %o0
25	retl
26	 rd	%y, %o1
27.LLfe1:
28	.size	 .umul,.LLfe1-.umul
29
30
31/*
32 * int .mul(int a, int b)
33 *
34 *     This function computes a * b with signed integer
35 *     multiplication.  When .mul returns, the caller's register %o0
36 *     contains the least significant 32 bits of the 64-bit result;
37 *     register %o1 holds the most significant 32 bits of the result.
38 *     Upon return, the integer condition codes and registers %o2
39 *     through %o5 have unspecified values.
40 */
41	.align 4
42	.global .mul
43	.type	 .mul,@function
44.mul:
45	smul	%o0, %o1, %o0
46	retl
47	 rd	%y, %o1
48.LLfe2:
49	.size	 .mul,.LLfe2-.mul
50
51/*--- .udiv ---*/
52	.align 4
53	.global .udiv
54	.type	 .udiv,@function
55.udiv:
56	wr	%g0, 0, %y
57	nop; nop; nop
58	retl
59	 udiv	%o0, %o1, %o0
60.LLfe3:
61	.size	 .udiv,.LLfe3-.udiv
62
63/*--- .div ---*/
64	.align 4
65	.global .div
66	.type	 .div,@function
67.div:
68	sra	%o0, 31, %g2
69	wr	%g2, 0, %y
70	nop; nop; nop
71	retl
72	 sdiv	%o0, %o1, %o0
73.LLfe4:
74	.size	 .div,.LLfe4-.div
75
76/*--- .urem ---*/
77	.align 4
78	.global .urem
79	.type	 .urem,@function
80.urem:
81	wr	%g0, %g0, %y
82	nop; nop; nop
83	udiv	%o0, %o1, %g2
84	smul	%g2, %o1, %g2
85	retl
86	 sub	%o0, %g2, %o0
87.LLfe5:
88	.size	 .urem,.LLfe5-.urem
89
90/*--- .rem ---*/
91	.align 4
92	.global .rem
93	.type	 .rem,@function
94.rem:
95	sra	%o0, 31, %g3
96	wr	%g3, 0, %y
97	nop; nop; nop
98	sdiv	%o0, %o1, %g2
99	smul	%g2, %o1, %g2
100	retl
101	 sub	%o0, %g2, %o0
102.LLfe6:
103	.size	 .rem,.LLfe6-.rem
104	!.ident	"GCC: (GNU) 2.95.3 20010315 (release) (NetBSD nb3)"
105