public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it
@ 2022-10-28 17:43 Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2022-10-28 17:43 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=43151401e5181c4fcda4c4d9db8086453061635e

commit 43151401e5181c4fcda4c4d9db8086453061635e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 14:24:08 2022 -0300

    math: Only build tests for _Complex __int128 iff compiler supports it

Diff:
---
 configure                | 28 ++++++++++++++++++++++++++++
 configure.ac             | 17 +++++++++++++++++
 math/Makefile            |  2 +-
 math/gen-tgmath-tests.py | 38 +++++++++++++++++++++++++++++---------
 4 files changed, 75 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 4a02e5de12..8a71df6568 100755
--- a/configure
+++ b/configure
@@ -6489,6 +6489,34 @@ $as_echo "$libc_cv_cc_float_store" >&6; }
 config_vars="$config_vars
 config-cflags-float-store = $libc_cv_cc_float_store"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports _Complex with __int128" >&5
+$as_echo_n "checking whether compiler supports _Complex with __int128... " >&6; }
+if ${libc_cv_complex_int128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_complex_int128" >&5
+$as_echo "$libc_cv_complex_int128" >&6; }
+config_vars="$config_vars
+config-complex-int128 = $libc_cv_complex_int128"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 $as_echo_n "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index a078b28914..d28ac6ed1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1571,6 +1571,23 @@ LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
 LIBC_CONFIG_VAR([config-cflags-float-store],
 		[$libc_cv_cc_float_store])
 
+AC_CACHE_CHECK([whether compiler supports _Complex with __int128],
+	       [libc_cv_complex_int128], [dnl
+cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-complex-int128],
+                [$libc_cv_complex_int128])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 0cf60e4df6..aaeb9fc330 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -396,7 +396,7 @@ $(tgmath3-macro-tests:%=$(objpfx)%.o): CFLAGS += -fno-builtin
 $(foreach m,$(tgmath3-macros),\
 	    $(objpfx)test-tgmath3-$(m).c): $(objpfx)test-tgmath3-%.c: \
 					   gen-tgmath-tests.py
-	$(PYTHON) gen-tgmath-tests.py $* > $@
+	$(PYTHON) gen-tgmath-tests.py --complex-int128 $(config-complex-int128) $* > $@
 
 # Verify that the list of supported macros is in sync between the
 # Makefile and gen-tgmath-tests.py.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index c841db6000..703491e1e9 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -54,6 +54,7 @@
 # supported on any given configuration of glibc, the MANT_DIG value
 # uniquely determines the format.
 
+import argparse
 import string
 import sys
 
@@ -183,7 +184,7 @@ class Type(object):
         return self.name
 
     @staticmethod
-    def init_types():
+    def init_types(complex_int128):
         """Initialize all the known types."""
         Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG',
                          complex_name='__CFLOAT16',
@@ -218,9 +219,11 @@ class Type(object):
         Type.create_type('long long int', integer=True)
         Type.create_type('unsigned long long int', integer=True)
         Type.create_type('__int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('unsigned __int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('enum e', integer=True, complex_ok=False)
         Type.create_type('_Bool', integer=True, complex_ok=False)
         Type.create_type('bit_field', integer=True, complex_ok=False)
@@ -785,15 +788,32 @@ class Tests(object):
             print('error: macro list mismatch')
             sys.exit(1)
 
-def main():
+def get_parser():
+    def strbool(string):
+        return True if string.lower() == 'yes' else False
+
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--complex-int128', dest='complex_int128',
+                        help='Generate tests for _Complex __int128',
+                        type=strbool)
+    parser.add_argument('--check-list', action='store_true',
+                        help='Verify that the list of supported macros')
+    parser.add_argument('macro',
+                        help='macro to test',
+                        nargs='*')
+    return parser
+
+def main(argv):
     """The main entry point."""
-    Type.init_types()
+    parser = get_parser()
+    opts = parser.parse_args(argv)
+    Type.init_types(True if opts.complex_int128 == 'yes' else False)
     t = Tests()
-    if sys.argv[1] == 'check-list':
+    if opts.check_list:
         macro = None
-        macro_list = sys.argv[2:]
+        macro_list = opts.macro
     else:
-        macro = sys.argv[1]
+        macro = opts.macro
         macro_list = []
     t.add_all_tests(macro)
     if macro:
@@ -802,4 +822,4 @@ def main():
         t.check_macro_list(macro_list)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it
@ 2024-02-09 17:33 Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2024-02-09 17:33 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fca608ad1b77dea29f5b34cee34b8e99fe21d930

commit fca608ad1b77dea29f5b34cee34b8e99fe21d930
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 14:24:08 2022 -0300

    math: Only build tests for _Complex __int128 iff compiler supports it
    
    clang fails building test-tgmath3-atan2.c:
    
      error: '_Complex __int128' is invalid
      _Complex __int128 var__Complex___int128 __attribute__ ((unused));
    
    since it does not support _Complex with __int128.  So disable
    the test in such case.

Diff:
---
 configure                | 29 +++++++++++++++++++++++++++++
 configure.ac             | 17 +++++++++++++++++
 math/Makefile            |  2 +-
 math/gen-tgmath-tests.py | 38 +++++++++++++++++++++++++++++---------
 4 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 649270d302..5cf3e1d8fa 100755
