diff options
author | Martin Liska <mliska@suse.cz> | 2022-10-15 15:32:39 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-10-15 15:32:39 +0200 |
commit | 2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9 (patch) | |
tree | b118381a0a883a762ddd56c0e91608d937ee8bdf /gcc/testsuite | |
parent | bd21c04269deded2c7476ceca1100a26f28ea526 (diff) | |
parent | baeec7cc83b19b46d1c73523f06efa7ea2b30390 (diff) | |
download | gcc-2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9.zip gcc-2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9.tar.gz gcc-2c92cfe87d2bb8aa0eb78f3932fca16699cb35c9.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/testsuite')
72 files changed, 1376 insertions, 291 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 737ee21..f717614 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,160 @@ +2022-10-14 Joseph Myers <joseph@codesourcery.com> + + * gcc.dg/cpp/c2x-ucnid-1-utf8.c, gcc.dg/cpp/c2x-ucnid-1.c: New + tests. + +2022-10-14 Harald Anlauf <anlauf@gmx.de> + + PR fortran/100971 + * gfortran.dg/der_io_5.f90: New test. + +2022-10-14 Tobias Burnus <tobias@codesourcery.com> + + * gfortran.dg/c-interop/deferred-character-2.f90: Use 'dg-do run'. + +2022-10-14 Patrick Palka <ppalka@redhat.com> + + PR c++/106304 + * g++.dg/modules/pr106304_a.C: New test. + * g++.dg/modules/pr106304_b.C: New test. + +2022-10-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/107254 + * gfortran.dg/vect/pr107254.f90: New testcase. + +2022-10-14 Jørgen Kvalsvik <jorgen.kvalsvik@woven-planet.global> + + * gcc.misc-tests/gcov-4.c: New testcase. + +2022-10-14 Jørgen Kvalsvik <jorgen.kvalsvik@woven-planet.global> + + * g++.dg/gcov/gcov-1.C: Add line count check. + * gcc.misc-tests/gcov-4.c: Likewise. + +2022-10-14 Jakub Jelinek <jakub@redhat.com> + + * lib/target-supports.exp (check_effective_target_bfloat16, + check_effective_target_bfloat16_runtime, add_options_for_bfloat16): + New. + * gcc.dg/torture/bfloat16-basic.c: New test. + * gcc.dg/torture/bfloat16-builtin.c: New test. + * gcc.dg/torture/bfloat16-builtin-issignaling-1.c: New test. + * gcc.dg/torture/bfloat16-complex.c: New test. + * gcc.dg/torture/builtin-issignaling-1.c: Allow to be includable + from bfloat16-builtin-issignaling-1.c. + * gcc.dg/torture/floatn-basic.h: Allow to be includable from + bfloat16-basic.c. + * gcc.target/i386/vect-bfloat16-typecheck_2.c: Adjust expected + diagnostics. + * gcc.target/i386/sse2-bfloat16-scalar-typecheck.c: Likewise. + * gcc.target/i386/vect-bfloat16-typecheck_1.c: Likewise. + * g++.target/i386/bfloat_cpp_typecheck.C: Likewise. + +2022-10-14 Jakub Jelinek <jakub@redhat.com> + + PR c/82071 + PR c/87390 + PR c++/107097 + * gcc.target/i386/excess-precision-8.c: For C++ wrap abort and + exit declarations into extern "C" block. + * gcc.target/i386/excess-precision-10.c: Likewise. + * g++.target/i386/excess-precision-7.C: Remove. + * g++.target/i386/excess-precision-8.C: New test. + * g++.target/i386/excess-precision-9.C: Remove. + * g++.target/i386/excess-precision-10.C: New test. + * g++.target/i386/excess-precision-12.C: New test. + +2022-10-14 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/323 + PR c++/107097 + * gcc.target/i386/excess-precision-1.c: For C++ wrap abort and + exit declarations into extern "C" block. + * gcc.target/i386/excess-precision-2.c: Likewise. + * gcc.target/i386/excess-precision-3.c: Likewise. Remove + check_float_nonproto and check_double_nonproto tests for C++. + * gcc.target/i386/excess-precision-7.c: For C++ wrap abort and + exit declarations into extern "C" block. + * gcc.target/i386/excess-precision-9.c: Likewise. + * g++.target/i386/excess-precision-1.C: New test. + * g++.target/i386/excess-precision-2.C: New test. + * g++.target/i386/excess-precision-3.C: New test. + * g++.target/i386/excess-precision-4.C: New test. + * g++.target/i386/excess-precision-5.C: New test. + * g++.target/i386/excess-precision-6.C: New test. + * g++.target/i386/excess-precision-7.C: New test. + * g++.target/i386/excess-precision-9.C: New test. + * g++.target/i386/excess-precision-11.C: New test. + * c-c++-common/dfp/convert-bfp-10.c: Add -fexcess-precision=fast + as dg-additional-options. + * c-c++-common/dfp/compare-eq-const.c: Likewise. + * g++.dg/cpp1z/constexpr-96862.C: Likewise. + * g++.dg/cpp1z/decomp12.C (main): Use 2.25 instead of 2.3 to + avoid excess precision differences. + * g++.dg/other/thunk1.C: Add -fexcess-precision=fast + as dg-additional-options. + * g++.dg/vect/pr64410.cc: Likewise. + * g++.dg/cpp1y/pr68180.C: Likewise. + * g++.dg/vect/pr89653.cc: Likewise. + * g++.dg/cpp0x/variadic-tuple.C: Likewise. + * g++.dg/cpp0x/nsdmi-union1.C: Use 4.25 instead of 4.2 to + avoid excess precision differences. + * g++.old-deja/g++.brendan/copy9.C: Add -fexcess-precision=fast + as dg-additional-options. + * g++.old-deja/g++.brendan/overload7.C: Likewise. + +2022-10-14 Joseph Myers <joseph@codesourcery.com> + + * gcc.dg/c11-complit-1.c, gcc.dg/c11-complit-2.c, + gcc.dg/c11-complit-3.c, gcc.dg/c2x-complit-2.c, + gcc.dg/c2x-complit-3.c, gcc.dg/c2x-complit-4.c, + gcc.dg/c2x-complit-5.c, gcc.dg/c2x-complit-6.c, + gcc.dg/c2x-complit-7.c, gcc.dg/c90-complit-2.c, + gcc.dg/gnu2x-complit-1.c, gcc.dg/gnu2x-complit-2.c: New tests. + +2022-10-13 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.dg/Wstringop-overflow-89.c: New test. + +2022-10-13 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/107210 + * gfortran.dg/analyzer/pr107210.f90: New test. + +2022-10-13 Andrew MacLeod <amacleod@redhat.com> + + * gcc.dg/pr102540.c: New. + * gcc.dg/pr102872.c: New. + +2022-10-13 Marek Polacek <polacek@redhat.com> + + PR c++/106925 + * g++.dg/cpp0x/initlist-defarg3.C: New test. + +2022-10-13 Wilco Dijkstra <wdijkstr@arm.com> + + PR target/105773 + * gcc.target/aarch64/ands_2.c: Test for ANDS. + * gcc.target/aarch64/bics_2.c: Test for BICS. + * gcc.target/aarch64/tst_2.c: Test for TST. + * gcc.target/aarch64/tst_imm_split_1.c: Fix test. + +2022-10-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/107160 + * gcc.dg/vect/pr107160.c: New testcase. + +2022-10-13 Andre Vieira <andre.simoesdiasvieira@arm.com> + + * gcc.dg/vect/pr107229-1.c: New test. + * gcc.dg/vect/pr107229-2.c: New test. + * gcc.dg/vect/pr107229-3.c: New test. + +2022-10-13 Joseph Myers <joseph@codesourcery.com> + + * gcc.dg/c2x-float-10.c: Do not expect value 2 for *_IS_IEC_60559. + 2022-10-12 Lewis Hyatt <lhyatt@gmail.com> PR preprocessor/60014 diff --git a/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c b/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c index 0c9ff20..4bc2189 100644 --- a/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c +++ b/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c @@ -1,5 +1,6 @@ /* C99 6.5.9 Equality operators. Compare decimal float constants against each other. */ +/* { dg-additional-options "-fexcess-precision=fast" } */ #include "dfp-dbg.h" diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c index 3fef98a..2cce3e6 100644 --- a/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c +++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c @@ -1,4 +1,5 @@ /* This test assumes IEEE float and double. */ +/* { dg-additional-options "-fexcess-precision=fast" } */ #include "convert.h" diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-defarg3.C b/gcc/testsuite/g++.dg/cpp0x/initlist-defarg3.C new file mode 100644 index 0000000..5c3e886 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-defarg3.C @@ -0,0 +1,13 @@ +// PR c++/106925 +// { dg-do compile { target c++11 } } + +struct Foo; +template <int _Nm> struct __array_traits { typedef Foo _Type[_Nm]; }; +template <int _Nm> struct array { + typename __array_traits<_Nm>::_Type _M_elems; +}; +template <int size> struct MyVector { array<size> data{}; }; +struct Foo { + float a{0}; +}; +void foo(MyVector<1> = MyVector<1>()); diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C index 11bdd88..c5acc4a 100644 --- a/gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C +++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-union1.C @@ -18,8 +18,8 @@ int main() { Test t; B b; - B b2(4.2); + B b2(4.25); - if (t.a != 4 || b.i != 42 || b2.d != 4.2) + if (t.a != 4 || b.i != 42 || b2.d != 4.25) __builtin_abort(); } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C b/gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C index e2699d9..5164598 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C @@ -1,4 +1,5 @@ // { dg-do run { target c++11 } } +// { dg-additional-options "-fexcess-precision=fast" } // An implementation of TR1's <tuple> using variadic teplates // Contributed by Douglas Gregor <doug.gregor@gmail.com> diff --git a/gcc/testsuite/g++.dg/cpp1y/pr68180.C b/gcc/testsuite/g++.dg/cpp1y/pr68180.C index 9e6e5e9..64d613e 100644 --- a/gcc/testsuite/g++.dg/cpp1y/pr68180.C +++ b/gcc/testsuite/g++.dg/cpp1y/pr68180.C @@ -1,6 +1,6 @@ // PR c++/68180 // { dg-do compile { target c++14 } } -// { dg-additional-options "-Wno-psabi" } +// { dg-additional-options "-Wno-psabi -fexcess-precision=fast" } typedef float __attribute__( ( vector_size( 16 ) ) ) float32x4_t; constexpr float32x4_t fill(float x) { diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-96862.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-96862.C index 0b5c2e81..daefca9 100644 --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-96862.C +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-96862.C @@ -1,6 +1,6 @@ // PR c++/96862 // { dg-do compile { target c++17 } } -// { dg-additional-options "-frounding-math" } +// { dg-additional-options "-frounding-math -fexcess-precision=fast" } constexpr double a = 0x1.0p+100 + 0x1.0p-100; const double b = 0x1.0p+100 + 0x1.0p-100; diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp12.C b/gcc/testsuite/g++.dg/cpp1z/decomp12.C index 56fd498..a65aaf9 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp12.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp12.C @@ -7,13 +7,13 @@ template <typename, typename> struct same_type; template <typename T> struct same_type<T, T> {}; int main() { - std::tuple tuple = { 1, 'a', 2.3, true }; + std::tuple tuple = { 1, 'a', 2.25, true }; auto[i, c, d, b] = tuple; same_type<std::tuple_element<0, decltype(tuple)>::type, decltype(i)>{}; same_type<decltype(i), int>{}; same_type<decltype(c), char>{}; same_type<decltype(d), double>{}; same_type<decltype(b), bool>{}; - if (i != 1 || c != 'a' || d != 2.3 || b != true) + if (i != 1 || c != 'a' || d != 2.25 || b != true) __builtin_abort (); } diff --git a/gcc/testsuite/g++.dg/gcov/gcov-1.C b/gcc/testsuite/g++.dg/gcov/gcov-1.C index 9018b9a..ee383b4 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov-1.C +++ b/gcc/testsuite/g++.dg/gcov/gcov-1.C @@ -257,20 +257,20 @@ test_switch (int i, int j) switch (i) /* count(5) */ /* branch(end) */ { - case 1: + case 1: /* count(1) */ result = do_something (2); /* count(1) */ - break; + break; /* count(1) */ case 2: result = do_something (1024); break; - case 3: + case 3: /* count(3) */ case 4: /* branch(67) */ if (j == 2) /* count(3) */ /* branch(end) */ return do_something (4); /* count(1) */ result = do_something (8); /* count(2) */ - break; + break; /* count(2) */ default: result = do_something (32); /* count(1) */ switch_m++; /* count(1) */ diff --git a/gcc/testsuite/g++.dg/modules/pr106304_a.C b/gcc/testsuite/g++.dg/modules/pr106304_a.C new file mode 100644 index 0000000..b999eec --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr106304_a.C @@ -0,0 +1,12 @@ +// PR c++/106304 +// { dg-additional-options -fmodules-ts } +// { dg-module-cmi pr106304 } + +export module pr106304; + +struct A { virtual ~A() = default; }; +struct B : A { }; + +inline const B* as_b(const A& a) { + return dynamic_cast<const B*>(&a); +} diff --git a/gcc/testsuite/g++.dg/modules/pr106304_b.C b/gcc/testsuite/g++.dg/modules/pr106304_b.C new file mode 100644 index 0000000..e833390 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr106304_b.C @@ -0,0 +1,8 @@ +// PR c++/106304 +// { dg-additional-options -fmodules-ts } + +module pr106304; + +void f(A& a) { + as_b(a); +} diff --git a/gcc/testsuite/g++.dg/other/thunk1.C b/gcc/testsuite/g++.dg/other/thunk1.C index 9016562..7758111 100644 --- a/gcc/testsuite/g++.dg/other/thunk1.C +++ b/gcc/testsuite/g++.dg/other/thunk1.C @@ -1,5 +1,6 @@ // PR c++/12007 Multiple inheritance float pass by value fails // { dg-do run } +// { dg-additional-options "-fexcess-precision=fast" } extern "C" void abort (void); diff --git a/gcc/testsuite/g++.dg/vect/pr64410.cc b/gcc/testsuite/g++.dg/vect/pr64410.cc index cbc2acc..ad4b085 100644 --- a/gcc/testsuite/g++.dg/vect/pr64410.cc +++ b/gcc/testsuite/g++.dg/vect/pr64410.cc @@ -1,5 +1,6 @@ // { dg-do compile } // { dg-require-effective-target vect_double } +// { dg-additional-options "-fexcess-precision=fast" } #include <vector> #include <complex> diff --git a/gcc/testsuite/g++.dg/vect/pr89653.cc b/gcc/testsuite/g++.dg/vect/pr89653.cc index d38b49a..f5a071f 100644 --- a/gcc/testsuite/g++.dg/vect/pr89653.cc +++ b/gcc/testsuite/g++.dg/vect/pr89653.cc @@ -1,5 +1,6 @@ // { dg-do compile } // { dg-require-effective-target vect_double } +// { dg-additional-options "-fexcess-precision=fast" } #include <algorithm> diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/copy9.C b/gcc/testsuite/g++.old-deja/g++.brendan/copy9.C index f05b194..79339c1 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/copy9.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/copy9.C @@ -1,4 +1,5 @@ // { dg-do run } +// { dg-additional-options "-fexcess-precision=fast" } // GROUPS passed copy-ctors #include <iostream> diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/overload7.C b/gcc/testsuite/g++.old-deja/g++.brendan/overload7.C index 29a9060..08f220c 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/overload7.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/overload7.C @@ -1,4 +1,5 @@ // { dg-do run } +// { dg-additional-options "-fexcess-precision=fast" } // GROUPS passed overloading extern "C" int printf (const char *, ...); diff --git a/gcc/testsuite/g++.target/i386/bfloat_cpp_typecheck.C b/gcc/testsuite/g++.target/i386/bfloat_cpp_typecheck.C index b800a6d..2567129 100644 --- a/gcc/testsuite/g++.target/i386/bfloat_cpp_typecheck.C +++ b/gcc/testsuite/g++.target/i386/bfloat_cpp_typecheck.C @@ -5,6 +5,6 @@ void foo (void) { __bf16 (); /* { dg-bogus {invalid conversion to type '__bf16'} } */ __bf16 a = __bf16(); /* { dg-bogus {invalid conversion to type '__bf16'} } */ - __bf16 (0x1234); /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 (0.1); /* { dg-error {invalid conversion to type '__bf16'} } */ + __bf16 (0x1234); /* { dg-bogus {invalid conversion to type '__bf16'} } */ + __bf16 (0.1); /* { dg-bogus {invalid conversion to type '__bf16'} } */ } diff --git a/gcc/testsuite/g++.target/i386/excess-precision-1.C b/gcc/testsuite/g++.target/i386/excess-precision-1.C new file mode 100644 index 0000000..0519d63 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-1.C @@ -0,0 +1,6 @@ +// Excess precision tests. Test that excess precision is carried +// through various operations. +// { dg-do run } +// { dg-options "-O2 -mfpmath=387 -fexcess-precision=standard" } + +#include "../../gcc.target/i386/excess-precision-1.c" diff --git a/gcc/testsuite/g++.target/i386/excess-precision-10.C b/gcc/testsuite/g++.target/i386/excess-precision-10.C new file mode 100644 index 0000000..9dbe25e --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-10.C @@ -0,0 +1,6 @@ +// Excess precision tests. Test implicit conversions in comparisons: +// excess precision in C++. +// { dg-do run } +// { dg-options "-mfpmath=387 -fexcess-precision=standard" } + +#include "../../gcc.target/i386/excess-precision-10.c" diff --git a/gcc/testsuite/g++.target/i386/excess-precision-11.C b/gcc/testsuite/g++.target/i386/excess-precision-11.C new file mode 100644 index 0000000..119b666 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-11.C @@ -0,0 +1,105 @@ +// Excess precision tests. Test excess precision is removed when +// necessary. +// { dg-do run } +// { dg-options "-O2 -mfpmath=387 -fexcess-precision=standard" } + +#include <float.h> +#include <stdarg.h> + +extern "C" void abort (); + +volatile float f1 = 1.0f; +volatile float f2 = 0x1.0p-30f; +volatile float f3 = 0x1.0p-60f; +volatile double d1 = 1.0; +volatile double d2 = 0x1.0p-30; +volatile double d3 = 0x1.0p-60; +volatile double d3d = 0x1.0p-52; +volatile float fadd1 = 1.0f + 0x1.0p-30f; +volatile double dadd2 = 1.0 + 0x1.0p-30 + 0x1.0p-60; +volatile double dh = 0x1.0p-24; +volatile float fha = 1.0f + 0x1.0p-23f; + +static inline void +check_float (float f) +{ + if (f != fadd1) + abort (); +} + +static inline void +check_float (double) +{ + abort (); +} + +static inline void +check_float (long double) +{ + abort (); +} + +static inline void +check_double (double d) +{ + if (d != dadd2) + abort (); +} + +static inline void +check_double (long double) +{ + abort (); +} + +static inline void +check_float2 (float f) +{ + if (f != fha) + abort (); +} + +struct S { + S () {} + S (float f) { if (f != fadd1) abort (); } +}; + +struct T { + T () {} + T (double d) { if (d != dadd2) abort (); } +}; + +static inline void +check_float3 (S) +{ +} + +static inline void +check_double2 (T) +{ +} + +void +test_call () +{ + check_float (f1 + f2); + check_double (f1 + f2); + check_double (d1 + d2 + d3); + /* Verify rounding direct to float without double rounding. */ + if (sizeof (long double) > sizeof (double)) + check_float2 (d1 + dh + d3); + else + check_float2 (d1 + dh + d3d); + check_float3 (f1 + f2); + check_double2 (f1 + f2); + check_double2 (d1 + d2 + d3); + S s1 = static_cast<S> (f1 + f2); + T t2 = static_cast<T> (f1 + f2); + T t3 = static_cast<T> (d1 + d2 + d3); +} + +int +main () +{ + test_call (); +} diff --git a/gcc/testsuite/g++.target/i386/excess-precision-12.C b/gcc/testsuite/g++.target/i386/excess-precision-12.C new file mode 100644 index 0000000..dff48c0 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-12.C @@ -0,0 +1,20 @@ +// Excess precision tests. Test implicit conversions in 3-way comparisons: +// excess precision in C++. +// { dg-do run { target c++20 } } +// { dg-options "-mfpmath=387 -fexcess-precision=standard" } + +#include <compare> +#include <cstdlib> + +int +main (void) +{ + float f = 0x1p63f; + unsigned long long int u = (1ULL << 63) + 1; + + if ((f <=> u) >= 0) + abort (); + + if ((u <=> f) <= 0) + abort (); +} diff --git a/gcc/testsuite/g++.target/i386/excess-precision-2.C b/gcc/testsuite/g++.target/i386/excess-precision-2.C new file mode 100644 index 0000000..afb2197 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-2.C @@ -0,0 +1,5 @@ +// Excess precision tests. Test excess precision of constants. +// { dg-do run } +// { dg-options "-O2 -mfpmath=387 -fexcess-precision=standard" } + +#include "../../gcc.target/i386/excess-precision-2.c" diff --git a/gcc/testsuite/g++.target/i386/excess-precision-3.C b/gcc/testsuite/g++.target/i386/excess-precision-3.C new file mode 100644 index 0000000..be8cc42 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-3.C @@ -0,0 +1,6 @@ +// Excess precision tests. Test excess precision is removed when +// necessary. +// { dg-do run } +// { dg-options "-O2 -mfpmath=387 -fexcess-precision=standard" } + +#include "../../gcc.target/i386/excess-precision-3.c" diff --git a/gcc/testsuite/g++.target/i386/excess-precision-4.C b/gcc/testsuite/g++.target/i386/excess-precision-4.C new file mode 100644 index 0000000..30606b1 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-4.C @@ -0,0 +1,7 @@ +// Excess precision tests. Test diagnostics for excess precision of +// constants. +// { dg-do compile } +// { dg-options "-mfpmath=387 -fexcess-precision=standard" } + +float f = 0.0f * 1e50f; // { dg-warning "floating constant exceeds range of 'float'" } +double d = 0.0 * 1e400; // { dg-warning "floating constant exceeds range of 'double'" } diff --git a/gcc/testsuite/g++.target/i386/excess-precision-5.C b/gcc/testsuite/g++.target/i386/excess-precision-5.C new file mode 100644 index 0000000..fa15753 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-5.C @@ -0,0 +1,32 @@ +// Excess precision tests. Verify excess precision doesn't affect +// actual types. +// { dg-do compile { target c++11 } } +// { dg-options "-mfpmath=387 -fexcess-precision=standard" } + +namespace std { + template<typename T, T v> struct integral_constant { + static constexpr T value = v; + }; + typedef integral_constant<bool, false> false_type; + typedef integral_constant<bool, true> true_type; + template<class T, class U> + struct is_same : std::false_type {}; + template <class T> + struct is_same<T, T> : std::true_type {}; +} + +float f; +double d; + +void +test_types (void) +{ +#define CHECK_FLOAT(E) static_assert (std::is_same <float, decltype (E)>::value, "") +#define CHECK_DOUBLE(E) static_assert (std::is_same <double, decltype (E)>::value, "") + CHECK_FLOAT (f + f); + CHECK_DOUBLE (d + d); + CHECK_FLOAT (f * f / f); + CHECK_DOUBLE (d * d / d); + CHECK_FLOAT (f ? f - f : f); + CHECK_DOUBLE (d ? d - d : d); +} diff --git a/gcc/testsuite/g++.target/i386/excess-precision-6.C b/gcc/testsuite/g++.target/i386/excess-precision-6.C new file mode 100644 index 0000000..06e9a93 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-6.C @@ -0,0 +1,19 @@ +// Excess precision tests. Make sure sqrt is not inlined for float or +// double. +// { dg-do compile } +// { dg-options "-mfpmath=387 -O2 -fno-math-errno -fexcess-precision=standard" } + +float f; +double d; + +float fr; +double dr; + +void +test_builtins (void) +{ + fr = __builtin_sqrtf (f); + dr = __builtin_sqrt (d); +} + +// { dg-final { scan-assembler-not "fsqrt" } } diff --git a/gcc/testsuite/g++.target/i386/excess-precision-8.C b/gcc/testsuite/g++.target/i386/excess-precision-8.C new file mode 100644 index 0000000..c170c00 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/excess-precision-8.C @@ -0,0 +1,7 @@ +// Excess precision tests. Test C++ semantics for conversions from +// integers to floating point: no excess precision for either explicit +// or implicit conversions. +// { dg-do run } +// { dg-options "-mfpmath=387 -fexcess-precision=standard" } + +#include "../../gcc.target/i386/excess-precision-8.c" diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-89.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-89.c new file mode 100644 index 0000000..ba25a93 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-89.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-inline -Wall" } */ + +extern void process (char); + +void process_array4 (char a[4], int n) +{ + for (int i = 0; i < n; i++) + process (a[i]); +} + +void process_array3 (char a[3], int n) +{ + for (int i = 0; i < n; i++) + process (a[i]); +} diff --git a/gcc/testsuite/gcc.dg/c11-complit-1.c b/gcc/testsuite/gcc.dg/c11-complit-1.c new file mode 100644 index 0000000..e191ceb --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-complit-1.c @@ -0,0 +1,7 @@ +/* Test C2x storage class specifiers in compound literals not permitted for + C11. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +int *ps = &(static int) { 1 }; /* { dg-error "forbids storage class specifiers in compound literals" } */ +int ss = sizeof (static int) { 1 }; /* { dg-error "forbids storage class specifiers in compound literals" } */ diff --git a/gcc/testsuite/gcc.dg/c11-complit-2.c b/gcc/testsuite/gcc.dg/c11-complit-2.c new file mode 100644 index 0000000..d4d1f16 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-complit-2.c @@ -0,0 +1,7 @@ +/* Test C2x storage class specifiers in compound literals not permitted for + C11. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic" } */ + +int *ps = &(static int) { 1 }; /* { dg-warning "forbids storage class specifiers in compound literals" } */ +int ss = sizeof (static int) { 1 }; /* { dg-warning "forbids storage class specifiers in compound literals" } */ diff --git a/gcc/testsuite/gcc.dg/c11-complit-3.c b/gcc/testsuite/gcc.dg/c11-complit-3.c new file mode 100644 index 0000000..a73a8ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-complit-3.c @@ -0,0 +1,7 @@ +/* Test C2x storage class specifiers in compound literals not permitted for + C11, but -Wno-c11-c2x-compat disables the -pedantic diagnostic for that. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors -Wno-c11-c2x-compat" } */ + +int *ps = &(static int) { 1 }; +int ss = sizeof (static int) { 1 }; diff --git a/gcc/testsuite/gcc.dg/c2x-complit-2.c b/gcc/testsuite/gcc.dg/c2x-complit-2.c new file mode 100644 index 0000000..dcca5e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-complit-2.c @@ -0,0 +1,48 @@ +/* Test C2x storage class specifiers in compound literals. */ +/* { dg-do run } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +#include <stddef.h> + +extern void abort (void); +extern void exit (int); + +/* static is OK (although redundant) at file scope. */ +int *ps = &(static int) { 1 }; +size_t ss = sizeof (static int) { 1 }; +int *psa = (static int [3]) { 1, 2, 3 }; + +int +main () +{ + if (ps[0] != 1) + abort (); + if (ss != sizeof (int)) + abort (); + if (psa[0] != 1 || psa[1] != 2 || psa[2] != 3) + abort (); + if ((register int) { 3 } != 3) + abort (); + /* A static compound literal, like a static variable, is initialized once, + but an automatic compound literal is initialized every time it is reached + in the order of execution. */ + int i = 0; + lab: + int *p = &(static int) { 0 }; + if (*p != i) + abort (); + i++; + *p = i; + if (i < 5) + goto lab; + i = 0; + lab2: + int *p2 = &(int) { 0 }; + if (*p2 != 0) + abort (); + i++; + *p2 = i; + if (i < 5) + goto lab2; + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/c2x-complit-3.c b/gcc/testsuite/gcc.dg/c2x-complit-3.c new file mode 100644 index 0000000..c672525 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-complit-3.c @@ -0,0 +1,24 @@ +/* Test C2x storage class specifiers in compound literals. Thread-local + cases, compilation tests. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ +/* { dg-require-effective-target tls } */ + +#include <stddef.h> + +/* thread_local is OK at file scope, although of limited use since the + thread-local object and its address are not constant expressions. */ +size_t st = sizeof (thread_local int) { 1 }; +size_t sst = sizeof (static thread_local int) { 1 }; + +int * +f () +{ + return &(static thread_local int) { 2 }; +} + +int * +g () +{ + return &(thread_local static int) { 3 }; +} diff --git a/gcc/testsuite/gcc.dg/c2x-complit-4.c b/gcc/testsuite/gcc.dg/c2x-complit-4.c new file mode 100644 index 0000000..31d7413 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-complit-4.c @@ -0,0 +1,60 @@ +/* Test C2x storage class specifiers in compound literals. Thread-local + cases, execution tests. */ +/* { dg-do run } */ +/* { dg-options "-pthread -std=gnu2x -pedantic-errors" } */ +/* { dg-require-effective-target pthread_h } */ +/* { dg-require-effective-target pthread } */ +/* { dg-require-effective-target tls_runtime } */ +/* { dg-add-options tls } */ + +#include <pthread.h> + +extern void abort (void); +extern void exit (int); + +int * +thread_addr () +{ + return (static thread_local int []) { 1, 2 }; +} + +int *volatile p, *volatile q, r; + +void * +thread_fn (void *) +{ + q = thread_addr (); + if (q[0] != 1 || q[1] != 2) + return NULL; + q[0] = 5; + q[1] = 6; + return &r; +} + +int +main () +{ + int i; + pthread_t tid; + void *ret; + p = thread_addr (); + if (p[0] != 1 || p[1] != 2) + abort (); + p[0] = 3; + p[1] = 4; + if (p != thread_addr ()) + abort (); + i = pthread_create (&tid, NULL, thread_fn, NULL); + if (p != thread_addr ()) + abort (); + i = pthread_join (tid, &ret); + if (i != 0) + abort (); + if (ret != &r) + abort (); + if (p != thread_addr ()) + abort (); + if (p[0] != 3 || p[1] != 4) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/c2x-complit-5.c b/gcc/testsuite/gcc.dg/c2x-complit-5.c new file mode 100644 index 0000000..1eb0f8d --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-complit-5.c @@ -0,0 +1,52 @@ +/* Test C2x storage class specifiers in compound literals: invalid code. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +int *p = &(register int) { 0 }; /* { dg-error "file-scope compound literal specifies" } */ + +int v; + +void +f () +{ + int *q = &(thread_local int) { 0 }; /* { dg-error "compound literal implicitly auto and declared" } */ + int *pc = &(static int) { v }; /* { dg-error "not constant" } */ + int *pt = &(static thread_local int) { v }; /* { dg-error "not constant" } */ + &(register int) { 0 }; /* { dg-error "address of register compound literal requested" } */ + struct s { int a, b; }; + &((register struct s) { 1, 2 }.b); /* { dg-error "address of register compound literal requested" } */ +} + +int *s = &(static static int) { 0 }; /* { dg-error "duplicate" } */ + +void +g () +{ + (void) (register register int) { 0 }; /* { dg-error "duplicate" } */ + (void) (static static int) { 0 }; /* { dg-error "duplicate" } */ + (void) (static thread_local thread_local int) { 0 }; /* { dg-error "duplicate" } */ + (void) (static register int) { 0 }; /* { dg-error "multiple storage classes in declaration specifiers" } */ + (void) (register static int) { 0 }; /* { dg-error "multiple storage classes in declaration specifiers" } */ + (void) (register thread_local int) { 0 }; /* { dg-error "used with" } */ + (void) (thread_local register int) { 0 }; /* { dg-error "used with" } */ +} + +void +h () +{ + /* The following cases are not part of the C2x syntax, but are detected + specially by the parser. */ + (static int) 0; /* { dg-error "storage class specifier in cast" } */ + sizeof (static int); /* { dg-error "storage class specifier in" } */ + alignof (static int); /* { dg-error "storage class specifier in" } */ +} + +void +bad_scspec () +{ + /* Storage class specifiers not permitted in compound literals result in a + syntax error. */ + (typedef int) { 0 }; /* { dg-error "expected" } */ + (auto int) { 0 }; /* { dg-error "expected" } */ + (extern int) { 0 }; /* { dg-error "expected" } */ +} diff --git a/gcc/testsuite/gcc.dg/c2x-complit-6.c b/gcc/testsuite/gcc.dg/c2x-complit-6.c new file mode 100644 index 0000000..23a0bb6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-complit-6.c @@ -0,0 +1,7 @@ +/* Test C2x storage class specifiers in compound literals diagnosed with + -Wc11-c2x-compat. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -Wc11-c2x-compat" } */ + +int *ps = &(static int) { 1 }; /* { dg-warning "forbids storage class specifiers in compound literals" } */ +int ss = sizeof (static int) { 1 }; /* { dg-warning "forbids storage class specifiers in compound literals" } */ diff --git a/gcc/testsuite/gcc.dg/c2x-complit-7.c b/gcc/testsuite/gcc.dg/c2x-complit-7.c new file mode 100644 index 0000000..0cd0b86 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-complit-7.c @@ -0,0 +1,7 @@ +/* Test C2x storage class specifiers in compound literals diagnosed with + -Wc11-c2x-compat, but not errors with -pedantic-errors. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -Wc11-c2x-compat -pedantic-errors" } */ + +int *ps = &(static int) { 1 }; /* { dg-warning "forbids storage class specifiers in compound literals" } */ +int ss = sizeof (static int) { 1 }; /* { dg-warning "forbids storage class specifiers in compound literals" } */ diff --git a/gcc/testsuite/gcc.dg/c90-complit-2.c b/gcc/testsuite/gcc.dg/c90-complit-2.c new file mode 100644 index 0000000..6fcf2a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-complit-2.c @@ -0,0 +1,8 @@ +/* Test C2x storage class specifiers in compound literals not permitted for + C90, but without a duplicate diagnostic, just the diagnostic for compound + literals not being permitted in C90 at all. */ +/* { dg-do compile } */ +/* { dg-options "-std=c90 -pedantic-errors" } */ + +int *ps = &(static int) { 1 }; /* { dg-error "ISO C90 forbids compound literals" } */ +int ss = sizeof (static int) { 1 }; /* { dg-error "ISO C90 forbids compound literals" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-ucnid-1-utf8.c b/gcc/testsuite/gcc.dg/cpp/c2x-ucnid-1-utf8.c new file mode 100644 index 0000000..55d2281 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c2x-ucnid-1-utf8.c @@ -0,0 +1,13 @@ +/* Test C2x (= Unicode) rules for characters in identifiers. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +¨ + +/* The requirement for NFC only applies in identifiers, not pp-numbers. */ + +À /* { dg-error "not in NFC" } */ +ÿÀ /* { dg-error "not in NFC" } */ + +0À /* { dg-warning "not in NFC" } */ +.1À /* { dg-warning "not in NFC" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/c2x-ucnid-1.c b/gcc/testsuite/gcc.dg/cpp/c2x-ucnid-1.c new file mode 100644 index 0000000..f9fdbea --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c2x-ucnid-1.c @@ -0,0 +1,13 @@ +/* Test C2x (= Unicode) rules for characters in identifiers. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +\u00A8 /* { dg-error "is not valid in an identifier" } */ + +/* The requirement for NFC only applies in identifiers, not pp-numbers. */ + +A\u0300 /* { dg-error "not in NFC" } */ +\u00ffA\u0300 /* { dg-error "not in NFC" } */ + +0A\u0300 /* { dg-warning "not in NFC" } */ +.1A\u0300 /* { dg-warning "not in NFC" } */ diff --git a/gcc/testsuite/gcc.dg/gnu2x-complit-1.c b/gcc/testsuite/gcc.dg/gnu2x-complit-1.c new file mode 100644 index 0000000..e9da5ad --- /dev/null +++ b/gcc/testsuite/gcc.dg/gnu2x-complit-1.c @@ -0,0 +1,7 @@ +/* Test C2x storage class specifiers in compound literals: GNU use of alignof + on objects (tested separately since alignof parsing handles the type name of + compound literals). */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu2x" } */ + +int a = alignof (static int) { 0 }; diff --git a/gcc/testsuite/gcc.dg/gnu2x-complit-2.c b/gcc/testsuite/gcc.dg/gnu2x-complit-2.c new file mode 100644 index 0000000..20cb38f --- /dev/null +++ b/gcc/testsuite/gcc.dg/gnu2x-complit-2.c @@ -0,0 +1,18 @@ +/* Test C2x storage class specifiers in compound literals. Thread-local + cases, compilation tests, GNU __thread used. */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu2x" } */ +/* { dg-require-effective-target tls } */ + +#include <stddef.h> + +/* __thread is OK at file scope, although of limited use since the + thread-local object and its address are not constant expressions. */ +size_t st = sizeof (__thread int) { 1 }; +size_t sst = sizeof (static __thread int) { 1 }; + +int * +f () +{ + return &(static __thread int) { 2 }; +} diff --git a/gcc/testsuite/gcc.dg/pr102540.c b/gcc/testsuite/gcc.dg/pr102540.c new file mode 100644 index 0000000..c12f8fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr102540.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-evrp" } */ + + +void kill(); + +static long a; +static unsigned b; +int test1 () { + long c, e; + c = b = a; + e = c ? 2 / (c + 1) : 0; + if (e && !b) + kill (); + a = 0; +} + +/* { dg-final { scan-tree-dump-not "kill" "evrp" } } */ + diff --git a/gcc/testsuite/gcc.dg/pr102872.c b/gcc/testsuite/gcc.dg/pr102872.c new file mode 100644 index 0000000..971bb03 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr102872.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ + +void foo(void); + +static int a, b; +int main() { + for (; a; ++a) { + unsigned short d = a; + if (!(b | d) && d) + foo(); + } +} + +/* { dg-final { scan-tree-dump-not "foo" "evrp" } } */ + diff --git a/gcc/testsuite/gcc.dg/torture/bfloat16-basic.c b/gcc/testsuite/gcc.dg/torture/bfloat16-basic.c new file mode 100644 index 0000000..09e54d4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bfloat16-basic.c @@ -0,0 +1,11 @@ +/* Test __bf16. */ +/* { dg-do run } */ +/* { dg-options "" } */ +/* { dg-add-options bfloat16 } */ +/* { dg-require-effective-target bfloat16_runtime } */ + +#define TYPE __bf16 +#define CST(C) CONCAT (C, bf16) +#define CSTU(C) CONCAT (C, BF16) + +#include "floatn-basic.h" diff --git a/gcc/testsuite/gcc.dg/torture/bfloat16-builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/bfloat16-builtin-issignaling-1.c new file mode 100644 index 0000000..0e428db --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bfloat16-builtin-issignaling-1.c @@ -0,0 +1,21 @@ +/* Test __bf16 __builtin_issignaling. */ +/* { dg-do run } */ +/* { dg-options "" } */ +/* { dg-add-options bfloat16 } */ +/* { dg-add-options ieee } */ +/* { dg-require-effective-target bfloat16_runtime } */ +/* { dg-additional-options "-fsignaling-nans" } */ +/* Workaround for PR57484 on ia32: */ +/* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */ + +#define CONCATX(X, Y) X ## Y +#define CONCAT(X, Y) CONCATX (X, Y) + +#define TYPE __bf16 +#define CST(C) CONCAT (C, bf16) +#define FN(F) CONCAT (F, f16b) +#define NAN(x) ((__bf16) __builtin_nanf (x)) +#define INF ((__bf16) __builtin_inff ()) +#define EXT 0 + +#include "builtin-issignaling-1.c" diff --git a/gcc/testsuite/gcc.dg/torture/bfloat16-builtin.c b/gcc/testsuite/gcc.dg/torture/bfloat16-builtin.c new file mode 100644 index 0000000..ce02f6f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bfloat16-builtin.c @@ -0,0 +1,47 @@ +/* Test __bf16 built-in functions. */ +/* { dg-do run } */ +/* { dg-options "" } */ +/* { dg-add-options bfloat16 } */ +/* { dg-add-options ieee } */ +/* { dg-require-effective-target bfloat16_runtime } */ + +extern void exit (int); +extern void abort (void); + +extern __bf16 test_type; +extern __typeof (__builtin_nansf16b ("")) test_type; + +volatile __bf16 inf_cst = (__bf16) __builtin_inff (); +volatile __bf16 huge_val_cst = (__bf16) __builtin_huge_valf (); +volatile __bf16 nan_cst = (__bf16) __builtin_nanf (""); +volatile __bf16 nans_cst = __builtin_nansf16b (""); +volatile __bf16 neg0 = -0.0bf16, neg1 = -1.0bf16, one = 1.0; + +int +main (void) +{ + volatile __bf16 r; + if (!__builtin_isinf (inf_cst)) + abort (); + if (!__builtin_isinf (huge_val_cst)) + abort (); + if (inf_cst != huge_val_cst) + abort (); + if (!__builtin_isnan (nan_cst)) + abort (); + if (!__builtin_isnan (nans_cst)) + abort (); + r = __builtin_fabsf (neg1); + if (r != 1.0bf16) + abort (); + r = __builtin_copysignf (one, neg0); + if (r != neg1) + abort (); + r = __builtin_copysignf (inf_cst, neg1); + if (r != -huge_val_cst) + abort (); + r = __builtin_copysignf (-inf_cst, one); + if (r != huge_val_cst) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/torture/bfloat16-complex.c b/gcc/testsuite/gcc.dg/torture/bfloat16-complex.c new file mode 100644 index 0000000..fa27a77 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bfloat16-complex.c @@ -0,0 +1,61 @@ +/* Test __bf16 complex arithmetic. */ +/* { dg-do run } */ +/* { dg-options "" } */ +/* { dg-add-options bfloat16 } */ +/* { dg-require-effective-target bfloat16_runtime } */ + +extern void exit (int); +extern void abort (void); + +volatile __bf16 a = 1.0bf16; +typedef _Complex float __cbf16 __attribute__((__mode__(__BC__))); +volatile __cbf16 b = __builtin_complex (2.0bf16, 3.0bf16); +volatile __cbf16 c = __builtin_complex (2.0bf16, 3.0bf16); +volatile __cbf16 d = __builtin_complex (2.0bf16, 3.0bf16); + +__cbf16 +fn (__cbf16 arg) +{ + return arg / 4; +} + +int +main (void) +{ + volatile __cbf16 r; + if (b != c) + abort (); + if (b != d) + abort (); + r = a + b; + if (__real__ r != 3.0bf16 || __imag__ r != 3.0bf16) + abort (); + r += d; + if (__real__ r != 5.0bf16 || __imag__ r != 6.0bf16) + abort (); + r -= a; + if (__real__ r != 4.0bf16 || __imag__ r != 6.0bf16) + abort (); + r /= (a + a); + if (__real__ r != 2.0bf16 || __imag__ r != 3.0bf16) + abort (); + r *= (a + a); + if (__real__ r != 4.0bf16 || __imag__ r != 6.0bf16) + abort (); + r -= b; + if (__real__ r != 2.0bf16 || __imag__ r != 3.0bf16) + abort (); + r *= r; + if (__real__ r != -5.0bf16 || __imag__ r != 12.0bf16) + abort (); + /* Division may not be exact, so round result before comparing. */ + r /= b; + r += __builtin_complex (100.0bf16, 100.0bf16); + r -= __builtin_complex (100.0bf16, 100.0bf16); + if (r != b) + abort (); + r = fn (r); + if (__real__ r != 0.5bf16 || __imag__ r != 0.75bf16) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/torture/builtin-issignaling-1.c b/gcc/testsuite/gcc.dg/torture/builtin-issignaling-1.c index fddca6c..60125b2 100644 --- a/gcc/testsuite/gcc.dg/torture/builtin-issignaling-1.c +++ b/gcc/testsuite/gcc.dg/torture/builtin-issignaling-1.c @@ -4,7 +4,7 @@ /* Workaround for PR57484 on ia32: */ /* { dg-additional-options "-msse2 -mfpmath=sse" { target { ia32 && sse2_runtime } } } */ -#ifndef EXT +#if !defined(EXT) && !defined(TYPE) int f1 (void) { @@ -41,31 +41,42 @@ f6 (long double x) return __builtin_issignaling (x); } #else -#define CONCATX(X, Y) X ## Y -#define CONCAT(X, Y) CONCATX (X, Y) -#define CONCAT3(X, Y, Z) CONCAT (CONCAT (X, Y), Z) -#define CONCAT4(W, X, Y, Z) CONCAT (CONCAT (CONCAT (W, X), Y), Z) +#ifndef TYPE +# define CONCATX(X, Y) X ## Y +# define CONCAT(X, Y) CONCATX (X, Y) +# define CONCAT3(X, Y, Z) CONCAT (CONCAT (X, Y), Z) +# define CONCAT4(W, X, Y, Z) CONCAT (CONCAT (CONCAT (W, X), Y), Z) -#if EXT -# define TYPE CONCAT3 (_Float, WIDTH, x) -# define CST(C) CONCAT4 (C, f, WIDTH, x) -# define FN(F) CONCAT4 (F, f, WIDTH, x) -#else -# define TYPE CONCAT (_Float, WIDTH) -# define CST(C) CONCAT3 (C, f, WIDTH) -# define FN(F) CONCAT3 (F, f, WIDTH) +# if EXT +# define TYPE CONCAT3 (_Float, WIDTH, x) +# define CST(C) CONCAT4 (C, f, WIDTH, x) +# define FN(F) CONCAT4 (F, f, WIDTH, x) +# else +# define TYPE CONCAT (_Float, WIDTH) +# define CST(C) CONCAT3 (C, f, WIDTH) +# define FN(F) CONCAT3 (F, f, WIDTH) +# endif +#endif +#ifndef NANS +# define NANS(x) FN (__builtin_nans) (x) +#endif +#ifndef NAN +# define NAN(x) FN (__builtin_nan) (x) +#endif +#ifndef INF +# define INF FN (__builtin_inf) () #endif int f1 (void) { - return __builtin_issignaling (FN (__builtin_nans) ("")); + return __builtin_issignaling (NANS ("")); } int f2 (void) { - return __builtin_issignaling (FN (__builtin_nan) ("")); + return __builtin_issignaling (NAN ("")); } int @@ -118,10 +129,10 @@ main () if (!f6 (z)) __builtin_abort (); #else - if (f4 (w) || !f4 (FN (__builtin_nans) ("0x123")) || f4 (CST (42.0)) || f4 (FN (__builtin_nan) ("0x234")) - || f4 (FN (__builtin_inf) ()) || f4 (-FN (__builtin_inf) ()) || f4 (CST (-42.0)) || f4 (CST (-0.0)) || f4 (CST (0.0))) + if (f4 (w) || !f4 (NANS ("0x123")) || f4 (CST (42.0)) || f4 (NAN ("0x234")) + || f4 (INF) || f4 (-INF) || f4 (CST (-42.0)) || f4 (CST (-0.0)) || f4 (CST (0.0))) __builtin_abort (); - w = FN (__builtin_nans) (""); + w = NANS (""); asm volatile ("" : : : "memory"); if (!f4 (w)) __builtin_abort (); diff --git a/gcc/testsuite/gcc.dg/torture/floatn-basic.h b/gcc/testsuite/gcc.dg/torture/floatn-basic.h index 9131f46..6540b53 100644 --- a/gcc/testsuite/gcc.dg/torture/floatn-basic.h +++ b/gcc/testsuite/gcc.dg/torture/floatn-basic.h @@ -9,14 +9,16 @@ #define CONCAT3(X, Y, Z) CONCAT (CONCAT (X, Y), Z) #define CONCAT4(W, X, Y, Z) CONCAT (CONCAT (CONCAT (W, X), Y), Z) -#if EXT -# define TYPE CONCAT3 (_Float, WIDTH, x) -# define CST(C) CONCAT4 (C, f, WIDTH, x) -# define CSTU(C) CONCAT4 (C, F, WIDTH, x) -#else -# define TYPE CONCAT (_Float, WIDTH) -# define CST(C) CONCAT3 (C, f, WIDTH) -# define CSTU(C) CONCAT3 (C, F, WIDTH) +#ifndef TYPE +# if EXT +# define TYPE CONCAT3 (_Float, WIDTH, x) +# define CST(C) CONCAT4 (C, f, WIDTH, x) +# define CSTU(C) CONCAT4 (C, F, WIDTH, x) +# else +# define TYPE CONCAT (_Float, WIDTH) +# define CST(C) CONCAT3 (C, f, WIDTH) +# define CSTU(C) CONCAT3 (C, F, WIDTH) +# endif #endif extern void exit (int); diff --git a/gcc/testsuite/gcc.dg/vect/pr107160.c b/gcc/testsuite/gcc.dg/vect/pr107160.c new file mode 100644 index 0000000..4f9f853c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr107160.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ + +#include <math.h> + +#define N 128 +float fl[N]; + +__attribute__ ((noipa)) void +init () +{ + for (int i = 0; i < N; i++) + fl[i] = i; +} + +__attribute__ ((noipa)) float +foo (int n1) +{ + float sum0, sum1, sum2, sum3; + sum0 = sum1 = sum2 = sum3 = 0.0f; + + int n = (n1 / 4) * 4; + for (int i = 0; i < n; i += 4) + { + sum0 += fabs (fl[i]); + sum1 += fabs (fl[i + 1]); + sum2 += fabs (fl[i + 2]); + sum3 += fabs (fl[i + 3]); + } + + return sum0 + sum1 + sum2 + sum3; +} + +int +main () +{ + init (); + float res = foo (80); + if (res != 3160) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.misc-tests/gcov-4.c b/gcc/testsuite/gcc.misc-tests/gcov-4.c index 9d8ab1c..da7929e 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-4.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-4.c @@ -110,6 +110,29 @@ lab2: return 8; /* count(1) */ } +int +test_goto3 (int i, int j) +{ + if (j) goto else_; /* count(1) */ + +top: + if (i) /* count(1) */ + { + i = do_something (i); + } + else + { +else_: /* count(1) */ + j = do_something (j); /* count(2) */ + if (j) /* count(2) */ + { + j = 0; /* count(1) */ + goto top; /* count(1) */ + } + } + return 16; +} + void call_goto () { @@ -117,6 +140,7 @@ call_goto () goto_val += test_goto1 (1); goto_val += test_goto2 (3); goto_val += test_goto2 (30); + goto_val += test_goto3 (0, 1); } /* Check nested if-then-else statements. */ @@ -221,7 +245,7 @@ test_switch (int i, int j) { case 1: result = do_something (2); /* count(1) */ - break; + break; /* count(1) */ case 2: result = do_something (1024); break; @@ -230,7 +254,7 @@ test_switch (int i, int j) if (j == 2) /* count(3) */ return do_something (4); /* count(1) */ result = do_something (8); /* count(2) */ - break; + break; /* count(2) */ default: result = do_something (32); /* count(1) */ switch_m++; /* count(1) */ @@ -260,7 +284,7 @@ main() call_unref (); if ((for_val1 != 12) || (for_val2 != 87) - || (goto_val != 15) + || (goto_val != 31) || (ifelse_val1 != 31) || (ifelse_val2 != 23) || (ifelse_val3 != 246) diff --git a/gcc/testsuite/gcc.target/aarch64/ands_2.c b/gcc/testsuite/gcc.target/aarch64/ands_2.c index b061b1d..c8763f2 100644 --- a/gcc/testsuite/gcc.target/aarch64/ands_2.c +++ b/gcc/testsuite/gcc.target/aarch64/ands_2.c @@ -8,8 +8,7 @@ ands_si_test1 (int a, int b, int c) { int d = a & b; - /* { dg-final { scan-assembler-not "ands\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" } } */ - /* { dg-final { scan-assembler-times "and\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" 2 } } */ + /* { dg-final { scan-assembler "ands\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" } } */ if (d <= 0) return a + c; else @@ -21,12 +20,11 @@ ands_si_test2 (int a, int b, int c) { int d = a & 0x99999999; - /* { dg-final { scan-assembler-not "ands\tw\[0-9\]+, w\[0-9\]+, -1717986919" } } */ - /* { dg-final { scan-assembler "and\tw\[0-9\]+, w\[0-9\]+, -1717986919" } } */ - if (d <= 0) - return a + c; - else + /* { dg-final { scan-assembler "ands\tw\[0-9\]+, w\[0-9\]+, -1717986919" } } */ + if (d > 0) return b + d + c; + else + return a + c; } int @@ -34,8 +32,7 @@ ands_si_test3 (int a, int b, int c) { int d = a & (b << 3); - /* { dg-final { scan-assembler-not "ands\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */ - /* { dg-final { scan-assembler "and\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */ + /* { dg-final { scan-assembler "ands\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */ if (d <= 0) return a + c; else @@ -49,8 +46,7 @@ ands_di_test1 (s64 a, s64 b, s64 c) { s64 d = a & b; - /* { dg-final { scan-assembler-not "ands\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" } } */ - /* { dg-final { scan-assembler-times "and\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 2 } } */ + /* { dg-final { scan-assembler "ands\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" } } */ if (d <= 0) return a + c; else @@ -62,12 +58,11 @@ ands_di_test2 (s64 a, s64 b, s64 c) { s64 d = a & 0xaaaaaaaaaaaaaaaall; - /* { dg-final { scan-assembler-not "ands\tx\[0-9\]+, x\[0-9\]+, -6148914691236517206" } } */ - /* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, -6148914691236517206" } } */ - if (d <= 0) - return a + c; - else + /* { dg-final { scan-assembler "ands\tx\[0-9\]+, x\[0-9\]+, -6148914691236517206" } } */ + if (d > 0) return b + d + c; + else + return a + c; } s64 @@ -75,8 +70,7 @@ ands_di_test3 (s64 a, s64 b, s64 c) { s64 d = a & (b << 3); - /* { dg-final { scan-assembler-not "ands\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */ - /* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */ + /* { dg-final { scan-assembler "ands\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */ if (d <= 0) return a + c; else diff --git a/gcc/testsuite/gcc.target/aarch64/bics_2.c b/gcc/testsuite/gcc.target/aarch64/bics_2.c index 9ccae36..c1f7e87 100644 --- a/gcc/testsuite/gcc.target/aarch64/bics_2.c +++ b/gcc/testsuite/gcc.target/aarch64/bics_2.c @@ -8,8 +8,7 @@ bics_si_test1 (int a, int b, int c) { int d = a & ~b; - /* { dg-final { scan-assembler-not "bics\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" } } */ - /* { dg-final { scan-assembler-times "bic\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" 2 } } */ + /* { dg-final { scan-assembler "bics\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" } } */ if (d <= 0) return a + c; else @@ -21,12 +20,11 @@ bics_si_test2 (int a, int b, int c) { int d = a & ~(b << 3); - /* { dg-final { scan-assembler-not "bics\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */ - /* { dg-final { scan-assembler "bic\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */ - if (d <= 0) - return a + c; - else + /* { dg-final { scan-assembler "bics\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */ + if (d > 0) return b + d + c; + else + return a + c; } typedef long long s64; @@ -36,8 +34,7 @@ bics_di_test1 (s64 a, s64 b, s64 c) { s64 d = a & ~b; - /* { dg-final { scan-assembler-not "bics\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" } } */ - /* { dg-final { scan-assembler-times "bic\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 2 } } */ + /* { dg-final { scan-assembler "bics\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" } } */ if (d <= 0) return a + c; else @@ -49,12 +46,11 @@ bics_di_test2 (s64 a, s64 b, s64 c) { s64 d = a & ~(b << 3); - /* { dg-final { scan-assembler-not "bics\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */ - /* { dg-final { scan-assembler "bic\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */ - if (d <= 0) - return a + c; - else + /* { dg-final { scan-assembler "bics\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */ + if (d > 0) return b + d + c; + else + return a + c; } int diff --git a/gcc/testsuite/gcc.target/aarch64/tst_2.c b/gcc/testsuite/gcc.target/aarch64/tst_2.c index c8b28fc..3c9bdfd 100644 --- a/gcc/testsuite/gcc.target/aarch64/tst_2.c +++ b/gcc/testsuite/gcc.target/aarch64/tst_2.c @@ -8,8 +8,7 @@ tst_si_test1 (int a, int b, int c) { int d = a & b; - /* { dg-final { scan-assembler-not "tst\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" } } */ - /* { dg-final { scan-assembler-times "and\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" 2 } } */ + /* { dg-final { scan-assembler "tst\tw\[0-9\]+, w\[0-9\]+" } } */ if (d <= 0) return 12; else @@ -21,12 +20,11 @@ tst_si_test2 (int a, int b, int c) { int d = a & 0x99999999; - /* { dg-final { scan-assembler-not "tst\tw\[0-9\]+, w\[0-9\]+, -1717986919" } } */ - /* { dg-final { scan-assembler "and\tw\[0-9\]+, w\[0-9\]+, -1717986919" } } */ - if (d <= 0) - return 12; - else + /* { dg-final { scan-assembler "tst\tw\[0-9\]+, -1717986919" } } */ + if (d > 0) return 18; + else + return 12; } int @@ -34,8 +32,7 @@ tst_si_test3 (int a, int b, int c) { int d = a & (b << 3); - /* { dg-final { scan-assembler-not "tst\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */ - /* { dg-final { scan-assembler "and\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */ + /* { dg-final { scan-assembler "tst\tw\[0-9\]+, w\[0-9\]+, lsl 3" } } */ if (d <= 0) return 12; else @@ -49,8 +46,7 @@ tst_di_test1 (s64 a, s64 b, s64 c) { s64 d = a & b; - /* { dg-final { scan-assembler-not "tst\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" } } */ - /* { dg-final { scan-assembler-times "and\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 2 } } */ + /* { dg-final { scan-assembler "tst\tx\[0-9\]+, x\[0-9\]+" } } */ if (d <= 0) return 12; else @@ -62,8 +58,7 @@ tst_di_test2 (s64 a, s64 b, s64 c) { s64 d = a & 0xaaaaaaaaaaaaaaaall; - /* { dg-final { scan-assembler-not "tst\tx\[0-9\]+, x\[0-9\]+, -6148914691236517206" } } */ - /* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, -6148914691236517206" } } */ + /* { dg-final { scan-assembler "tst\tx\[0-9\]+, -6148914691236517206" } } */ if (d <= 0) return 12; else @@ -75,12 +70,11 @@ tst_di_test3 (s64 a, s64 b, s64 c) { s64 d = a & (b << 3); - /* { dg-final { scan-assembler-not "tst\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */ - /* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */ - if (d <= 0) - return 12; - else + /* { dg-final { scan-assembler "tst\tx\[0-9\]+, x\[0-9\]+, lsl 3" } } */ + if (d > 0) return 18; + else + return 12; } int diff --git a/gcc/testsuite/gcc.target/aarch64/tst_imm_split_1.c b/gcc/testsuite/gcc.target/aarch64/tst_imm_split_1.c index 33a2c0f..e456e82 100644 --- a/gcc/testsuite/gcc.target/aarch64/tst_imm_split_1.c +++ b/gcc/testsuite/gcc.target/aarch64/tst_imm_split_1.c @@ -14,5 +14,4 @@ g (unsigned char *p) } /* { dg-final { scan-assembler-not "and\\t\[xw\]\[0-9\]+, \[xw\]\[0-9\]+.*" } } */ -/* { dg-final { scan-assembler "tst\\t\[xw\]\[0-9\]+, \[xw\]\[0-9\]+" } } */ -/* { dg-final { scan-assembler "tst\\t\[xw\]\[0-9\]+, \[xw\]\[0-9\]+, lsr 4" } } */ +/* { dg-final { scan-assembler-times "tst\\t\[xw\]\[0-9\]+, \[xw\]\[0-9\]+" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/excess-precision-1.c b/gcc/testsuite/gcc.target/i386/excess-precision-1.c index 1bd3b88..388cee7 100644 --- a/gcc/testsuite/gcc.target/i386/excess-precision-1.c +++ b/gcc/testsuite/gcc.target/i386/excess-precision-1.c @@ -5,8 +5,14 @@ #include <float.h> +#ifdef __cplusplus +extern "C" { +#endif extern void abort (void); extern void exit (int); +#ifdef __cplusplus +} +#endif volatile float f1 = 1.0f; volatile float f2 = 0x1.0p-30f; diff --git a/gcc/testsuite/gcc.target/i386/excess-precision-10.c b/gcc/testsuite/gcc.target/i386/excess-precision-10.c index f1b9b7e..1dd3e7a 100644 --- a/gcc/testsuite/gcc.target/i386/excess-precision-10.c +++ b/gcc/testsuite/gcc.target/i386/excess-precision-10.c @@ -3,8 +3,14 @@ /* { dg-do run } */ /* { dg-options "-std=c11 -mfpmath=387 -fexcess-precision=standard" } */ +#ifdef __cplusplus +extern "C" { +#endif extern void abort (void); extern void exit (int); +#ifdef __cplusplus +} +#endif int main (void) diff --git a/gcc/testsuite/gcc.target/i386/excess-precision-2.c b/gcc/testsuite/gcc.target/i386/excess-precision-2.c index b5035e5..c14784e 100644 --- a/gcc/testsuite/gcc.target/i386/excess-precision-2.c +++ b/gcc/testsuite/gcc.target/i386/excess-precision-2.c @@ -4,8 +4,14 @@ #include <float.h> +#ifdef __cplusplus +extern "C" { +#endif extern void abort (void); extern void exit (int); +#ifdef __cplusplus +} +#endif volatile long double ldadd1 = 1.0l + 0x1.0p-30l; volatile long double ld11f = 1.1f; diff --git a/gcc/testsuite/gcc.target/i386/excess-precision-3.c b/gcc/testsuite/gcc.target/i386/excess-precision-3.c index 1fd038a..e8e9abc 100644 --- a/gcc/testsuite/gcc.target/i386/excess-precision-3.c +++ b/gcc/testsuite/gcc.target/i386/excess-precision-3.c @@ -6,8 +6,14 @@ #include <float.h> #include <stdarg.h> +#ifdef __cplusplus +extern "C" { +#endif extern void abort (void); extern void exit (int); +#ifdef __cplusplus +} +#endif volatile float f1 = 1.0f; volatile float f2 = 0x1.0p-30f; @@ -100,6 +106,7 @@ check_double (double d) abort (); } +#ifndef __cplusplus static inline void check_float_nonproto (f) float f; @@ -115,6 +122,7 @@ check_double_nonproto (d) if (d != dadd2) abort (); } +#endif static void check_double_va (int i, ...) @@ -132,9 +140,11 @@ test_call (void) check_float (f1 + f2); check_double (d1 + d2 + d3); check_double (f1 + f2 + f3); +#ifndef __cplusplus check_float_nonproto (f1 + f2); check_double_nonproto (d1 + d2 + d3); check_double_nonproto (f1 + f2 + f3); +#endif check_double_va (0, d1 + d2 + d3); check_double_va (0, f1 + f2 + f3); } diff --git a/gcc/testsuite/gcc.target/i386/excess-precision-7.c b/gcc/testsuite/gcc.target/i386/excess-precision-7.c index 0cdd932..4c3b950 100644 --- a/gcc/testsuite/gcc.target/i386/excess-precision-7.c +++ b/gcc/testsuite/gcc.target/i386/excess-precision-7.c @@ -4,8 +4,14 @@ /* { dg-do run } */ /* { dg-options "-std=c99 -mfpmath=387 -fexcess-precision=standard" } */ +#ifdef __cplusplus +extern "C" { +#endif extern void abort (void); extern void exit (int); +#ifdef __cplusplus +} +#endif int main (void) diff --git a/gcc/testsuite/gcc.target/i386/excess-precision-8.c b/gcc/testsuite/gcc.target/i386/excess-precision-8.c index c0a31ed..8dd0458 100644 --- a/gcc/testsuite/gcc.target/i386/excess-precision-8.c +++ b/gcc/testsuite/gcc.target/i386/excess-precision-8.c @@ -4,8 +4,14 @@ /* { dg-do run } */ /* { dg-options "-std=c11 -mfpmath=387 -fexcess-precision=standard" } */ +#ifdef __cplusplus +extern "C" { +#endif extern void abort (void); extern void exit (int); +#ifdef __cplusplus +} +#endif int main (void) diff --git a/gcc/testsuite/gcc.target/i386/excess-precision-9.c b/gcc/testsuite/gcc.target/i386/excess-precision-9.c index 61e5fc1..5008164 100644 --- a/gcc/testsuite/gcc.target/i386/excess-precision-9.c +++ b/gcc/testsuite/gcc.target/i386/excess-precision-9.c @@ -3,8 +3,14 @@ /* { dg-do run } */ /* { dg-options "-std=c99 -mfpmath=387 -fexcess-precision=standard" } */ +#ifdef __cplusplus +extern "C" { +#endif extern void abort (void); extern void exit (int); +#ifdef __cplusplus +} +#endif int main (void) diff --git a/gcc/testsuite/gcc.target/i386/sse2-bfloat16-scalar-typecheck.c b/gcc/testsuite/gcc.target/i386/sse2-bfloat16-scalar-typecheck.c index 52b53b9..d1a76db 100644 --- a/gcc/testsuite/gcc.target/i386/sse2-bfloat16-scalar-typecheck.c +++ b/gcc/testsuite/gcc.target/i386/sse2-bfloat16-scalar-typecheck.c @@ -12,8 +12,8 @@ double is_a_double; float *float_ptr; -__bf16 foo1 (void) { return (__bf16) 0x1234; } /* { dg-error {invalid conversion to type '__bf16'} } */ -__bf16 foo2 (void) { return (__bf16) (short) 0x1234; } /* { dg-error {invalid conversion to type '__bf16'} } */ +__bf16 foo1 (void) { return (__bf16) 0x1234; } +__bf16 foo2 (void) { return (__bf16) (short) 0x1234; } __bf16 footest (__bf16 scalar0) { @@ -22,87 +22,87 @@ __bf16 footest (__bf16 scalar0) __bf16 scalar1_1; __bf16 scalar1_2 = glob_bfloat; - __bf16 scalar1_3 = 0; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar1_4 = 0.1; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar1_5 = is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar1_6 = is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar1_7 = is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar1_8 = is_a_double; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar1_9 = is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */ - - int initi_1_1 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - float initi_1_2 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - _Float16 initi_1_3 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - short initi_1_4 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - double initi_1_5 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ + __bf16 scalar1_3 = 0; + __bf16 scalar1_4 = 0.1; + __bf16 scalar1_5 = is_a_float; + __bf16 scalar1_6 = is_an_int; + __bf16 scalar1_7 = is_a_float16; + __bf16 scalar1_8 = is_a_double; + __bf16 scalar1_9 = is_a_short_int; + + int initi_1_1 = glob_bfloat; + float initi_1_2 = glob_bfloat; + _Float16 initi_1_3 = glob_bfloat; + short initi_1_4 = glob_bfloat; + double initi_1_5 = glob_bfloat; __bf16 scalar2_1 = {}; __bf16 scalar2_2 = { glob_bfloat }; - __bf16 scalar2_3 = { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar2_4 = { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar2_5 = { is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar2_6 = { is_an_int }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar2_7 = { is_a_float16 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar2_8 = { is_a_double }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __bf16 scalar2_9 = { is_a_short_int }; /* { dg-error {invalid conversion to type '__bf16'} } */ - - int initi_2_1 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - float initi_2_2 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - _Float16 initi_2_3 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - short initi_2_4 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - double initi_2_5 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ + __bf16 scalar2_3 = { 0 }; + __bf16 scalar2_4 = { 0.1 }; + __bf16 scalar2_5 = { is_a_float }; + __bf16 scalar2_6 = { is_an_int }; + __bf16 scalar2_7 = { is_a_float16 }; + __bf16 scalar2_8 = { is_a_double }; + __bf16 scalar2_9 = { is_a_short_int }; + + int initi_2_1 = { glob_bfloat }; + float initi_2_2 = { glob_bfloat }; + _Float16 initi_2_3 = { glob_bfloat }; + short initi_2_4 = { glob_bfloat }; + double initi_2_5 = { glob_bfloat }; /* Assignments. */ glob_bfloat = glob_bfloat; - glob_bfloat = 0; /* { dg-error {invalid conversion to type '__bf16'} } */ - glob_bfloat = 0.1; /* { dg-error {invalid conversion to type '__bf16'} } */ - glob_bfloat = is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */ - glob_bfloat = is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */ - glob_bfloat = is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */ - glob_bfloat = is_a_double; /* { dg-error {invalid conversion to type '__bf16'} } */ - glob_bfloat = is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */ - - is_an_int = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_float = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_float16 = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_double = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_short_int = glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ + glob_bfloat = 0; + glob_bfloat = 0.1; + glob_bfloat = is_a_float; + glob_bfloat = is_an_int; + glob_bfloat = is_a_float16; + glob_bfloat = is_a_double; + glob_bfloat = is_a_short_int; + + is_an_int = glob_bfloat; + is_a_float = glob_bfloat; + is_a_float16 = glob_bfloat; + is_a_double = glob_bfloat; + is_a_short_int = glob_bfloat; /* Casting. */ (void) glob_bfloat; (__bf16) glob_bfloat; - (int) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - (float) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - (_Float16) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - (double) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ - (short) glob_bfloat; /* { dg-error {invalid conversion from type '__bf16'} } */ + (int) glob_bfloat; + (float) glob_bfloat; + (_Float16) glob_bfloat; + (double) glob_bfloat; + (short) glob_bfloat; - (__bf16) is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) is_a_double; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */ + (__bf16) is_an_int; + (__bf16) is_a_float; + (__bf16) is_a_float16; + (__bf16) is_a_double; + (__bf16) is_a_short_int; /* Compound literals. */ (__bf16) {}; (__bf16) { glob_bfloat }; - (__bf16) { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) { is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) { is_an_int }; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) { is_a_float16 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) { is_a_double }; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__bf16) { is_a_short_int }; /* { dg-error {invalid conversion to type '__bf16'} } */ - - (int) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - (float) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - (_Float16) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - (double) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - (short) { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ + (__bf16) { 0 }; + (__bf16) { 0.1 }; + (__bf16) { is_a_float }; + (__bf16) { is_an_int }; + (__bf16) { is_a_float16 }; + (__bf16) { is_a_double }; + (__bf16) { is_a_short_int }; + + (int) { glob_bfloat }; + (float) { glob_bfloat }; + (_Float16) { glob_bfloat }; + (double) { glob_bfloat }; + (short) { glob_bfloat }; /* Arrays and Structs. */ @@ -145,16 +145,16 @@ __bf16 footest (__bf16 scalar0) bfloat_ptr = &bfloat_ptr3[1]; /* Simple comparison. */ - scalar0 > glob_bfloat; /* { dg-error {operation not permitted on type '__bf16'} } */ - glob_bfloat == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 > is_a_float; /* { dg-error {operation not permitted on type '__bf16'} } */ - is_a_float == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 > 0; /* { dg-error {operation not permitted on type '__bf16'} } */ - 0 == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 > 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */ - 0.1 == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 > is_an_int; /* { dg-error {operation not permitted on type '__bf16'} } */ - is_an_int == scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ + scalar0 > glob_bfloat; + glob_bfloat == scalar0; + scalar0 > is_a_float; + is_a_float == scalar0; + scalar0 > 0; + 0 == scalar0; + scalar0 > 0.1; + 0.1 == scalar0; + scalar0 > is_an_int; + is_an_int == scalar0; /* Pointer comparison. */ @@ -174,41 +174,41 @@ __bf16 footest (__bf16 scalar0) /* Conditional expressions. */ 0 ? scalar0 : scalar0; - 0 ? scalar0 : is_a_float; /* { dg-error {invalid conversion from type '__bf16'} } */ - 0 ? is_a_float : scalar0; /* { dg-error {invalid conversion from type '__bf16'} } */ - 0 ? scalar0 : 0; /* { dg-error {invalid conversion to type '__bf16'} } */ - 0 ? 0 : scalar0; /* { dg-error {invalid conversion to type '__bf16'} } */ - 0 ? 0.1 : scalar0; /* { dg-error {invalid conversion from type '__bf16'} } */ - 0 ? scalar0 : 0.1; /* { dg-error {invalid conversion from type '__bf16'} } */ + 0 ? scalar0 : is_a_float; + 0 ? is_a_float : scalar0; + 0 ? scalar0 : 0; + 0 ? 0 : scalar0; + 0 ? 0.1 : scalar0; + 0 ? scalar0 : 0.1; 0 ? bfloat_ptr : bfloat_ptr2; 0 ? bfloat_ptr : float_ptr; /* { dg-warning {pointer type mismatch in conditional expression} } */ 0 ? float_ptr : bfloat_ptr; /* { dg-warning {pointer type mismatch in conditional expression} } */ - scalar0 ? scalar0 : scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 ? is_a_float : scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 ? scalar0 : is_a_float; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 ? is_a_float : is_a_float; /* { dg-error {operation not permitted on type '__bf16'} } */ + scalar0 ? scalar0 : scalar0; + scalar0 ? is_a_float : scalar0; + scalar0 ? scalar0 : is_a_float; + scalar0 ? is_a_float : is_a_float; /* Unary operators. */ - +scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - -scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - ~scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - !scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ + +scalar0; + -scalar0; + ~scalar0; /* { dg-error {wrong type argument to bit-complement} } */ + !scalar0; *scalar0; /* { dg-error {invalid type argument of unary '\*'} } */ - __real scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - __imag scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - ++scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - --scalar0; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0++; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0--; /* { dg-error {operation not permitted on type '__bf16'} } */ + __real scalar0; + __imag scalar0; + ++scalar0; + --scalar0; + scalar0++; + scalar0--; /* Binary arithmetic operations. */ - scalar0 = glob_bfloat + *bfloat_ptr; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 = glob_bfloat + 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 = glob_bfloat + 0; /* { dg-error {operation not permitted on type '__bf16'} } */ - scalar0 = glob_bfloat + is_a_float; /* { dg-error {operation not permitted on type '__bf16'} } */ + scalar0 = glob_bfloat + *bfloat_ptr; + scalar0 = glob_bfloat + 0.1; + scalar0 = glob_bfloat + 0; + scalar0 = glob_bfloat + is_a_float; return scalar0; } diff --git a/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_1.c b/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_1.c index 3804bac..8bc3f4a 100644 --- a/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_1.c +++ b/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_1.c @@ -48,20 +48,20 @@ __m128bf16 footest (__m128bf16 vector0) __m128bf16 vector2_1 = {}; __m128bf16 vector2_2 = { glob_bfloat }; __m128bf16 vector2_3 = { glob_bfloat, glob_bfloat, glob_bfloat, glob_bfloat }; - __m128bf16 vector2_4 = { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m128bf16 vector2_5 = { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m128bf16 vector2_6 = { is_a_float16 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m128bf16 vector2_7 = { is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m128bf16 vector2_8 = { is_an_int }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m128bf16 vector2_9 = { is_a_short_int }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m128bf16 vector2_10 = { 0.0, 0, is_a_short_int, is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */ - - __v8si initi_2_1 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - __m256 initi_2_2 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - __m128h initi_2_3 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - __m128 initi_2_4 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - __v4si initi_2_5 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - __v4hi initi_2_6 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ + __m128bf16 vector2_4 = { 0 }; + __m128bf16 vector2_5 = { 0.1 }; + __m128bf16 vector2_6 = { is_a_float16 }; + __m128bf16 vector2_7 = { is_a_float }; + __m128bf16 vector2_8 = { is_an_int }; + __m128bf16 vector2_9 = { is_a_short_int }; + __m128bf16 vector2_10 = { 0.0, 0, is_a_short_int, is_a_float }; + + __v8si initi_2_1 = { glob_bfloat }; + __m256 initi_2_2 = { glob_bfloat }; + __m128h initi_2_3 = { glob_bfloat }; + __m128 initi_2_4 = { glob_bfloat }; + __v4si initi_2_5 = { glob_bfloat }; + __v4hi initi_2_6 = { glob_bfloat }; /* Assignments to/from vectors. */ @@ -85,25 +85,25 @@ __m128bf16 footest (__m128bf16 vector0) /* Assignments to/from elements. */ vector2_3[0] = glob_bfloat; - vector2_3[0] = is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = 0; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = 0.1; /* { dg-error {invalid conversion to type '__bf16'} } */ + vector2_3[0] = is_an_int; + vector2_3[0] = is_a_short_int; + vector2_3[0] = is_a_float; + vector2_3[0] = is_a_float16; + vector2_3[0] = 0; + vector2_3[0] = 0.1; glob_bfloat = vector2_3[0]; - is_an_int = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_short_int = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_float = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_float16 = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */ + is_an_int = vector2_3[0]; + is_a_short_int = vector2_3[0]; + is_a_float = vector2_3[0]; + is_a_float16 = vector2_3[0]; /* Compound literals. */ (__m128bf16) {}; - (__m128bf16) { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__m128bf16) { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */ + (__m128bf16) { 0 }; + (__m128bf16) { 0.1 }; (__m128bf16) { is_a_float_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m256'} } */ (__m128bf16) { is_an_int_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__v8si'} } */ (__m128bf16) { is_a_float_pair }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m128'} } */ @@ -186,16 +186,16 @@ __m128bf16 footest (__m128bf16 vector0) bfloat_ptr = &bfloat_ptr3[1]; /* Simple comparison. */ - vector0 > glob_bfloat_vec; /* { dg-error {operation not permitted on type '__bf16'} } */ - glob_bfloat_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 > is_a_float_vec; /* { dg-error {operation not permitted on type '__bf16'} } */ - is_a_float_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 > 0; /* { dg-error {operation not permitted on type '__bf16'} } */ - 0 == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 > 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */ - 0.1 == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 > is_an_int_vec; /* { dg-error {operation not permitted on type '__bf16'} } */ - is_an_int_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ + vector0 > glob_bfloat_vec; + glob_bfloat_vec == vector0; + vector0 > is_a_float_vec; /* { dg-error {comparing vectors with different element types} } */ + is_a_float_vec == vector0; /* { dg-error {comparing vectors with different element types} } */ + vector0 > 0; + 0 == vector0; + vector0 > 0.1; /* { dg-error {conversion of scalar 'double' to vector '__m128bf16'} } */ + 0.1 == vector0; /* { dg-error {conversion of scalar 'double' to vector '__m128bf16'} } */ + vector0 > is_an_int_vec; /* { dg-error {comparing vectors with different element types} } */ + is_an_int_vec == vector0; /* { dg-error {comparing vectors with different element types} } */ /* Pointer comparison. */ @@ -234,24 +234,24 @@ __m128bf16 footest (__m128bf16 vector0) /* Unary operators. */ - +vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - -vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - ~vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - !vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ + +vector0; + -vector0; + ~vector0; /* { dg-error {wrong type argument to bit-complement} } */ + !vector0; /* { dg-error {wrong type argument to unary exclamation mark} } */ *vector0; /* { dg-error {invalid type argument of unary '\*'} } */ - __real vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - __imag vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - ++vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - --vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0++; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0--; /* { dg-error {operation not permitted on type '__bf16'} } */ + __real vector0; /* { dg-error {wrong type argument to __real} } */ + __imag vector0; /* { dg-error {wrong type argument to __imag} } */ + ++vector0; + --vector0; + vector0++; + vector0--; /* Binary arithmetic operations. */ - vector0 = glob_bfloat_vec + *bfloat_ptr; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 = glob_bfloat_vec + 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 = glob_bfloat_vec + 0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 = glob_bfloat_vec + is_a_float_vec; /* { dg-error {operation not permitted on type '__bf16'} } */ + vector0 = glob_bfloat_vec + *bfloat_ptr; + vector0 = glob_bfloat_vec + 0.1; /* { dg-error {conversion of scalar 'double' to vector '__m128bf16'} } */ + vector0 = glob_bfloat_vec + 0; + vector0 = glob_bfloat_vec + is_a_float_vec; /* { dg-error {invalid operands to binary \+} } */ return vector0; } diff --git a/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_2.c b/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_2.c index f63b41d8..2a8a535 100644 --- a/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_2.c +++ b/gcc/testsuite/gcc.target/i386/vect-bfloat16-typecheck_2.c @@ -45,19 +45,19 @@ __m256bf16 footest (__m256bf16 vector0) __m256bf16 vector2_1 = {}; __m256bf16 vector2_2 = { glob_bfloat }; __m256bf16 vector2_3 = { glob_bfloat, glob_bfloat, glob_bfloat, glob_bfloat }; - __m256bf16 vector2_4 = { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m256bf16 vector2_5 = { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m256bf16 vector2_6 = { is_a_float16 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m256bf16 vector2_7 = { is_a_float }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m256bf16 vector2_8 = { is_an_int }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m256bf16 vector2_9 = { is_a_short_int }; /* { dg-error {invalid conversion to type '__bf16'} } */ - __m256bf16 vector2_10 = { 0.0, 0, is_a_short_int, is_a_float }; /* { dg-error "invalid conversion to type '__bf16'" } */ - - __v8si initi_2_1 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - __m256 initi_2_2 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - __m256h initi_2_3 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - __m256i initi_2_5 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ - __v16hi initi_2_6 = { glob_bfloat }; /* { dg-error {invalid conversion from type '__bf16'} } */ + __m256bf16 vector2_4 = { 0 }; + __m256bf16 vector2_5 = { 0.1 }; + __m256bf16 vector2_6 = { is_a_float16 }; + __m256bf16 vector2_7 = { is_a_float }; + __m256bf16 vector2_8 = { is_an_int }; + __m256bf16 vector2_9 = { is_a_short_int }; + __m256bf16 vector2_10 = { 0.0, 0, is_a_short_int, is_a_float }; + + __v8si initi_2_1 = { glob_bfloat }; + __m256 initi_2_2 = { glob_bfloat }; + __m256h initi_2_3 = { glob_bfloat }; + __m256i initi_2_5 = { glob_bfloat }; + __v16hi initi_2_6 = { glob_bfloat }; /* Assignments to/from vectors. */ @@ -79,25 +79,25 @@ __m256bf16 footest (__m256bf16 vector0) /* Assignments to/from elements. */ vector2_3[0] = glob_bfloat; - vector2_3[0] = is_an_int; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = is_a_short_int; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = is_a_float; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = is_a_float16; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = 0; /* { dg-error {invalid conversion to type '__bf16'} } */ - vector2_3[0] = 0.1; /* { dg-error {invalid conversion to type '__bf16'} } */ + vector2_3[0] = is_an_int; + vector2_3[0] = is_a_short_int; + vector2_3[0] = is_a_float; + vector2_3[0] = is_a_float16; + vector2_3[0] = 0; + vector2_3[0] = 0.1; glob_bfloat = vector2_3[0]; - is_an_int = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_short_int = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_float = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */ - is_a_float16 = vector2_3[0]; /* { dg-error {invalid conversion from type '__bf16'} } */ + is_an_int = vector2_3[0]; + is_a_short_int = vector2_3[0]; + is_a_float = vector2_3[0]; + is_a_float16 = vector2_3[0]; /* Compound literals. */ (__m256bf16) {}; - (__m256bf16) { 0 }; /* { dg-error {invalid conversion to type '__bf16'} } */ - (__m256bf16) { 0.1 }; /* { dg-error {invalid conversion to type '__bf16'} } */ + (__m256bf16) { 0 }; + (__m256bf16) { 0.1 }; (__m256bf16) { is_a_float_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m256'} } */ (__m256bf16) { is_an_int_vec }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__v8si'} } */ (__m256bf16) { is_a_long_int_pair }; /* { dg-error {incompatible types when initializing type '__bf16' using type '__m256i'} } */ @@ -176,16 +176,16 @@ __m256bf16 footest (__m256bf16 vector0) bfloat_ptr = &bfloat_ptr3[1]; /* Simple comparison. */ - vector0 > glob_bfloat_vec; /* { dg-error {operation not permitted on type '__bf16'} } */ - glob_bfloat_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 > is_a_float_vec; /* { dg-error {operation not permitted on type '__bf16'} } */ - is_a_float_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 > 0; /* { dg-error {operation not permitted on type '__bf16'} } */ - 0 == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 > 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */ - 0.1 == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 > is_an_int_vec; /* { dg-error {operation not permitted on type '__bf16'} } */ - is_an_int_vec == vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ + vector0 > glob_bfloat_vec; + glob_bfloat_vec == vector0; + vector0 > is_a_float_vec; /* { dg-error {comparing vectors with different element types} } */ + is_a_float_vec == vector0; /* { dg-error {comparing vectors with different element types} } */ + vector0 > 0; + 0 == vector0; + vector0 > 0.1; /* { dg-error {conversion of scalar 'double' to vector '__m256bf16'} } */ + 0.1 == vector0; /* { dg-error {conversion of scalar 'double' to vector '__m256bf16'} } */ + vector0 > is_an_int_vec; /* { dg-error {comparing vectors with different element types} } */ + is_an_int_vec == vector0; /* { dg-error {comparing vectors with different element types} } */ /* Pointer comparison. */ @@ -224,24 +224,24 @@ __m256bf16 footest (__m256bf16 vector0) /* Unary operators. */ - +vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - -vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - ~vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - !vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ + +vector0; + -vector0; + ~vector0; /* { dg-error {wrong type argument to bit-complement} } */ + !vector0; /* { dg-error {wrong type argument to unary exclamation mark} } */ *vector0; /* { dg-error {invalid type argument of unary '\*'} } */ - __real vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - __imag vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - ++vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - --vector0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0++; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0--; /* { dg-error {operation not permitted on type '__bf16'} } */ + __real vector0; /* { dg-error {wrong type argument to __real} } */ + __imag vector0; /* { dg-error {wrong type argument to __imag} } */ + ++vector0; + --vector0; + vector0++; + vector0--; /* Binary arithmetic operations. */ - vector0 = glob_bfloat_vec + *bfloat_ptr; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 = glob_bfloat_vec + 0.1; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 = glob_bfloat_vec + 0; /* { dg-error {operation not permitted on type '__bf16'} } */ - vector0 = glob_bfloat_vec + is_a_float_vec; /* { dg-error {operation not permitted on type '__bf16'} } */ + vector0 = glob_bfloat_vec + *bfloat_ptr; + vector0 = glob_bfloat_vec + 0.1; /* { dg-error {conversion of scalar 'double' to vector '__m256bf16'} } */ + vector0 = glob_bfloat_vec + 0; + vector0 = glob_bfloat_vec + is_a_float_vec; /* { dg-error {invalid operands to binary \+} } */ return vector0; } diff --git a/gcc/testsuite/gfortran.dg/analyzer/pr107210.f90 b/gcc/testsuite/gfortran.dg/analyzer/pr107210.f90 new file mode 100644 index 0000000..6132db4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/analyzer/pr107210.f90 @@ -0,0 +1,16 @@ +! { dg-additional-options "-O1" } + +subroutine check_int (j) + INTEGER(4) :: i, ia(5), ib(5,4), ip, ipa(:) + target :: ib + POINTER :: ip, ipa + logical :: l(5) + + ipa=>ib(2:3,1) + + l = (/ sizeof(i) == 4, sizeof(ia) == 20, sizeof(ib) == 80, & + sizeof(ip) == 4, sizeof(ipa) == 8 /) + + if (any(.not.l)) STOP 4 + +end subroutine check_int diff --git a/gcc/testsuite/gfortran.dg/c-interop/deferred-character-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/deferred-character-2.f90 index 356097a..4dab326 100644 --- a/gcc/testsuite/gfortran.dg/c-interop/deferred-character-2.f90 +++ b/gcc/testsuite/gfortran.dg/c-interop/deferred-character-2.f90 @@ -1,5 +1,5 @@ ! PR 92482 -! { dg-do execute} +! { dg-do run } ! ! TS 29113 ! 8.7 Interoperability of procedures and procedure interfaces diff --git a/gcc/testsuite/gfortran.dg/der_io_5.f90 b/gcc/testsuite/gfortran.dg/der_io_5.f90 new file mode 100644 index 0000000..193916c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/der_io_5.f90 @@ -0,0 +1,17 @@ +! { dg-do compile } +! PR fortran/100971 - ICE: Bad IO basetype (7) +! Contributed by G.Steinmetz + +program p + implicit none + type t + end type + class(t), allocatable :: a, b(:) + type(t) :: x, y(1) + integer :: i + allocate (a,b(1)) + print *, [a] ! { dg-error "Data transfer element at .1. cannot be polymorphic" } + print *, [(b(i),i=1,1)] ! { dg-error "Data transfer element at .1. cannot be polymorphic" } + print *, [x] + print *, [(y(i),i=1,1)] +end diff --git a/gcc/testsuite/gfortran.dg/vect/pr107254.f90 b/gcc/testsuite/gfortran.dg/vect/pr107254.f90 new file mode 100644 index 0000000..85bcb5f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr107254.f90 @@ -0,0 +1,49 @@ +! { dg-do run } + +subroutine dlartg( f, g, s, r ) + implicit none + double precision :: f, g, r, s + double precision :: d, p + + d = sqrt( f*f + g*g ) + p = 1.d0 / d + if( abs( f ) > 1 ) then + s = g*sign( p, f ) + r = sign( d, f ) + else + s = g*sign( p, f ) + r = sign( d, f ) + end if +end subroutine + +subroutine dhgeqz( n, h, t ) + implicit none + integer n + double precision h( n, * ), t( n, * ) + integer jc + double precision c, s, temp, temp2, tempr + temp2 = 10d0 + call dlartg( 10d0, temp2, s, tempr ) + c = 0.9d0 + s = 1.d0 + do jc = 1, n + temp = c*h( 1, jc ) + s*h( 2, jc ) + h( 2, jc ) = -s*h( 1, jc ) + c*h( 2, jc ) + h( 1, jc ) = temp + temp2 = c*t( 1, jc ) + s*t( 2, jc ) + t( 2, jc ) = -s*t( 1, jc ) + c*t( 2, jc ) + t( 1, jc ) = temp2 + enddo +end subroutine dhgeqz + +program test + implicit none + double precision h(2,2), t(2,2) + h = 0 + t(1,1) = 1 + t(2,1) = 0 + t(1,2) = 0 + t(2,2) = 0 + call dhgeqz( 2, h, t ) + if (t(2,2).ne.0) STOP 1 +end program test diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index fdd88e6..8d45bc2 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3416,6 +3416,22 @@ proc check_effective_target_base_quadfloat_support { } { return 1 } +# Return 1 if the target supports the __bf16 type, 0 otherwise. + +proc check_effective_target_bfloat16 {} { + return [check_no_compiler_messages_nocache bfloat16 object { + __bf16 foo (__bf16 x) { return x + x; } + } [add_options_for_bfloat16 ""]] +} + +proc check_effective_target_bfloat16_runtime {} { + return [check_effective_target_bfloat16] +} + +proc add_options_for_bfloat16 { flags } { + return "$flags" +} + # Return 1 if the target supports all four forms of fused multiply-add # (fma, fms, fnma, and fnms) for both float and double. |