Welcome to mirror list, hosted at ThFree Co, Russian Federation.

psi.S « h8500 « machine « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 47c8183291ed14d2a49a8a3465d88574157ac00b (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
126
127
128
129
130
131
132
133
134
135
136
/* convert psi to si inplace

Note that `fp' below isn't a segment register.
It's r6, the frame pointer.  */

#if __CODE__==32
#define RET prts
#else
#define RET rts
#endif

#define EXTPSISI_SN(r_msw,r_lsw,sp)		; \
	.global	__extpsisi##r_msw		; \
__extpsisi##r_msw:				; \
	mov	r_msw,r_lsw			; \
	stc	sp,r_msw			; \
	RET

	EXTPSISI_SN(r2,r3,dp)
	EXTPSISI_SN(r4,r5,ep)


#define ADDPSI_AR_RN(sr,an,r_msw,r_lsw)	\
	.global	__addpsi##an##r_msw ;	\
__addpsi##an##r_msw:		 ;	\
	stc	sr,@-sp		 ;	\
	add	an,r_lsw		 ;	\
	addx	@sp+,r_msw		 ;	\
	RET

	ADDPSI_AR_RN(dp,r2,r0,r1)
	ADDPSI_AR_RN(dp,r2,r3,r4)
	ADDPSI_AR_RN(ep,r4,r0,r1)
	ADDPSI_AR_RN(ep,r4,r1,r2)
	ADDPSI_AR_RN(ep,r4,r3,r4)
	ADDPSI_AR_RN(ep,r4,r5,fp)

	ADDPSI_AR_RN(tp,fp,r0,r1)

	
#define ADDPSI_RN_AR(r_msw,r_lsw,sr,an,t_msw,t_lsw)	\
	.global	__addpsi##r_msw##an		; \
__addpsi##r_msw##an:				; \
	mov.w	t_msw,@-sp			; \
	mov.w	t_lsw,@-sp			; \
	stc	sr,t_msw			; \
	mov	an,t_lsw			; \
	add	r_lsw,t_lsw			; \
	addx	r_msw,t_msw			; \
	ldc	t_msw,sr			; \
	mov.w	t_lsw,an			; \
	mov.w	@sp+,t_lsw			; \
	mov.w	@sp+,t_msw			; \
	RET	

	ADDPSI_RN_AR(r0,r1,dp,r2,r4,r5)
	ADDPSI_RN_AR(r0,r1,ep,r4,r2,r3)



#define EXTPSIHI_RN_RN(rm,r_msw,r_lsw)	; \
	.global	__extpsihi##rm##r_msw 	; \
__extpsihi##rm##r_msw:		   	; \
	mov	rm,r_lsw	   	; \
	clr.w	r_msw		   	; \
	RET

	EXTPSIHI_RN_RN(r3,r0,r1)
	EXTPSIHI_RN_RN(r4,r0,r1)
	EXTPSIHI_RN_RN(r5,r0,r1)
	EXTPSIHI_RN_RN(r2,r0,r1)



/* ifdefed out, because gcc doesn't like the # character in the above
   macro.  The macro expands into an assembly languange comment anyways,
   so it serves no useful purpose.  */
#if 0
#define EXTPSIHI_RN_SN(rm,r_msw,r_lsw)	; \
	.global	__extpsihi##rm##r_lsw 	; \
__extpsihi##rm##r_lsw:		   	; \
	mov	rm,r_lsw	   	; \
	ldc	\#0,r_msw	   	; \
	RET

	EXTPSIHI_RN_SN(r0,dp,r2)
	EXTPSIHI_RN_SN(r0,ep,r4)
	EXTPSIHI_RN_SN(r1,dp,r2)
	EXTPSIHI_RN_SN(r1,ep,r4)
	EXTPSIHI_RN_SN(r3,dp,r2)
	EXTPSIHI_RN_SN(r3,ep,r4)
	EXTPSIHI_RN_SN(r5,dp,r2)
	EXTPSIHI_RN_SN(r5,ep,r4)
	EXTPSIHI_RN_SN(r2,ep,r4)
#endif


#define EXTPSISI_RN(r_msw,r_lsw)		; \
	.global	__extpsisi##r_msw	 	; \
__extpsisi##r_msw:		   		; \
	RET

	EXTPSISI_RN(r0,r1)



#define ADDPSI_SA_SB(sa,ra,sb,rb)	; \
	.global	__addpsi##ra##rb	; \
__addpsi##ra##rb:			; \
	mov.w	r0,@-sp			; \
	mov.w	r1,@-sp			; \
	stc	sa,r0			; \
	stc	sb,r1			; \
	add.w	ra,rb			; \
	addx	r0,r1			; \
	ldc	r1,sb			; \
	mov.w	@sp+,r1			; \
	mov.w	@sp+,r0			; \
	RET		


	ADDPSI_SA_SB(dp,r2,ep,r4)
	ADDPSI_SA_SB(ep,r4,dp,r2)
	ADDPSI_SA_SB(tp,fp,dp,r2)
	ADDPSI_SA_SB(tp,fp,ep,r4)

	ADDPSI_SA_SB(dp,r2,dp,r2)



	.global	__addpsir0r0
__addpsir0r0:
	add.w	r1,r1
	addx	r0,r0
	RET