--- a/configure
+++ b/configure
@@ -7389,6 +7389,35 @@ printf "%s\n" "$libc_cv_cc_float_store" >&6; }
 config_vars="$config_vars
 config-cflags-float-store = $libc_cv_cc_float_store"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compiler supports _Complex with __int128" >&5
+printf %s "checking whether compiler supports _Complex with __int128... " >&6; }
+if test ${libc_cv_complex_int128+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_complex_int128" >&5
+printf "%s\n" "$libc_cv_complex_int128" >&6; }
+config_vars="$config_vars
+config-complex-int128 = $libc_cv_complex_int128"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 printf %s "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index 1f9d8b6e5e..a6e05cf585 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1488,6 +1488,23 @@ LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
 LIBC_CONFIG_VAR([config-cflags-float-store],
 		[$libc_cv_cc_float_store])
 
+AC_CACHE_CHECK([whether compiler supports _Complex with __int128],
+	       [libc_cv_complex_int128], [dnl
+cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-complex-int128],
+                [$libc_cv_complex_int128])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 7ce4f877bc..33b99ad1e1 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -396,7 +396,7 @@ $(tgmath3-macro-tests:%=$(objpfx)%.o): CFLAGS += -fno-builtin
 $(foreach m,$(tgmath3-macros),\
 	    $(objpfx)test-tgmath3-$(m).c): $(objpfx)test-tgmath3-%.c: \
 					   gen-tgmath-tests.py
-	$(PYTHON) gen-tgmath-tests.py $* > $@
+	$(PYTHON) gen-tgmath-tests.py --complex-int128 $(config-complex-int128) $* > $@
 
 # Verify that the list of supported macros is in sync between the
 # Makefile and gen-tgmath-tests.py.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index 216e4640ef..85029aa7f8 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -53,6 +53,7 @@
 # supported on any given configuration of glibc, the MANT_DIG value
 # uniquely determines the format.
 
+import argparse
 import string
 import sys
 
@@ -182,7 +183,7 @@ class Type(object):
         return self.name
 
     @staticmethod
-    def init_types():
+    def init_types(complex_int128):
         """Initialize all the known types."""
         Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG',
                          complex_name='__CFLOAT16',
@@ -219,9 +220,11 @@ class Type(object):
         Type.create_type('long long int', integer=True)
         Type.create_type('unsigned long long int', integer=True)
         Type.create_type('__int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('unsigned __int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('enum e', integer=True, complex_ok=False)
         Type.create_type('_Bool', integer=True, complex_ok=False)
         Type.create_type('bit_field', integer=True, complex_ok=False)
@@ -834,15 +837,32 @@ class Tests(object):
             print('error: macro list mismatch')
             sys.exit(1)
 
-def main():
+def get_parser():
+    def strbool(string):
+        return True if string.lower() == 'yes' else False
+
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--complex-int128', dest='complex_int128',
+                        help='Generate tests for _Complex __int128',
+                        type=strbool)
+    parser.add_argument('--check-list', action='store_true',
+                        help='Verify that the list of supported macros')
+    parser.add_argument('macro',
+                        help='macro to test',
+                        nargs='*')
+    return parser
+
+def main(argv):
     """The main entry point."""
-    Type.init_types()
+    parser = get_parser()
+    opts = parser.parse_args(argv)
+    Type.init_types(True if opts.complex_int128 == 'yes' else False)
     t = Tests()
-    if sys.argv[1] == 'check-list':
+    if opts.check_list:
         macro = None
-        macro_list = sys.argv[2:]
+        macro_list = opts.macro
     else:
-        macro = sys.argv[1]
+        macro = opts.macro
         macro_list = []
     t.add_all_tests(macro)
     if macro:
@@ -851,4 +871,4 @@ def main():
         t.check_macro_list(macro_list)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it
@ 2024-02-07 14:08 Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2024-02-07 14:08 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c72979df0515d01a5931aa0a862667789c43fbbc

commit c72979df0515d01a5931aa0a862667789c43fbbc
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 14:24:08 2022 -0300

    math: Only build tests for _Complex __int128 iff compiler supports it
    
    clang fails building test-tgmath3-atan2.c:
    
      error: '_Complex __int128' is invalid
      _Complex __int128 var__Complex___int128 __attribute__ ((unused));
    
    since it does not support _Complex with __int128.  So disable
    the test in such case.

Diff:
---
 configure                | 29 +++++++++++++++++++++++++++++
 configure.ac             | 17 +++++++++++++++++
 math/Makefile            |  2 +-
 math/gen-tgmath-tests.py | 38 +++++++++++++++++++++++++++++---------
 4 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 649270d302..5cf3e1d8fa 100755
--- a/configure
+++ b/configure
@@ -7389,6 +7389,35 @@ printf "%s\n" "$libc_cv_cc_float_store" >&6; }
 config_vars="$config_vars
 config-cflags-float-store = $libc_cv_cc_float_store"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compiler supports _Complex with __int128" >&5
+printf %s "checking whether compiler supports _Complex with __int128... " >&6; }
+if test ${libc_cv_complex_int128+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_complex_int128" >&5
+printf "%s\n" "$libc_cv_complex_int128" >&6; }
+config_vars="$config_vars
+config-complex-int128 = $libc_cv_complex_int128"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 printf %s "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index 1f9d8b6e5e..a6e05cf585 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1488,6 +1488,23 @@ LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
 LIBC_CONFIG_VAR([config-cflags-float-store],
 		[$libc_cv_cc_float_store])
 
