summaryrefslogtreecommitdiff
path: root/gcc/config/mep/mep-lib1.asm
blob: 0a18913f927640cae1ce4aa4293b19b3dbd98300 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* libgcc routines for Toshiba Media Processor.
   Copyright (C) 2001, 2002, 2005, 2009 Free Software Foundation, Inc.

This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
  
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.
  
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.

You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
<http://www.gnu.org/licenses/>.  */

#define SAVEALL \
	add3	$sp, $sp, -16*4 ; \
	sw	$0, ($sp) ; \
	sw	$1, 4($sp) ; \
	sw	$2, 8($sp) ; \
	sw	$3, 12($sp) ; \
	sw	$4, 16($sp) ; \
	sw	$5, 20($sp) ; \
	sw	$6, 24($sp) ; \
	sw	$7, 28($sp) ; \
	sw	$8, 32($sp) ; \
	sw	$9, 36($sp) ; \
	sw	$10, 40($sp) ; \
	sw	$11, 44($sp) ; \
	sw	$12, 48($sp) ; \
	sw	$13, 52($sp) ; \
	sw	$14, 56($sp) ; \
	ldc	$5, $lp	; \
	add	$5, 3 ; \
	mov	$6, -4 ; \
	and	$5, $6

#define RESTOREALL \
	stc	$5, $lp ; \
	lw	$14, 56($sp) ; \
	lw	$13, 52($sp) ; \
	lw	$12, 48($sp) ; \
	lw	$11, 44($sp) ; \
	lw	$10, 40($sp) ; \
	lw	$9, 36($sp) ; \
	lw	$8, 32($sp) ; \
	lw	$7, 28($sp) ; \
	lw	$6, 24($sp) ; \
	lw	$5, 20($sp) ; \
	lw	$4, 16($sp) ; \
	lw	$3, 12($sp) ; \
	lw	$2, 8($sp) ; \
	lw	$1, 4($sp) ; \
	lw	$0, ($sp) ; \
	add3	$sp, $sp, 16*4 ; \
	ret

#ifdef L_mep_profile
	.text
	.global __mep_mcount
__mep_mcount:
	SAVEALL
	ldc	$1, $lp
	mov	$2, $0
	bsr	__mep_mcount_2
	RESTOREALL
#endif

#ifdef L_mep_bb_init_trace
	.text
	.global __mep_bb_init_trace_func
__mep_bb_init_trace_func:
	SAVEALL
	lw	$1, ($5)
	lw	$2, 4($5)
	add	$5, 8
	bsr	__bb_init_trace_func
	RESTOREALL
#endif

#ifdef L_mep_bb_init
	.text
	.global __mep_bb_init_func
__mep_bb_init_func:
	SAVEALL
	lw	$1, ($5)
	add	$5, 4
	bsr	__bb_init_func
	RESTOREALL
#endif

#ifdef L_mep_bb_trace
	.text
	.global __mep_bb_trace_func
__mep_bb_trace_func:
	SAVEALL
	movu	$3, __bb
	lw	$1, ($5)
	sw	$1, ($3)
	lw	$2, 4($5)
	sw	$2, 4($3)
	add	$5, 8
	bsr	__bb_trace_func
	RESTOREALL
#endif

#ifdef L_mep_bb_increment
	.text
	.global __mep_bb_increment_func
__mep_bb_increment_func:
	SAVEALL
	lw	$1, ($5)
	lw	$0, ($1)
	add	$0, 1
	sw	$0, ($1)
	add	$5, 4
	RESTOREALL
#endif