xref: /netbsd-src/external/gpl3/gcc/dist/libgcc/config/avr/libf7/f7wraps.sh (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1#!/usr/bin/env sh
2
3# The first command argument $1 tells us which flavour to generate for
4# the rest of the command line arguments.
5
6what=$1
7shift
8
9if [ "x$*" = "x" ]; then
10    none="(none)"
11fi
12
13case ${what} in
14    header)
15            cat << EOF
16;; Copyright (C) 2019-2022 Free Software Foundation, Inc.
17;;
18;; This file is part of LIBF7, which is part of GCC.
19;;
20;; GCC is free software; you can redistribute it and/or modify it under
21;; the terms of the GNU General Public License as published by the Free
22;; Software Foundation; either version 3, or (at your option) any later
23;; version.
24;;
25;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
26;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
27;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
28;; for more details.
29;;
30;; Under Section 7 of GPL version 3, you are granted additional
31;; permissions described in the GCC Runtime Library Exception, version
32;; 3.1, as published by the Free Software Foundation.
33;;
34;; You should have received a copy of the GNU General Public License and
35;; a copy of the GCC Runtime Library Exception along with this program;
36;; see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
37;; <http://www.gnu.org/licenses/>.  */
38
39;; Auto-generated file, do not change by hand.
40;;
41;; Wrappers for double and long double functions to use functions that
42;; operate on f7_t, and get f7_t* and const f7_t*.
43;;
44;; Generated by: `basename $0`
45;; Included by : libf7-asm.sx
46EOF
47        for n in $*; do
48            echo ";; $n"
49        done
50        ;;
51
52    xd_libgcc)
53        cat << EOF
54
55;; Functions that usually live in libgcc: __<name> for <name> in:
56;; $*${none}
57EOF
58        for n in $*; do
59            cat << EOF
60
61;; type_t __${n} (double)  ; $n
62#ifdef F7MOD_D_${n}_
63_DEFUN __${n}
64    .global F7_NAME($n)
65    ldi     ZH,     hi8(gs(F7_NAME($n)))
66    ldi     ZL,     lo8(gs(F7_NAME($n)))
67    F7jmp   call_xd
68_ENDF __${n}
69#endif /* F7MOD_D_${n}_ */
70EOF
71        done
72        ;;
73
74    dx_libgcc)
75        cat << EOF
76
77;; Functions that usually live in libgcc: __<name> for <name> in:
78;; $*${none}
79EOF
80        for n in $*; do
81            cat << EOF
82
83;; double __${n} (type_t)  ; $n
84#ifdef F7MOD_D_${n}_
85_DEFUN __${n}
86    .global F7_NAME($n)
87    ldi     ZH,     hi8(gs(F7_NAME($n)))
88    ldi     ZL,     lo8(gs(F7_NAME($n)))
89    F7jmp   call_dx
90_ENDF __${n}
91#endif /* F7MOD_D_${n}_ */
92EOF
93        done
94        ;;
95
96    ddd_libgcc)
97        cat << EOF
98
99;; Functions that usually live in libgcc: __<name>df3 for <name> in:
100;; $*${none}
101EOF
102        for n in $*; do
103            cat << EOF
104
105;; double __${n}df3 (double, double)  ; $n
106#ifdef F7MOD_D_${n}_
107_DEFUN __${n}df3
108    ALIAS __$n
109    .global F7_NAME($n)
110    ldi     ZH,     hi8(gs(F7_NAME($n)))
111    ldi     ZL,     lo8(gs(F7_NAME($n)))
112    F7jmp   call_ddd
113_ENDF __${n}df3
114#endif /* F7MOD_D_${n}_ */
115EOF
116        done
117        ;;
118
119    xdd_libgcc_cmp)
120        cat << EOF
121
122;; Functions that usually live in libgcc: __<name>df2 for <name> in:
123;; $*${none}
124EOF
125        for n in $*; do
126            cat << EOF
127
128;; bool __${n}df2 (double, double)  ; $n
129#ifdef F7MOD_D_${n}_
130_DEFUN __${n}df2
131    .global F7_NAME(${n}_impl)
132    ldi     ZH,     hi8(gs(F7_NAME(${n}_impl)))
133    ldi     ZL,     lo8(gs(F7_NAME(${n}_impl)))
134    F7jmp   call_xdd
135_ENDF __${n}df2
136#endif /* F7MOD_D_${n}_ */
137EOF
138        done
139        ;;
140
141    dd_math)
142        cat << EOF
143
144;; Functions that usually live in libm:  Depending on [long] double layout,
145;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
146;; $*${none}
147EOF
148        for n in $*; do
149            cat << EOF
150
151;; double __${n} (double)
152#ifdef F7MOD_D_${n}_
153_DEFUN __${n}
154    DALIAS $n
155    LALIAS ${n}l
156    .global F7_NAME($n)
157    ldi     ZH,     hi8(gs(F7_NAME($n)))
158    ldi     ZL,     lo8(gs(F7_NAME($n)))
159    F7jmp   call_dd
160_ENDF __${n}
161#endif /* F7MOD_D_${n}_ */
162EOF
163        done
164        ;;
165
166    xd_math)
167        cat << EOF
168
169;; Functions that usually live in libm:  Depending on [long] double layout,
170;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
171;; $*${none}
172EOF
173        for n in $*; do
174            cat << EOF
175
176;; type_t __${n} (double)
177#ifdef F7MOD_D_${n}_
178_DEFUN __${n}
179    DALIAS $n
180    LALIAS ${n}l
181    .global F7_NAME($n)
182    ldi     ZH,     hi8(gs(F7_NAME($n)))
183    ldi     ZL,     lo8(gs(F7_NAME($n)))
184    F7jmp   call_xd
185_ENDF __${n}
186#endif /* F7MOD_D_${n}_ */
187EOF
188        done
189        ;;
190
191    ddd_math)
192        cat << EOF
193
194;; Functions that usually live in libm:  Depending on [long] double layout,
195;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
196;; $*${none}
197EOF
198        for n in $*; do
199            cat << EOF
200
201;; double __${n} (double, double)
202#ifdef F7MOD_D_${n}_
203_DEFUN __${n}
204    DALIAS $n
205    LALIAS ${n}l
206    .global F7_NAME($n)
207    ldi     ZH,     hi8(gs(F7_NAME($n)))
208    ldi     ZL,     lo8(gs(F7_NAME($n)))
209    F7jmp   call_ddd
210_ENDF __${n}
211#endif /* F7MOD_D_${n}_ */
212EOF
213        done
214        ;;
215
216    ddx_math)
217        cat << EOF
218
219;; Functions that usually live in libm:  Depending on [long] double layout,
220;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
221;; $*${none}
222EOF
223        for n in $*; do
224            cat << EOF
225
226;; double __${n} (double, word_t)
227#ifdef F7MOD_D_${n}_
228_DEFUN __${n}
229    DALIAS $n
230    LALIAS ${n}l
231    .global F7_NAME($n)
232    ldi     ZH,     hi8(gs(F7_NAME($n)))
233    ldi     ZL,     lo8(gs(F7_NAME($n)))
234    F7jmp   call_ddx
235_ENDF __${n}
236#endif /* F7MOD_D_${n}_ */
237EOF
238        done
239        ;;
240
241    *)
242        exit 1
243        ;;
244esac
245