+AC_CACHE_CHECK([whether compiler supports _Complex with __int128],
+	       [libc_cv_complex_int128], [dnl
+cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-complex-int128],
+                [$libc_cv_complex_int128])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 7ce4f877bc..33b99ad1e1 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -396,7 +396,7 @@ $(tgmath3-macro-tests:%=$(objpfx)%.o): CFLAGS += -fno-builtin
 $(foreach m,$(tgmath3-macros),\
 	    $(objpfx)test-tgmath3-$(m).c): $(objpfx)test-tgmath3-%.c: \
 					   gen-tgmath-tests.py
-	$(PYTHON) gen-tgmath-tests.py $* > $@
+	$(PYTHON) gen-tgmath-tests.py --complex-int128 $(config-complex-int128) $* > $@
 
 # Verify that the list of supported macros is in sync between the
 # Makefile and gen-tgmath-tests.py.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index 216e4640ef..85029aa7f8 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -53,6 +53,7 @@
 # supported on any given configuration of glibc, the MANT_DIG value
 # uniquely determines the format.
 
+import argparse
 import string
 import sys
 
@@ -182,7 +183,7 @@ class Type(object):
         return self.name
 
     @staticmethod
-    def init_types():
+    def init_types(complex_int128):
         """Initialize all the known types."""
         Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG',
                          complex_name='__CFLOAT16',
@@ -219,9 +220,11 @@ class Type(object):
         Type.create_type('long long int', integer=True)
         Type.create_type('unsigned long long int', integer=True)
         Type.create_type('__int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('unsigned __int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('enum e', integer=True, complex_ok=False)
         Type.create_type('_Bool', integer=True, complex_ok=False)
         Type.create_type('bit_field', integer=True, complex_ok=False)
@@ -834,15 +837,32 @@ class Tests(object):
             print('error: macro list mismatch')
             sys.exit(1)
 
-def main():
+def get_parser():
+    def strbool(string):
+        return True if string.lower() == 'yes' else False
+
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--complex-int128', dest='complex_int128',
+                        help='Generate tests for _Complex __int128',
+                        type=strbool)
+    parser.add_argument('--check-list', action='store_true',
+                        help='Verify that the list of supported macros')
+    parser.add_argument('macro',
+                        help='macro to test',
+                        nargs='*')
+    return parser
+
+def main(argv):
     """The main entry point."""
-    Type.init_types()
+    parser = get_parser()
+    opts = parser.parse_args(argv)
+    Type.init_types(True if opts.complex_int128 == 'yes' else False)
     t = Tests()
-    if sys.argv[1] == 'check-list':
+    if opts.check_list:
         macro = None
-        macro_list = sys.argv[2:]
+        macro_list = opts.macro
     else:
-        macro = sys.argv[1]
+        macro = opts.macro
         macro_list = []
     t.add_all_tests(macro)
     if macro:
@@ -851,4 +871,4 @@ def main():
         t.check_macro_list(macro_list)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it
@ 2024-01-29 17:59 Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2024-01-29 17:59 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a698c2a7f5aa1f567b3f639844d43cf38a596d8a

commit a698c2a7f5aa1f567b3f639844d43cf38a596d8a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 14:24:08 2022 -0300

    math: Only build tests for _Complex __int128 iff compiler supports it
    
    clang fails building test-tgmath3-atan2.c:
    
      error: '_Complex __int128' is invalid
      _Complex __int128 var__Complex___int128 __attribute__ ((unused));
    
    since it does not support _Complex with __int128.  So disable
    the test in such case.

Diff:
---
 configure                | 29 +++++++++++++++++++++++++++++
 configure.ac             | 17 +++++++++++++++++
 math/Makefile            |  2 +-
 math/gen-tgmath-tests.py | 38 +++++++++++++++++++++++++++++---------
 4 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 649270d302..5cf3e1d8fa 100755
--- a/configure
+++ b/configure
@@ -7389,6 +7389,35 @@ printf "%s\n" "$libc_cv_cc_float_store" >&6; }
 config_vars="$config_vars
 config-cflags-float-store = $libc_cv_cc_float_store"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compiler supports _Complex with __int128" >&5
+printf %s "checking whether compiler supports _Complex with __int128... " >&6; }
+if test ${libc_cv_complex_int128+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_complex_int128" >&5
+printf "%s\n" "$libc_cv_complex_int128" >&6; }
+config_vars="$config_vars
+config-complex-int128 = $libc_cv_complex_int128"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 printf %s "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index 1f9d8b6e5e..a6e05cf585 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1488,6 +1488,23 @@ LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
 LIBC_CONFIG_VAR([config-cflags-float-store],
 		[$libc_cv_cc_float_store])
 
+AC_CACHE_CHECK([whether compiler supports _Complex with __int128],
+	       [libc_cv_complex_int128], [dnl
+cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-complex-int128],
+                [$libc_cv_complex_int128])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 7ce4f877bc..33b99ad1e1 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -396,7 +396,7 @@ $(tgmath3-macro-tests:%=$(objpfx)%.o): CFLAGS += -fno-builtin
 $(foreach m,$(tgmath3-macros),\
 	    $(objpfx)test-tgmath3-$(m).c): $(objpfx)test-tgmath3-%.c: \
 					   gen-tgmath-tests.py
