diff mbox series

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

Message ID 20221207085236.1424424-1-goldstein.w.n@gmail.com
State New
Headers show
Series [v1,01/27] x86/fpu: Create helper file for common data macros | expand

Commit Message

Noah Goldstein Dec. 7, 2022, 8:52 a.m. UTC
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

Comments

H.J. Lu Dec. 7, 2022, 11:53 p.m. UTC | #1
On Wed, Dec 7, 2022 at 12:52 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> 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
>

Please use .h files in fpu directory.
Noah Goldstein Dec. 8, 2022, 12:13 a.m. UTC | #2
On Wed, Dec 7, 2022 at 3:53 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Dec 7, 2022 at 12:52 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
> > 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
> >
>
> Please use .h files in fpu directory.

Are .S files globbed somewhere or something?

It uses assembler macros so its convenient for the
extension to match.
>
> --
> H.J.
H.J. Lu Dec. 8, 2022, 12:22 a.m. UTC | #3
On Wed, Dec 7, 2022 at 4:13 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Wed, Dec 7, 2022 at 3:53 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Wed, Dec 7, 2022 at 12:52 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> > >
> > > 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
> > >
> >
> > Please use .h files in fpu directory.
>
> Are .S files globbed somewhere or something?
>
> It uses assembler macros so its convenient for the
> extension to match.

Use new macros or rename files before commit.
Noah Goldstein Dec. 8, 2022, 12:46 a.m. UTC | #4
On Wed, Dec 7, 2022 at 4:22 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Wed, Dec 7, 2022 at 4:13 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
> > On Wed, Dec 7, 2022 at 3:53 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Wed, Dec 7, 2022 at 12:52 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> > > >
> > > > 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
> > > >
> > >
> > > Please use .h files in fpu directory.
> >
> > Are .S files globbed somewhere or something?
> >
> > It uses assembler macros so its convenient for the
> > extension to match.
>
> Use new macros or rename files before commit.

Okay.
>
> --
> H.J.
diff mbox series

Patch

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