[PATCH v1 01/27] x86/fpu: Create helper file for common data macros

Noah Goldstein goldstein.w.n@gmail.com
Wed Dec 7 08:52:10 GMT 2022


The macros are useful for creating .rodata definitions and checking
that the offset is correct.
---
 .../x86_64/fpu/svml_common_data_macros.h.S    | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 sysdeps/x86_64/fpu/svml_common_data_macros.h.S

diff --git a/sysdeps/x86_64/fpu/svml_common_data_macros.h.S b/sysdeps/x86_64/fpu/svml_common_data_macros.h.S
new file mode 100644
index 0000000000..31bd66835d
--- /dev/null
+++ b/sysdeps/x86_64/fpu/svml_common_data_macros.h.S
@@ -0,0 +1,50 @@
+/* Helper macros for creating rodata
+   Copyright (C) 2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   https://www.gnu.org/licenses/.  */
+
+#ifndef _SVML_COMMON_DATA_MACROS_H_S
+#define _SVML_COMMON_DATA_MACROS_H_S	1
+
+
+.macro check_offset data_section offset
+	.if	.-\data_section != \offset
+	.err
+	.endif
+.endm
+
+
+/* Only used in floating point functions at the moment.  */
+.macro float_vectorN data_section N offset value
+	check_offset \data_section \offset
+	.rept	\N
+	.long	\value
+	.endr
+.endm
+
+#define float_block(data_section, offset, ...)	\
+	check_offset data_section offset;	\
+	.long	__VA_ARGS__
+
+
+#define float_vector16(data_section, offset, value)	\
+	float_vectorN data_section 4 offset value
+#define float_vector32(data_section, offset, value)	\
+	float_vectorN data_section 8 offset value
+#define float_vector64(data_section, offset, value)	\
+	float_vectorN data_section 16 offset value
+
+#endif
-- 
2.34.1



More information about the Libc-alpha mailing list