-	$(PYTHON) gen-tgmath-tests.py $* > $@
+	$(PYTHON) gen-tgmath-tests.py --complex-int128 $(config-complex-int128) $* > $@
 
 # Verify that the list of supported macros is in sync between the
 # Makefile and gen-tgmath-tests.py.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index f6f5c5a71d..59898888bd 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -53,6 +53,7 @@
 # supported on any given configuration of glibc, the MANT_DIG value
 # uniquely determines the format.
 
+import argparse
 import string
 import sys
 
@@ -182,7 +183,7 @@ class Type(object):
         return self.name
 
     @staticmethod
-    def init_types():
+    def init_types(complex_int128):
         """Initialize all the known types."""
         Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG',
                          complex_name='__CFLOAT16',
@@ -219,9 +220,11 @@ class Type(object):
         Type.create_type('long long int', integer=True)
         Type.create_type('unsigned long long int', integer=True)
         Type.create_type('__int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('unsigned __int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('enum e', integer=True, complex_ok=False)
         Type.create_type('_Bool', integer=True, complex_ok=False)
         Type.create_type('bit_field', integer=True, complex_ok=False)
@@ -834,15 +837,32 @@ class Tests(object):
             print('error: macro list mismatch')
             sys.exit(1)
 
-def main():
+def get_parser():
+    def strbool(string):
+        return True if string.lower() == 'yes' else False
+
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--complex-int128', dest='complex_int128',
+                        help='Generate tests for _Complex __int128',
+                        type=strbool)
+    parser.add_argument('--check-list', action='store_true',
+                        help='Verify that the list of supported macros')
+    parser.add_argument('macro',
+                        help='macro to test',
+                        nargs='*')
+    return parser
+
+def main(argv):
     """The main entry point."""
-    Type.init_types()
+    parser = get_parser()
+    opts = parser.parse_args(argv)
+    Type.init_types(True if opts.complex_int128 == 'yes' else False)
     t = Tests()
-    if sys.argv[1] == 'check-list':
+    if opts.check_list:
         macro = None
-        macro_list = sys.argv[2:]
+        macro_list = opts.macro
     else:
-        macro = sys.argv[1]
+        macro = opts.macro
         macro_list = []
     t.add_all_tests(macro)
     if macro:
@@ -851,4 +871,4 @@ def main():
         t.check_macro_list(macro_list)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it
@ 2023-12-21 18:55 Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2023-12-21 18:55 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8eeaf9038e5cc4337615cedcbd09c0ed4b1713bd

commit 8eeaf9038e5cc4337615cedcbd09c0ed4b1713bd
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 14:24:08 2022 -0300

    math: Only build tests for _Complex __int128 iff compiler supports it
    
    clang fails building test-tgmath3-atan2.c:
    
      error: '_Complex __int128' is invalid
      _Complex __int128 var__Complex___int128 __attribute__ ((unused));
    
    since it does not support _Complex with __int128.  So disable
    the test in such case.

Diff:
---
 configure                | 29 +++++++++++++++++++++++++++++
 configure.ac             | 17 +++++++++++++++++
 math/Makefile            |  2 +-
 math/gen-tgmath-tests.py | 38 +++++++++++++++++++++++++++++---------
 4 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index a811663fe4..3075261273 100755
--- a/configure
+++ b/configure
@@ -7388,6 +7388,35 @@ printf "%s\n" "$libc_cv_cc_float_store" >&6; }
 config_vars="$config_vars
 config-cflags-float-store = $libc_cv_cc_float_store"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compiler supports _Complex with __int128" >&5
+printf %s "checking whether compiler supports _Complex with __int128... " >&6; }
+if test ${libc_cv_complex_int128+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_complex_int128" >&5
+printf "%s\n" "$libc_cv_complex_int128" >&6; }
+config_vars="$config_vars
+config-complex-int128 = $libc_cv_complex_int128"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 printf %s "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index 1f9d8b6e5e..a6e05cf585 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1488,6 +1488,23 @@ LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
 LIBC_CONFIG_VAR([config-cflags-float-store],
 		[$libc_cv_cc_float_store])
 
+AC_CACHE_CHECK([whether compiler supports _Complex with __int128],
+	       [libc_cv_complex_int128], [dnl
+cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-complex-int128],
+                [$libc_cv_complex_int128])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 85a9cb3026..346cd67f8f 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -396,7 +396,7 @@ $(tgmath3-macro-tests:%=$(objpfx)%.o): CFLAGS += -fno-builtin
 $(foreach m,$(tgmath3-macros),\
 	    $(objpfx)test-tgmath3-$(m).c): $(objpfx)test-tgmath3-%.c: \
 					   gen-tgmath-tests.py
-	$(PYTHON) gen-tgmath-tests.py $* > $@
+	$(PYTHON) gen-tgmath-tests.py --complex-int128 $(config-complex-int128) $* > $@
 
 # Verify that the list of supported macros is in sync between the
 # Makefile and gen-tgmath-tests.py.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index 0882c7341a..e16ba0b0b0 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -53,6 +53,7 @@
 # supported on any given configuration of glibc, the MANT_DIG value
 # uniquely determines the format.
 
