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

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

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

    math: Only check 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 5c528345dd..c8ec3471d4 100755
--- a/configure
+++ b/configure
@@ -6535,6 +6535,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 b5e5a33c93..996d674399 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1554,6 +1554,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

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

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

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

    math: Only check 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 5c528345dd..c8ec3471d4 100755
--- a/configure
+++ b/configure
@@ -6535,6 +6535,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 b5e5a33c93..996d674399 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1554,6 +1554,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

* [glibc/azanella/clang] math: Only check for _Complex __int128 iff compiler supports it
@ 2022-06-03 14:07 Adhemerval Zanella
  0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-06-03 14:07 UTC (permalink / raw)
  To: glibc-cvs

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

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

    math: Only check 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 5c528345dd..c8ec3471d4 100755
--- a/configure
+++ b/configure
@@ -6535,6 +6535,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 b5e5a33c93..996d674399 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1554,6 +1554,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

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

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

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

    math: Only check 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 5c528345dd..c8ec3471d4 100755
--- a/configure
+++ b/configure
@@ -6535,6 +6535,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 b5e5a33c93..996d674399 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1554,6 +1554,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

* [glibc/azanella/clang] math: Only check for _Complex __int128 iff compiler supports it
@ 2022-05-12 19:35 Adhemerval Zanella
  0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:35 UTC (permalink / raw)
  To: glibc-cvs

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

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

    math: Only check 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 5c528345dd..c8ec3471d4 100755
--- a/configure
+++ b/configure
@@ -6535,6 +6535,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 b5e5a33c93..996d674399 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1554,6 +1554,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

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

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

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

    math: Only check 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 5c528345dd..c8ec3471d4 100755
--- a/configure
+++ b/configure
@@ -6535,6 +6535,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 b5e5a33c93..996d674399 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1554,6 +1554,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

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

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

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

    math: Only check 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 f406d2769c..6e3500d2fd 100755
--- a/configure
+++ b/configure
@@ -6563,6 +6563,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 1dcd58626e..76fadafbe0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1570,6 +1570,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

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

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

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

    math: Only check 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 2b1fb6cdee..2b17c9cabd 100755
--- a/configure
+++ b/configure
@@ -6690,6 +6690,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 cbc3fee316..62e44967c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1686,6 +1686,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

* [glibc/azanella/clang] math: Only check for _Complex __int128 iff compiler supports it
@ 2022-03-31 19:08 Adhemerval Zanella
  0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-03-31 19:08 UTC (permalink / raw)
  To: glibc-cvs

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

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

    math: Only check 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 2b1fb6cdee..2b17c9cabd 100755
--- a/configure
+++ b/configure
@@ -6690,6 +6690,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 cbc3fee316..62e44967c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1686,6 +1686,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

* [glibc/azanella/clang] math: Only check for _Complex __int128 iff compiler supports it
@ 2022-03-29 20:31 Adhemerval Zanella
  0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-03-29 20:31 UTC (permalink / raw)
  To: glibc-cvs

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

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

    math: Only check 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 2b1fb6cdee..2b17c9cabd 100755
--- a/configure
+++ b/configure
@@ -6690,6 +6690,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 cbc3fee316..62e44967c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1686,6 +1686,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 bc56174c5a..01ec3610d2 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] 10+ messages in thread

end of thread, other threads:[~2022-06-09 21:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 21:21 [glibc/azanella/clang] math: Only check for _Complex __int128 iff compiler supports it Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2022-06-09 13:18 Adhemerval Zanella
2022-06-03 14:07 Adhemerval Zanella
2022-05-13 14:21 Adhemerval Zanella
2022-05-12 19:35 Adhemerval Zanella
2022-05-10 18:25 Adhemerval Zanella
2022-04-29 14:05 Adhemerval Zanella
2022-04-04 12:56 Adhemerval Zanella
2022-03-31 19:08 Adhemerval Zanella
2022-03-29 20:31 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).