summaryrefslogtreecommitdiff
path: root/sysdeps/ia64/fpu/import_file.awk
blob: c6335dc1dff12bcb2aa3771cbfb0567a27be6628 (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
137
138
139
140
141
142
143
144
145
146
147
148
BEGIN {
	getline;
	while (!match($0, "^/[/*] static char cvs_id")) {
		print;
		getline;
	}
	getline;
	while (!match($0, "^// WARRANTY DISCLAIMER")) {
		print;
		getline;
	}
	getline;
	printf								      \
"// Redistribution and use in source and binary forms, with or without\n"     \
"// modification, are permitted provided that the following conditions are\n" \
"// met:\n"								      \
"//\n"									      \
"// * Redistributions of source code must retain the above copyright\n"	      \
"// notice, this list of conditions and the following disclaimer.\n"	      \
"//\n"									      \
"// * Redistributions in binary form must reproduce the above copyright\n"    \
"// notice, this list of conditions and the following disclaimer in the\n"    \
"// documentation and/or other materials provided with the distribution.\n"   \
"//\n"									      \
"// * The name of Intel Corporation may not be used to endorse or promote\n"  \
"// products derived from this software without specific prior written\n"     \
"// permission.\n\n";
	if (LICENSE_ONLY == "y") {
		do {
			print;
		} while (getline);
	}
}

/^[.]data/ {
	print "RODATA";
	next;
}
/^([a-zA-Z_0-9]*_(tb[l0-9]|Tt|[tT]able|data|low|coeffs|constants|CONSTANTS|reduction|Stirling)(_?([1-9cdimpqstPQT]+|tail))?|(Constants|Poly|coeff)_.+|(double_sin_?cos|double_cis)[fl]?_.+):/ {
	table_name=substr($1,1,length($1)-1);
	printf "LOCAL_OBJECT_START(%s)\n", table_name;
	getline;
	while (!match($0, "^[ \t]*data")) {
		print;
		getline;
	}
	while (match($0, "(//|^[ \t]*data)")) {
		print;
		getline;
	}
	printf "LOCAL_OBJECT_END(%s)\n\n", table_name;
	next;
}
/^[.]proc[ \t]+__libm_(error_region|callout)/ {
	printf "LOCAL_LIBM_ENTRY(%s)\n", $2;
	getline;
	next;
}
/^[.]endp[ \t]+__libm_(error_region|callout)/ {
	printf "LOCAL_LIBM_END(%s)\n", $2;
	next;
}
/^[.]global/ {
	split($2, part, "#");
	name=part[1];
	if (match(name, "^"FUNC"$")) {
		next;
	}
}
/^[.]proc/ {
	split($2, part, "#");
	name=part[1];
	if (match(name, "^"FUNC"$")) {
		local_funcs=("^("			\
			     "cis|cisf|cisl"		\
			     "|cabs|cabsf|cabsl"	\
			     "|cot|cotf|cotl"		\
			     ")$");
		ieee754_funcs=("^("					  \
			       "atan2|atan2f|atan2l|atanl"		  \
			       "|cos|cosf|cosl"				  \
			       "|cosh|coshf|coshl"			  \
			       "|exp|expf|expl"				  \
			       "|exp10|exp10f|exp10l"			  \
			       "|expm1|expm1f|expm1l"			  \
			       "|fmod|fmodf|fmodl"			  \
			       "|hypot|hypotf|hypotl"			  \
			       "|fabs|fabsf|fabsl"			  \
			       "|floor|floorf|floorl"			  \
			       "|log1p|log1pf|log1pl"			  \
			       "|log|log10|log10f|log10l|log2l|logf|logl" \
			       "|remainder|remainderf|remainderl|"	  \
			       "|rint|rintf|rintl|"			  \
			       "|scalb|scalbf|scalbl"			  \
			       "|sin|sinf|sinl"				  \
			       "|sincos|sincosf|sincosl"		  \
			       "|sinh|sinhf|sinhl"			  \
			       "|sqrt|sqrtf|sqrtl"			  \
			       "|tan|tanf|tanl"				  \
			       ")$");
		if (match(name, ieee754_funcs)) {
			type="GLOBAL_IEEE754";
		} else if (match (name, local_funcs)) {
			type="LOCAL_LIBM";
		} else {
			type="GLOBAL_LIBM";
		}
		printf "%s_ENTRY(%s)\n", type, name;
		getline;
		while (!match($0, "^"name"#?:")) {
			getline;
		}
		getline;
		while (!match($0, "^.endp")) {
			print
			getline;
		}
		getline;
		printf "%s_END(%s)\n", type, name;
		if (match(name, "^exp10[fl]?$")) {
			t=substr(name,6)
			printf "weak_alias (exp10%s, pow10%s)\n", t, t
		}
		next;
	}
}
/^[a-zA-Z_]+:/ {
	split($1, part, ":");
	name=part[1];
	if (match(name, "^"FUNC"$")) {
		printf "GLOBAL_LIBM_ENTRY(%s)\n", name;
		getline;
		while (!match($0, "^"name"#?:")) {
			getline;
		}
		getline;
		while (!match($0, "^.endp")) {
			print
			getline;
		}
		getline;
		printf "GLOBAL_LIBM_END(%s)\n", name;
		next;
	}
}

{ print }