+import argparse
 import string
 import sys
 
@@ -182,7 +183,7 @@ class Type(object):
         return self.name
 
     @staticmethod
-    def init_types():
+    def init_types(complex_int128):
         """Initialize all the known types."""
         Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG',
                          complex_name='__CFLOAT16',
@@ -219,9 +220,11 @@ class Type(object):
         Type.create_type('long long int', integer=True)
         Type.create_type('unsigned long long int', integer=True)
         Type.create_type('__int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('unsigned __int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('enum e', integer=True, complex_ok=False)
         Type.create_type('_Bool', integer=True, complex_ok=False)
         Type.create_type('bit_field', integer=True, complex_ok=False)
@@ -834,15 +837,32 @@ class Tests(object):
             print('error: macro list mismatch')
             sys.exit(1)
 
-def main():
+def get_parser():
+    def strbool(string):
+        return True if string.lower() == 'yes' else False
+
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--complex-int128', dest='complex_int128',
+                        help='Generate tests for _Complex __int128',
+                        type=strbool)
+    parser.add_argument('--check-list', action='store_true',
+                        help='Verify that the list of supported macros')
+    parser.add_argument('macro',
+                        help='macro to test',
+                        nargs='*')
+    return parser
+
+def main(argv):
     """The main entry point."""
-    Type.init_types()
+    parser = get_parser()
+    opts = parser.parse_args(argv)
+    Type.init_types(True if opts.complex_int128 == 'yes' else False)
     t = Tests()
-    if sys.argv[1] == 'check-list':
+    if opts.check_list:
         macro = None
-        macro_list = sys.argv[2:]
+        macro_list = opts.macro
     else:
-        macro = sys.argv[1]
+        macro = opts.macro
         macro_list = []
     t.add_all_tests(macro)
     if macro:
@@ -851,4 +871,4 @@ def main():
         t.check_macro_list(macro_list)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it
@ 2023-09-28 17:53 Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2023-09-28 17:53 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2959338459164054b596389a962225f446f0cf9d

commit 2959338459164054b596389a962225f446f0cf9d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 14:24:08 2022 -0300

    math: Only build tests for _Complex __int128 iff compiler supports it
    
    clang fails building test-tgmath3-atan2.c:
    
      error: '_Complex __int128' is invalid
      _Complex __int128 var__Complex___int128 __attribute__ ((unused));
    
    since it does not support _Complex with __int128.  So disable
    the test in such case.

Diff:
---
 configure                | 29 +++++++++++++++++++++++++++++
 configure.ac             | 17 +++++++++++++++++
 math/Makefile            |  2 +-
 math/gen-tgmath-tests.py | 38 +++++++++++++++++++++++++++++---------
 4 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 086eb8fda3..7605653d58 100755
--- a/configure
+++ b/configure
@@ -7514,6 +7514,35 @@ printf "%s\n" "$libc_cv_cc_float_store" >&6; }
 config_vars="$config_vars
 config-cflags-float-store = $libc_cv_cc_float_store"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compiler supports _Complex with __int128" >&5
+printf %s "checking whether compiler supports _Complex with __int128... " >&6; }
+if test ${libc_cv_complex_int128+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_complex_int128" >&5
+printf "%s\n" "$libc_cv_complex_int128" >&6; }
+config_vars="$config_vars
+config-complex-int128 = $libc_cv_complex_int128"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 printf %s "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index 1467704750..188aa8749f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1553,6 +1553,23 @@ LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
 LIBC_CONFIG_VAR([config-cflags-float-store],
 		[$libc_cv_cc_float_store])
 
+AC_CACHE_CHECK([whether compiler supports _Complex with __int128],
+	       [libc_cv_complex_int128], [dnl
+cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-complex-int128],
+                [$libc_cv_complex_int128])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 85a9cb3026..346cd67f8f 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -396,7 +396,7 @@ $(tgmath3-macro-tests:%=$(objpfx)%.o): CFLAGS += -fno-builtin
 $(foreach m,$(tgmath3-macros),\
 	    $(objpfx)test-tgmath3-$(m).c): $(objpfx)test-tgmath3-%.c: \
 					   gen-tgmath-tests.py
-	$(PYTHON) gen-tgmath-tests.py $* > $@
+	$(PYTHON) gen-tgmath-tests.py --complex-int128 $(config-complex-int128) $* > $@
 
 # Verify that the list of supported macros is in sync between the
 # Makefile and gen-tgmath-tests.py.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index 0882c7341a..e16ba0b0b0 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -53,6 +53,7 @@
 # supported on any given configuration of glibc, the MANT_DIG value
 # uniquely determines the format.
 
+import argparse
 import string
 import sys
 
@@ -182,7 +183,7 @@ class Type(object):
         return self.name
 
     @staticmethod
-    def init_types():
+    def init_types(complex_int128):
         """Initialize all the known types."""
         Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG',
                          complex_name='__CFLOAT16',
@@ -219,9 +220,11 @@ class Type(object):
         Type.create_type('long long int', integer=True)
         Type.create_type('unsigned long long int', integer=True)
         Type.create_type('__int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('unsigned __int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('enum e', integer=True, complex_ok=False)
         Type.create_type('_Bool', integer=True, complex_ok=False)
         Type.create_type('bit_field', integer=True, complex_ok=False)
@@ -834,15 +837,32 @@ class Tests(object):
             print('error: macro list mismatch')
             sys.exit(1)
 
-def main():
+def get_parser():
+    def strbool(string):
+        return True if string.lower() == 'yes' else False
+
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--complex-int128', dest='complex_int128',
+                        help='Generate tests for _Complex __int128',
+                        type=strbool)
+    parser.add_argument('--check-list', action='store_true',
+                        help='Verify that the list of supported macros')
+    parser.add_argument('macro',
+                        help='macro to test',
+                        nargs='*')
+    return parser
+
+def main(argv):
     """The main entry point."""
-    Type.init_types()
+    parser = get_parser()
+    opts = parser.parse_args(argv)
+    Type.init_types(True if opts.complex_int128 == 'yes' else False)
     t = Tests()
-    if sys.argv[1] == 'check-list':
+    if opts.check_list:
         macro = None
-        macro_list = sys.argv[2:]
+        macro_list = opts.macro
     else:
-        macro = sys.argv[1]
+        macro = opts.macro
         macro_list = []
     t.add_all_tests(macro)
     if macro:
@@ -851,4 +871,4 @@ def main():
         t.check_macro_list(macro_list)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it
@ 2023-08-30 12:38 Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2023-08-30 12:38 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7c73783b0c1300e97354d2b9db1bb48ecc192887

commit 7c73783b0c1300e97354d2b9db1bb48ecc192887
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 14:24:08 2022 -0300

    math: Only build tests for _Complex __int128 iff compiler supports it

Diff:
---
 configure                | 29 +++++++++++++++++++++++++++++
 configure.ac             | 17 +++++++++++++++++
 math/Makefile            |  2 +-
 math/gen-tgmath-tests.py | 38 +++++++++++++++++++++++++++++---------
 4 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 0f3c8818d3..5c1ea0cd91 100755
--- a/configure
+++ b/configure
@@ -7490,6 +7490,35 @@ printf "%s\n" "$libc_cv_cc_float_store" >&6; }
 config_vars="$config_vars
 config-cflags-float-store = $libc_cv_cc_float_store"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compiler supports _Complex with __int128" >&5
+printf %s "checking whether compiler supports _Complex with __int128... " >&6; }
+if test ${libc_cv_complex_int128+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_complex_int128" >&5
+printf "%s\n" "$libc_cv_complex_int128" >&6; }
+config_vars="$config_vars
+config-complex-int128 = $libc_cv_complex_int128"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 printf %s "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index 7a9df2818a..f10b8869d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1545,6 +1545,23 @@ LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
 LIBC_CONFIG_VAR([config-cflags-float-store],
 		[$libc_cv_cc_float_store])
 
+AC_CACHE_CHECK([whether compiler supports _Complex with __int128],
+	       [libc_cv_complex_int128], [dnl
+cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-complex-int128],
+                [$libc_cv_complex_int128])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 85a9cb3026..346cd67f8f 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -396,7 +396,7 @@ $(tgmath3-macro-tests:%=$(objpfx)%.o): CFLAGS += -fno-builtin
 $(foreach m,$(tgmath3-macros),\
 	    $(objpfx)test-tgmath3-$(m).c): $(objpfx)test-tgmath3-%.c: \
 					   gen-tgmath-tests.py
-	$(PYTHON) gen-tgmath-tests.py $* > $@
+	$(PYTHON) gen-tgmath-tests.py --complex-int128 $(config-complex-int128) $* > $@
 
 # Verify that the list of supported macros is in sync between the
 # Makefile and gen-tgmath-tests.py.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index 0882c7341a..e16ba0b0b0 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -53,6 +53,7 @@
 # supported on any given configuration of glibc, the MANT_DIG value
 # uniquely determines the format.
 
+import argparse
 import string
 import sys
 
@@ -182,7 +183,7 @@ class Type(object):
         return self.name
 
     @staticmethod
-    def init_types():
+    def init_types(complex_int128):
         """Initialize all the known types."""
         Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG',
                          complex_name='__CFLOAT16',
@@ -219,9 +220,11 @@ class Type(object):
         Type.create_type('long long int', integer=True)
         Type.create_type('unsigned long long int', integer=True)
         Type.create_type('__int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('unsigned __int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('enum e', integer=True, complex_ok=False)
         Type.create_type('_Bool', integer=True, complex_ok=False)
         Type.create_type('bit_field', integer=True, complex_ok=False)
@@ -834,15 +837,32 @@ class Tests(object):
             print('error: macro list mismatch')
             sys.exit(1)
 
-def main():
+def get_parser():
+    def strbool(string):
+        return True if string.lower() == 'yes' else False
+
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--complex-int128', dest='complex_int128',
+                        help='Generate tests for _Complex __int128',
+                        type=strbool)
+    parser.add_argument('--check-list', action='store_true',
+                        help='Verify that the list of supported macros')
+    parser.add_argument('macro',
+                        help='macro to test',
+                        nargs='*')
+    return parser
+
+def main(argv):
     """The main entry point."""
-    Type.init_types()
+    parser = get_parser()
+    opts = parser.parse_args(argv)
+    Type.init_types(True if opts.complex_int128 == 'yes' else False)
     t = Tests()
-    if sys.argv[1] == 'check-list':
+    if opts.check_list:
         macro = None
-        macro_list = sys.argv[2:]
+        macro_list = opts.macro
     else:
-        macro = sys.argv[1]
+        macro = opts.macro
         macro_list = []
     t.add_all_tests(macro)
     if macro:
@@ -851,4 +871,4 @@ def main():
         t.check_macro_list(macro_list)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it
@ 2023-02-09 19:50 Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2023-02-09 19:50 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1556fe207039f625fa438457b31458fc45ed8827

commit 1556fe207039f625fa438457b31458fc45ed8827
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 14:24:08 2022 -0300

    math: Only build tests for _Complex __int128 iff compiler supports it

Diff:
---
 configure                | 28 ++++++++++++++++++++++++++++
 configure.ac             | 17 +++++++++++++++++
 math/Makefile            |  2 +-
 math/gen-tgmath-tests.py | 38 +++++++++++++++++++++++++++++---------
 4 files changed, 75 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index b1ebcaab23..6b1632f06b 100755
--- a/configure
+++ b/configure
@@ -6270,6 +6270,34 @@ $as_echo "$libc_cv_cc_float_store" >&6; }
 config_vars="$config_vars
 config-cflags-float-store = $libc_cv_cc_float_store"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports _Complex with __int128" >&5
+$as_echo_n "checking whether compiler supports _Complex with __int128... " >&6; }
+if ${libc_cv_complex_int128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_complex_int128" >&5
+$as_echo "$libc_cv_complex_int128" >&6; }
+config_vars="$config_vars
+config-complex-int128 = $libc_cv_complex_int128"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 $as_echo_n "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index 5377ac8255..ce402e09b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1561,6 +1561,23 @@ LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
 LIBC_CONFIG_VAR([config-cflags-float-store],
 		[$libc_cv_cc_float_store])
 
+AC_CACHE_CHECK([whether compiler supports _Complex with __int128],
+	       [libc_cv_complex_int128], [dnl
+cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-complex-int128],
+                [$libc_cv_complex_int128])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 0a773b64d9..bf3ea98ce9 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -396,7 +396,7 @@ $(tgmath3-macro-tests:%=$(objpfx)%.o): CFLAGS += -fno-builtin
 $(foreach m,$(tgmath3-macros),\
 	    $(objpfx)test-tgmath3-$(m).c): $(objpfx)test-tgmath3-%.c: \
 					   gen-tgmath-tests.py
-	$(PYTHON) gen-tgmath-tests.py $* > $@
+	$(PYTHON) gen-tgmath-tests.py --complex-int128 $(config-complex-int128) $* > $@
 
 # Verify that the list of supported macros is in sync between the
 # Makefile and gen-tgmath-tests.py.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index 0882c7341a..e16ba0b0b0 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -53,6 +53,7 @@
 # supported on any given configuration of glibc, the MANT_DIG value
 # uniquely determines the format.
 
+import argparse
 import string
 import sys
 
@@ -182,7 +183,7 @@ class Type(object):
         return self.name
 
     @staticmethod
-    def init_types():
+    def init_types(complex_int128):
         """Initialize all the known types."""
         Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG',
                          complex_name='__CFLOAT16',
@@ -219,9 +220,11 @@ class Type(object):
         Type.create_type('long long int', integer=True)
         Type.create_type('unsigned long long int', integer=True)
         Type.create_type('__int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('unsigned __int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('enum e', integer=True, complex_ok=False)
         Type.create_type('_Bool', integer=True, complex_ok=False)
         Type.create_type('bit_field', integer=True, complex_ok=False)
@@ -834,15 +837,32 @@ class Tests(object):
             print('error: macro list mismatch')
             sys.exit(1)
 
-def main():
+def get_parser():
+    def strbool(string):
+        return True if string.lower() == 'yes' else False
+
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--complex-int128', dest='complex_int128',
+                        help='Generate tests for _Complex __int128',
+                        type=strbool)
+    parser.add_argument('--check-list', action='store_true',
+                        help='Verify that the list of supported macros')
+    parser.add_argument('macro',
+                        help='macro to test',
+                        nargs='*')
+    return parser
+
+def main(argv):
     """The main entry point."""
-    Type.init_types()
+    parser = get_parser()
+    opts = parser.parse_args(argv)
+    Type.init_types(True if opts.complex_int128 == 'yes' else False)
     t = Tests()
-    if sys.argv[1] == 'check-list':
+    if opts.check_list:
         macro = None
-        macro_list = sys.argv[2:]
+        macro_list = opts.macro
     else:
-        macro = sys.argv[1]
+        macro = opts.macro
         macro_list = []
     t.add_all_tests(macro)
     if macro:
@@ -851,4 +871,4 @@ def main():
         t.check_macro_list(macro_list)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it
@ 2022-10-04 13:01 Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2022-10-04 13:01 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d27476e2328dc1d06fbb6f52cb789d8024cce77a

commit d27476e2328dc1d06fbb6f52cb789d8024cce77a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 14:24:08 2022 -0300

    math: Only build tests for _Complex __int128 iff compiler supports it

Diff:
---
 configure                | 28 ++++++++++++++++++++++++++++
 configure.ac             | 17 +++++++++++++++++
 math/Makefile            |  2 +-
 math/gen-tgmath-tests.py | 38 +++++++++++++++++++++++++++++---------
 4 files changed, 75 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 4a02e5de12..8a71df6568 100755
--- a/configure
+++ b/configure
@@ -6489,6 +6489,34 @@ $as_echo "$libc_cv_cc_float_store" >&6; }
 config_vars="$config_vars
 config-cflags-float-store = $libc_cv_cc_float_store"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports _Complex with __int128" >&5
+$as_echo_n "checking whether compiler supports _Complex with __int128... " >&6; }
+if ${libc_cv_complex_int128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_complex_int128" >&5
+$as_echo "$libc_cv_complex_int128" >&6; }
+config_vars="$config_vars
+config-complex-int128 = $libc_cv_complex_int128"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 $as_echo_n "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index a078b28914..d28ac6ed1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1571,6 +1571,23 @@ LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
 LIBC_CONFIG_VAR([config-cflags-float-store],
 		[$libc_cv_cc_float_store])
 
+AC_CACHE_CHECK([whether compiler supports _Complex with __int128],
+	       [libc_cv_complex_int128], [dnl
+cat > conftest.c <<EOF
+#ifndef __SIZEOF_INT128__
+# error "__int128 not supported"
+#endif
+_Complex __int128 var;
+EOF
+libc_cv_complex_int128=no
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_complex_int128=yes
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-complex-int128],
+                [$libc_cv_complex_int128])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 0cf60e4df6..aaeb9fc330 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -396,7 +396,7 @@ $(tgmath3-macro-tests:%=$(objpfx)%.o): CFLAGS += -fno-builtin
 $(foreach m,$(tgmath3-macros),\
 	    $(objpfx)test-tgmath3-$(m).c): $(objpfx)test-tgmath3-%.c: \
 					   gen-tgmath-tests.py
-	$(PYTHON) gen-tgmath-tests.py $* > $@
+	$(PYTHON) gen-tgmath-tests.py --complex-int128 $(config-complex-int128) $* > $@
 
 # Verify that the list of supported macros is in sync between the
 # Makefile and gen-tgmath-tests.py.
diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py
index c841db6000..703491e1e9 100755
--- a/math/gen-tgmath-tests.py
+++ b/math/gen-tgmath-tests.py
@@ -54,6 +54,7 @@
 # supported on any given configuration of glibc, the MANT_DIG value
 # uniquely determines the format.
 
+import argparse
 import string
 import sys
 
@@ -183,7 +184,7 @@ class Type(object):
         return self.name
 
     @staticmethod
-    def init_types():
+    def init_types(complex_int128):
         """Initialize all the known types."""
         Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG',
                          complex_name='__CFLOAT16',
@@ -218,9 +219,11 @@ class Type(object):
         Type.create_type('long long int', integer=True)
         Type.create_type('unsigned long long int', integer=True)
         Type.create_type('__int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('unsigned __int128', integer=True,
-                         condition='defined __SIZEOF_INT128__')
+                         condition='defined __SIZEOF_INT128__',
+                         complex_ok=complex_int128)
         Type.create_type('enum e', integer=True, complex_ok=False)
         Type.create_type('_Bool', integer=True, complex_ok=False)
         Type.create_type('bit_field', integer=True, complex_ok=False)
@@ -785,15 +788,32 @@ class Tests(object):
             print('error: macro list mismatch')
             sys.exit(1)
 
-def main():
+def get_parser():
+    def strbool(string):
+        return True if string.lower() == 'yes' else False
+
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--complex-int128', dest='complex_int128',
+                        help='Generate tests for _Complex __int128',
+                        type=strbool)
+    parser.add_argument('--check-list', action='store_true',
+                        help='Verify that the list of supported macros')
+    parser.add_argument('macro',
+                        help='macro to test',
+                        nargs='*')
+    return parser
+
+def main(argv):
     """The main entry point."""
-    Type.init_types()
+    parser = get_parser()
+    opts = parser.parse_args(argv)
+    Type.init_types(True if opts.complex_int128 == 'yes' else False)
     t = Tests()
-    if sys.argv[1] == 'check-list':
+    if opts.check_list:
         macro = None
-        macro_list = sys.argv[2:]
+        macro_list = opts.macro
     else:
-        macro = sys.argv[1]
+        macro = opts.macro
         macro_list = []
     t.add_all_tests(macro)
     if macro:
@@ -802,4 +822,4 @@ def main():
         t.check_macro_list(macro_list)
 
 if __name__ == '__main__':
-    main()
+    main(sys.argv[1:])

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-02-09 17:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 17:43 [glibc/azanella/clang] math: Only build tests for _Complex __int128 iff compiler supports it Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2024-02-09 17:33 Adhemerval Zanella
2024-02-07 14:08 Adhemerval Zanella
2024-01-29 17:59 Adhemerval Zanella
2023-12-21 18:55 Adhemerval Zanella
2023-09-28 17:53 Adhemerval Zanella
2023-08-30 12:38 Adhemerval Zanella
2023-02-09 19:50 Adhemerval Zanella
2022-10-04 13:01 Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).