GCC Administrator [Mon, 3 Jan 2022 00:16:28 +0000 (00:16 +0000)]
Daily bump.
Uros Bizjak [Sun, 2 Jan 2022 20:12:10 +0000 (21:12 +0100)]
i386: Introduce V2QImode vectorized arithmetic [PR103861]
This patch adds basic V2QImode infrastructure and V2QImode arithmetic
operations (plus, minus and neg). The patched compiler can emit SSE
vectorized QImode operations (e.g. PADDB) with partial QImode vector,
and also synthesized double HI/LO QImode operations with integer registers.
The testcase:
typedef char __v2qi __attribute__ ((__vector_size__ (2)));
__v2qi plus (__v2qi a, __v2qi b) { return a + b; };
compiles with -O2 to:
movl %edi, %edx
movl %esi, %eax
addb %sil, %dl
addb %ah, %dh
movl %edx, %eax
ret
which is much better than what the unpatched compiler produces:
movl %edi, %eax
movl %esi, %edx
xorl %ecx, %ecx
movb %dil, %cl
movsbl %dh, %edx
movsbl %ah, %eax
addl %edx, %eax
addb %sil, %cl
movb %al, %ch
movl %ecx, %eax
ret
The V2QImode vectorization does not require vector registers, so it can
be enabled by default also for 32-bit targets without SSE.
The patch also enables vectorized V2QImode sign/zero extends.
2021-12-30 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/103861
* config/i386/i386.h (VALID_SSE2_REG_MODE): Add V2QImode.
(VALID_INT_MODE_P): Ditto.
* config/i386/i386.c (ix86_secondary_reload): Handle
V2QImode reloads from SSE register to memory.
(vector_mode_supported_p): Always return true for V2QImode.
* config/i386/i386.md (*subqi_ext<mode>_2): New insn pattern.
(*negqi_ext<mode>_2): Ditto.
* config/i386/mmx.md (movv2qi): New expander.
(movmisalignv2qi): Ditto.
(*movv2qi_internal): New insn pattern.
(*pushv2qi2): Ditto.
(negv2qi2 and splitters): Ditto.
(<plusminus:insn>v2qi3 and splitters): Ditto.
gcc/testsuite/ChangeLog:
PR target/103861
* gcc.dg/store_merging_18.c (dg-options): Add -fno-tree-vectorize.
* gcc.dg/store_merging_29.c (dg-options): Ditto.
* gcc.target/i386/pr103861.c: New test.
* gcc.target/i386/pr92658-avx512vl.c (dg-final):
Remove vpmovqb scan-assembler xfail.
* gcc.target/i386/pr92658-sse4.c (dg-final):
Remove pmovzxbq scan-assembler xfail.
* gcc.target/i386/pr92658-sse4-2.c (dg-final):
Remove pmovsxbq scan-assembler xfail.
* gcc.target/i386/warn-vect-op-2.c (dg-warning): Adjust warnings.
John David Anglin [Sun, 2 Jan 2022 18:55:50 +0000 (18:55 +0000)]
Adjust shadd-2 and shadd-3 scan counts.
2022-01-02 John David Anglin <danglin@gcc.gnu.org>
gcc/testsuite/ChangeLog:
* gcc.target/hppa/shadd-2.c: Adjust count to 3.
* gcc.target/hppa/shadd-3.c: Likewise.
John David Anglin [Sun, 2 Jan 2022 18:37:34 +0000 (18:37 +0000)]
Skip gcc.dg/guality/example.c on hppa-linux.
2022-01-02 John David Anglin <danglin@gcc.gnu.org>
gcc/testsuite/ChangeLog:
* gcc.dg/guality/example.c: Skip on hppa*-*-linux*.
Jason Merrill [Sat, 1 Jan 2022 18:07:59 +0000 (13:07 -0500)]
c++: fix array cleanup with throwing temp dtor
While working on PR66139 I noticed that if the destructor of a temporary
created during array initialization throws, we were failing to destroy the
last array element constructed. Throwing destructors are rare since C++11,
but this should be fixed.
gcc/cp/ChangeLog:
* init.c (build_vec_init): Append the decrement to elt_init.
gcc/testsuite/ChangeLog:
* g++.dg/eh/array2.C: New test.
Jason Merrill [Thu, 30 Dec 2021 05:10:57 +0000 (00:10 -0500)]
c++: don't wrap cleanups that can't throw
Since C++11, the vast majority of destructors are noexcept, so
wrap_temporary_cleanups adds a bunch of useless TRY_CATCH_EXPR to be removed
later in the optimizers. It's simple to avoid adding them in the first
place.
gcc/cp/ChangeLog:
* decl.c (wrap_cleanups_r): Don't wrap if noexcept.
gcc/testsuite/ChangeLog:
* g++.dg/eh/cleanup6.C: New test.
John David Anglin [Sun, 2 Jan 2022 17:12:45 +0000 (17:12 +0000)]
Generate illegal instruction fault if LWS syscall returns -EFAULT.
2022-01-02 John David Anglin <danglin@gcc.gnu.org>
libgcc/ChangeLog:
* config/pa/linux-atomic.c (_ASM_EFAULT): Define.
(__kernel_cmpxchg): Nullify illegal iitlbp instruction if error
return is not equal _ASM_EFAULT.
(__kernel_cmpxchg2): Likewise.
John David Anglin [Sun, 2 Jan 2022 16:40:48 +0000 (16:40 +0000)]
Use optab_libfunc to access sync_lock_test_and_set libfunc on hppa-linux.
2022-01-02 John David Anglin <danglin@gcc.gnu.org>
gcc/ChangeLog:
* config/pa/pa.md (atomic_storeq): Use optab_libfunc to access
sync_lock_test_and_set libfunc. Call convert_memory_address to
convert memory address to Pmode.
(atomic_storehi, atomic_storesi, atomic_storedi): Likewise.
GCC Administrator [Sun, 2 Jan 2022 00:16:28 +0000 (00:16 +0000)]
Daily bump.
Francois-Xavier Coudert [Sat, 1 Jan 2022 11:22:00 +0000 (12:22 +0100)]
Fixincludes: Handle __FLT_EVAL_METHOD__ == 16 on darwin
The darwin system headers error out on __FLT_EVAL_METHOD__ == 16, which
occurs when the compiler is called with -mavx512fp16 on i386. Allow this
value to proceed past the check (nothing else depends on it in the
system headers).
fixincludes/ChangeLog:
* inclhack.def: Add new fix on darwin.
* fixincl.x: Regenerate.
* tests/base/math.h: Regenerate.
Andrew Pinski [Sat, 1 Jan 2022 08:44:48 +0000 (08:44 +0000)]
Committed: Add testcases for a few PRs
These were fixed as part of the fix for PR 99766,
I thought it would be useful to add a few testcases
for the other cases that were failing.
Committed as obvious after running the tests to make
sure they work.
PR rtl-optimization/100241
PR rtl-optimization/99787
gcc/testsuite/ChangeLog:
* gcc.c-torture/compile/pr100241-1.c: New test.
* gcc.c-torture/compile/pr99787-1.c: New test.
Jakub Jelinek [Sat, 1 Jan 2022 05:30:39 +0000 (06:30 +0100)]
testsuite: Adjust gcc.misc-tests/godump-1.c testcase
On Wed, Dec 29, 2021 at 03:54:03PM -0800, Ian Lance Taylor via Gcc-patches wrote:
> PR go/103847
> * godump.c (go_force_record_alignment): Name the alignment
> field "_".
> --- a/gcc/godump.c
> +++ b/gcc/godump.c
> @@ -651,7 +651,7 @@ go_force_record_alignment (struct obstack *ob, const char *type_string,
> unsigned int index, const char *error_string)
> {
> index = go_append_artificial_name (ob, index);
> - obstack_grow (ob, "_align ", 7);
> + obstack_grow (ob, "_ ", 2);
> if (type_string == NULL)
> obstack_grow (ob, error_string, strlen (error_string));
> else
This change caused
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _ts_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _ts_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad
+\\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_gaps struct { bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\\[2\\\\]byte; s uint16; Godump_1_align \\\\[0\\\\]int32; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad16_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_align \\\\[0\\\\]int16; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad16_2 struct { Godump_0_pad \\\\[2\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int16; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad32_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad32_2 struct { Godump_0_pad \\\\[4\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad64_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsbf_pad64_2 struct { Godump_0_pad \\\\[8\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsn_anon struct { a uint8; s uint16; b uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]int16; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tsu_anon struct { c uint8; Godump_0_pad \\\\[7\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu1 struct { c uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu3_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad
+\\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^type _tu_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _s_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _s_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad
+\\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_gaps struct { bf1 uint8; c uint8; bf2 uint8; Godump_0_pad \\\\[2\\\\]byte; s uint16; Godump_1_align \\\\[0\\\\]int32; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad16_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_align \\\\[0\\\\]int16; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad16_2 struct { Godump_0_pad \\\\[2\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int16; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad32_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad32_2 struct { Godump_0_pad \\\\[4\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int32; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad64_1 struct { Godump_0_pad \\\\[1\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sbf_pad64_2 struct { Godump_0_pad \\\\[8\\\\]byte; c uint8; Godump_1_pad \\\\[.\\\\]byte; Godump_2_align \\\\[0\\\\]int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _sn_anon struct { a uint8; s uint16; b uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]int16; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _su_anon struct { c uint8; Godump_0_pad \\\\[7\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u1 struct { c uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u3_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u_nested struct { u struct { s int16; Godump_0_pad \\\\[2\\\\]byte; Godump_1_align \\\\[0\\\\]u?int32; }; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u_nested2 struct { u struct { Godump_0_pad \\\\[4\\\\]byte; Godump_1_pad \\\\[2\\\\]byte; s int16; c int8; Godump_2_pad
+\\\\[1\\\\]byte; Godump_3_pad \\\\[2\\\\]byte; Godump_4_align \\\\[0\\\\]u?int32; }; }\$
+FAIL: gcc.misc-tests/godump-1.c scan-file (?n)^var _u_size struct { ca \\\\[4\\\\+1\\\\]uint8; Godump_0_pad \\\\[.\\\\]byte; Godump_1_align \\\\[0\\\\]u?int64; }\$
on x86_64-linux.
The following patch adjusts the testcase for the above change.
2022-01-01 Jakub Jelinek <jakub@redhat.com>
* gcc.misc-tests/godump-1.c: Adjust for renaming of last
field from _align suffix to _ suffix.
Jakub Jelinek [Sat, 1 Jan 2022 05:29:36 +0000 (06:29 +0100)]
objc: Fix handling of break stmt inside of switch inside of ObjC foreach [PR103639]
The r11-3302-g3696a50beeb73f changes broke the following ObjC testcase.
in_statement is either 0 (not in a looping statement), various IN_* flags
for various kinds of looping statements (or OpenMP structured blocks) or
those flags ored with IN_SWITCH_STMT when a switch appears inside of those
contexts. This is because break binds to switch in that last case, but
continue binds to the looping construct in that case.
The c_finish_bc_stmt function performs diagnostics on incorrect
break/continue uses and then checks if in_statement & IN_OBJC_FOREACH
and in that case jumps to the label provided by the caller, otherwise
emits a BREAK_STMT or CONTINUE_STMT. This is incorrect if we have
ObjC foreach with switch nested in it and break inside of that,
in_statement in that case is IN_OBJC_FOREACH | IN_SWITCH_STMT and
is_break is true. We want to handle it like other breaks inside of
switch, i.e. emit a BREAK_STMT.
The following patch fixes that.
2022-01-01 Jakub Jelinek <jakub@redhat.com>
PR objc/103639
* c-typeck.c (c_finish_bc_stmt): For break inside of switch inside of
ObjC foreach, emit normal BREAK_STMT rather than goto to label.
2022-01-01 Iain Sandoe <iain@sandoe.co.uk>
PR objc/103639
* objc.dg/pr103639.m: New test.
GCC Administrator [Sat, 1 Jan 2022 00:16:17 +0000 (00:16 +0000)]
Daily bump.
Francois-Xavier Coudert [Fri, 31 Dec 2021 22:19:03 +0000 (23:19 +0100)]
Fortran: Fix test on targets without REAL128
REAL128 is a named constant, so we cannot simply use
(REAL128 > 0) to conditionally compile for targets with
REAL128.
gcc/testsuite/ChangeLog:
PR fortran/89639
* gfortran.dg/ieee/ieee_9.f90: Adjust test for targets without
REAL128.
Iain Sandoe [Fri, 31 Dec 2021 11:52:22 +0000 (11:52 +0000)]
libgfortran: Fix bootstrap on targets without static_assert macro.
Although we build the library with GCC which is known to support
_Static_assert this might be done on a system without the macro
mapping static_assert to the compiler keyword.
The use of static_assert introduced with r12-6126-g3430132f3e82
causes bootstrap to fail on such targets, fixed by using the keyword
directly.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libgfortran/ChangeLog:
* runtime/string.c (gfc_itoa): Use _Static_assert directly
instead of via the static_assert macro.
Uros Bizjak [Fri, 31 Dec 2021 13:06:07 +0000 (14:06 +0100)]
testsuite: XFAIL some Wstringop-overflow tests ...
... for targets that support vectorization of 2-byte char stores
with unaligned address at plain O2.
2021-12-31 Uroš Bizjak <ubizjak@gmail.com>
gcc/testsuite/ChangeLog:
* lib/target-supports.exp (check_vect_slp_store_usage):
Handle TEST_V2QI_2.
(check_effective_target_vect_slp_v2qi_store_unalign): New procedure.
* c-c++-common/Wstringop-overflow-2.c: XFAIL specific tests for
vect_slp_v2qi_store_unalign targets.
* g++.dg/warn/Wstringop-overflow-3.C: Ditto.
* gcc.dg/Wstringop-overflow-28.c: Ditto.
* gcc.dg/Wstringop-overflow-68.c: Ditto.
* gcc.dg/Wstringop-overflow-75.c: Ditto.
* gcc.dg/Wstringop-overflow-76.c: Ditto.
GCC Administrator [Fri, 31 Dec 2021 00:16:26 +0000 (00:16 +0000)]
Daily bump.
Jakub Jelinek [Thu, 30 Dec 2021 21:25:34 +0000 (22:25 +0100)]
regrename: Fix -fcompare-debug issue in find_rename_reg [PR103756]
The r12-5978 change caused a -fcompare-debug issue, because without
-g a chain might start with a noop move, but with -g there could be
one or more DEBUG_INSNs in the chain before the noop move and so
regrename could make different decisions between -g and -g0.
Note, I must say I don't really understand the original change much,
if we want to make sure the noop moves are removed, couldn't regrename
during building of those du chains simply remove the noop moves instead?
2021-12-30 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/103756
* regrename.c (find_rename_reg): Test noop_move_p on the first
non-debug insn in the chain rather than on the first insn.
* g++.dg/opt/pr103756.C: New test.
Jakub Jelinek [Thu, 30 Dec 2021 21:23:58 +0000 (22:23 +0100)]
libcpp: Fix up ##__VA_OPT__ handling [PR89971]
In the following testcase we incorrectly error about pasting / token
with padding token (which is a result of __VA_OPT__); instead we should
like e.g. for ##arg where arg is empty macro argument clear PASTE_LEFT
flag of the previous token if __VA_OPT__ doesn't add any real tokens
(which can happen either because the macro doesn't have any tokens
passed to ... (i.e. __VA_ARGS__ expands to empty) or when __VA_OPT__
doesn't have any tokens in between ()s).
2021-12-30 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/89971
libcpp/
* macro.c (replace_args): For ##__VA_OPT__, if __VA_OPT__ expands
to no tokens at all, drop PASTE_LEFT flag from the previous token.
gcc/testsuite/
* c-c++-common/cpp/va-opt-9.c: New test.
Lancelot SIX [Thu, 30 Dec 2021 16:36:52 +0000 (11:36 -0500)]
libiberty: support digits in cpp mangled clone names
Currently libiberty fails to demangle the name of cloned functions if
the clone-type-identifier contains numbers.
This can be observed with the following example:
$ cat > ex.cc <<EOT
void foo (float *, float *)
__attribute__((target_clones("avx2,avx,sse4.1,default")));
void foo (float *, float *) {}
EOT
$ gcc -c ex.cc
$ nm -C ex.o | grep foo
0000000000000000 i foo(float*, float*)
0000000000000026 t foo(float*, float*) [clone .avx.1]
0000000000000013 t _Z3fooPfS_.avx2.0
0000000000000000 t foo(float*, float*) [clone .default.3]
0000000000000000 W foo(float*, float*) [clone .resolver]
0000000000000039 t _Z3fooPfS_.sse4_1.2
In this example, gcc creates clones for the FOO function, each matching
one of the specified targets. When inspecting the binary, nm (and other
libiberty-based tools, including gdb) fails to demangle the symbol names
if the clone identifier contains numbers.
Form my understanding of the mangling convention[1], clone names are
part of vendor-specific suffixes and do not have rule preventing them
from containing digits.
This commit proposes to fix the demangling. With this commit (ported to
binutils), nm gives the following output:
$ nm-new -C ex.o | grep foo
0000000000000000 i foo(float*, float*)
0000000000000026 t foo(float*, float*) [clone .avx.1]
0000000000000013 t foo(float*, float*) [clone .avx2.0]
0000000000000000 t foo(float*, float*) [clone .default.3]
0000000000000000 W foo(float*, float*) [clone .resolver]
0000000000000039 t foo(float*, float*) [clone .sse4_1.2]
Tested on x86_86-linux with 'make check-libiberty'.
[1] https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
libiberty/ChangeLog:
* cp-demangle.c (d_clone_suffix): Support digits in clone tag
names.
* testsuite/demangle-expected: Check demangling of clone symbols
with digits in name.
Jakub Jelinek [Thu, 30 Dec 2021 13:35:06 +0000 (14:35 +0100)]
emit-rtl: Fix a -fcompare-debug issue due to var-tracking [PR103808]
We get a -fcompare-debug FAIL on the following testcase. The problem is
that during cprop we get when a TImode pseudo holding x is being
constructed:
(debug_insn 111 59 103 7 (var_location:TI D#2 (clobber (const_int 0 [0]))) -1
(nil))
(insn 103 111 110 7 (clobber (reg/v:TI 89 [ x ])) "pr103808.c":8:9 -1
(nil))
(debug_insn 110 103 104 7 (var_location:TI D#2 (subreg:TI (reg:DI 111 [ x ]) 0)) -1
(nil))
(insn 104 110 109 7 (set (subreg:DI (reg/v:TI 89 [ x ]) 0)
(reg:DI 111 [ x ])) "pr103808.c":8:9 80 {*movdi_internal}
(expr_list:REG_DEAD (reg:DI 111 [ x ])
(nil)))
Now, during RA that paradoxical subreg in a debug insn obviously can't
affect where pseudo 111 is allocated and RA puts it into the bp register,
so we have:
(debug_insn 110 111 109 4 (var_location:TI D#2 (reg:TI 6 bp [orig:111 x ] [111])) -1
(nil))
Now, during var-tracking when we for:
(debug_insn 25 23 26 3 (var_location:TI x (concatn/v:TI [
(reg:DI 6 bp [orig:111 x ] [111])
(subreg:DI (debug_expr:TI D#2) 8)
])) "pr103808.c":8:9 -1
(nil))
try to simplify the highpart subreg of bp, gen_rtx_REG_offset is called in:
if (HARD_REGISTER_NUM_P (final_regno))
{
rtx x = gen_rtx_REG_offset (op, outermode, final_regno,
subreg_memory_offset (outermode,
innermode, byte));
and that unfortunately sets REG_ATTRS on stack_pointer_rtx, because
gen_rtx_REG_offset uses gen_rtx_REG which for Pmode STACK_POINTER_REGNUM
returns stack_pointer_rtx rather than newly created register.
The clobbering of REG_ATTRS on the shared stack_pointer_rtx then shows up
in the dumps as (reg/f:DI 7 sp [ x+8 ]) instead of (reg/f:DI 7 sp)
that shows up without var-tracking.
Clobbering of REG_ATTRS on the shared *_pointer_rtx looks just wrong.
So, IMHO either simplify_gen_subreg -> gen_rtx_REG_offset should call
gen_raw_REG to make sure we get a new non-shared REG we can set REG_ATTRS
on, or we should make sure that we don't overwrite the REG_ATTRS on the
shared REGs (but then simplify_gen_subreg shouldn't try to overwrite
ORIGINAL_REGNO on those either).
For non-DEBUG_INSNs, I'd hope this never happens, the RA shouldn't allocate
multi-word regs overlapping with stack pointer, hard frame pointer etc.
2021-12-30 Jakub Jelinek <jakub@redhat.com>
PR debug/103808
* emit-rtl.c (gen_rtx_REG_offset): Use gen_raw_REG instead of
gen_rtx_REG.
* gcc.dg/pr103808.c: New test.
Martin Liska [Thu, 30 Dec 2021 13:33:29 +0000 (14:33 +0100)]
docs: Add missing dash for argument.
gcc/ChangeLog:
* doc/cpp.texi: Add missing dash for argument.
Jakub Jelinek [Thu, 30 Dec 2021 13:25:19 +0000 (14:25 +0100)]
c-family: Use BULTINS_LOCATION for predefined macros changed upon optimize or target pragmas [PR103012]
The following testcases ICE when an optimize or target pragma
is followed by a long line (4096+ chars).
This is because on such long lines we can't use columns anymore,
but the cpp_define calls performed by c_cpp_builtins_optimize_pragma
or from the backend hooks for target pragma are done on temporary
buffers and expect to get columns from whatever line they appear on
(which happens to be the long line after optimize/target pragma),
and we run into:
#0 fancy_abort (file=0x3abec67 "../../libcpp/line-map.c", line=502, function=0x3abecfc "linemap_add") at ../../gcc/diagnostic.c:1986
#1 0x0000000002e7c335 in linemap_add (set=0x7ffff7fca000, reason=LC_RENAME, sysp=0, to_file=0x41287a0 "pr103012.i", to_line=3) at ../../libcpp/line-map.c:502
#2 0x0000000002e7cc24 in linemap_line_start (set=0x7ffff7fca000, to_line=3, max_column_hint=128) at ../../libcpp/line-map.c:827
#3 0x0000000002e7ce2b in linemap_position_for_column (set=0x7ffff7fca000, to_column=1) at ../../libcpp/line-map.c:898
#4 0x0000000002e771f9 in _cpp_lex_direct (pfile=0x40c3b60) at ../../libcpp/lex.c:3592
#5 0x0000000002e76c3e in _cpp_lex_token (pfile=0x40c3b60) at ../../libcpp/lex.c:3394
#6 0x0000000002e610ef in lex_macro_node (pfile=0x40c3b60, is_def_or_undef=true) at ../../libcpp/directives.c:601
#7 0x0000000002e61226 in do_define (pfile=0x40c3b60) at ../../libcpp/directives.c:639
#8 0x0000000002e610b2 in run_directive (pfile=0x40c3b60, dir_no=0, buf=0x7fffffffd430 "__OPTIMIZE__ 1\n", count=14) at ../../libcpp/directives.c:589
#9 0x0000000002e650c1 in cpp_define (pfile=0x40c3b60, str=0x2f784d1 "__OPTIMIZE__") at ../../libcpp/directives.c:2513
#10 0x0000000002e65100 in cpp_define_unused (pfile=0x40c3b60, str=0x2f784d1 "__OPTIMIZE__") at ../../libcpp/directives.c:2522
#11 0x0000000000f50685 in c_cpp_builtins_optimize_pragma (pfile=0x40c3b60, prev_tree=<optimization_node 0x7fffea042000>, cur_tree=<optimization_node 0x7fffea042020>)
at ../../gcc/c-family/c-cppbuiltin.c:600
assertion that LC_RENAME doesn't happen first.
I think the right fix is emit those predefined macros upon
optimize/target pragmas with BUILTINS_LOCATION, like we already do
for those macros at the start of the TU, they don't appear in columns
of the next line after it. Another possibility would be to force them
at the location of the pragma.
2021-12-30 Jakub Jelinek <jakub@redhat.com>
PR c++/103012
gcc/
* config/i386/i386-c.c (ix86_pragma_target_parse): Perform
cpp_define/cpp_undef calls with forced token locations
BUILTINS_LOCATION.
* config/arm/arm-c.c (arm_pragma_target_parse): Likewise.
* config/aarch64/aarch64-c.c (aarch64_pragma_target_parse): Likewise.
* config/s390/s390-c.c (s390_pragma_target_parse): Likewise.
gcc/c-family/
* c-cppbuiltin.c (c_cpp_builtins_optimize_pragma): Perform
cpp_define_unused/cpp_undef calls with forced token locations
BUILTINS_LOCATION.
gcc/testsuite/
PR c++/103012
* g++.dg/cpp/pr103012.C: New test.
* g++.target/i386/pr103012.C: New test.
Jakub Jelinek [Thu, 30 Dec 2021 13:23:18 +0000 (14:23 +0100)]
shrink-wrapping: Fix up prologue block discovery [PR103860]
The following testcase is miscompiled, because a prologue which
contains subq $8, %rsp instruction is emitted at the start of
a basic block which contains conditional jump that depends on
flags register set in an earlier basic block, the prologue instruction
then clobbers those flags.
Normally this case is checked by can_get_prologue predicate, but this
is done only at the start of the loop. If we update pro later in the
loop (because some bb shouldn't be duplicated) and then don't push
anything further into vec and the vec is already empty (this can happen
when the new pro is already in bb_with bitmask and either has no successors
(that is the case in the testcase where that bb ends with a trap) or
all the successors are already in bb_with, then the loop doesn't iterate
further and can_get_prologue will not be checked.
The following simple patch makes sure we call can_get_prologue even after
the last former iteration when vec is already empty and only break from
the loop afterwards (and only if the updating of pro done because of
!can_get_prologue didn't push anything into vec again).
2021-12-30 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/103860
* shrink-wrap.c (try_shrink_wrapping): Make sure can_get_prologue is
called on pro even if nothing further is pushed into vec.
* gcc.dg/pr103860.c: New test.
Xionghu Luo [Thu, 30 Dec 2021 02:02:12 +0000 (20:02 -0600)]
loop-invariant: Don't move cold bb instructions to preheader in RTL
gcc/ChangeLog:
2021-12-30 Xionghu Luo <luoxhu@linux.ibm.com>
* loop-invariant.c (find_invariants_bb): Check profile count
before motion.
(find_invariants_body): Add argument.
gcc/testsuite/ChangeLog:
2021-12-30 Xionghu Luo <luoxhu@linux.ibm.com>
* gcc.dg/loop-invariant-2.c: New.
GCC Administrator [Thu, 30 Dec 2021 00:16:43 +0000 (00:16 +0000)]
Daily bump.
Ian Lance Taylor [Wed, 29 Dec 2021 23:08:32 +0000 (15:08 -0800)]
compiler, libgo: don't pad sparc64-linux epollevent
Change the compiler to not add zero padding because of zero-sized
fields named "_", since those can't be referenced anyhow.
Change the sparc-linux64 epollevent struct to name the alignment
field "_", to avoid zero padding.
Fixes PR go/103847
PR go/103847
* godump.c (go_force_record_alignment): Name the alignment
field "_".
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/374914
Jakub Jelinek [Wed, 29 Dec 2021 20:46:21 +0000 (21:46 +0100)]
tree-ssa-dce: Fix up -fcompare-debug failures in make_forwarders_with_degenerate_phis [PR103742]
make_forwarders_with_degenerate_phis causes a -fcompare-debug failure on the
following testcase.
The problem is that on:
# iftmp.4_8 = PHI <&D.2582(6), &D.2583(4), &D.2582(7), &D.2583(5)>
the exact DECL_UIDs are different between -g and -g0 (which is ok, with -g
the decls can have larger gaps in between the uids), which means
iterative_hash_expr is different and because there are 2 pairs of edges
with matching phi arguments, the function processes them in different
orders.
The following patch fixes it by using the iterative_hash_expr order
only to determine which arguments are the same, then replaces the hashes
with the minimum dest_idx in the set of matching arguments and qsorts
again (which makes it stable for -fcompare-debug) and only splits edges etc.
on that stable order.
As a small optimization, if no arguments are equal, it doesn't do the
second qsort and continues, and if all arguments of the PHI are
constants or SSA_NAMEs (I think that is a pretty common case for many
PHIs), then it doesn't do the second qsort either, because in that case
the hash values will be stable, only computed from the constant values or
SSA_NAME_VERSIONs.
2021-12-29 Jakub Jelinek <jakub@redhat.com>
PR debug/103742
* tree-ssa-dce.c (make_forwarders_with_degenerate_phis): If any phi
argument is not CONSTANT_CLASS_P or SSA_NAME and any arguments are
equal, change second from hash value to lowest dest_idx from the
edges which have equal argument and resort to ensure -fcompare-debug
stability.
* g++.dg/opt/pr103742.C: New test.
Francois-Xavier Coudert [Wed, 29 Dec 2021 20:32:57 +0000 (21:32 +0100)]
Fortran: keep values of IEEE_CLASS_TYPE in sync
Fortran 2018 added some synonyms to the existing values, namely
IEEE_NEGATIVE_SUBNORMAL (which is the same as IEEE_NEGATIVE_DENORMAL)
and IEEE_POSITIVE_SUBNORMAL (same as IEEE_POSITIVE_DENORMAL). When they
were added to the C side, they were not kept in sync with the Fortran
part of the library. Thew new values are not used (yet), so it is
currently harmless, but better fix it.
libgfortran/ChangeLog:
* ieee/ieee_helper.c: Fix enum values.
Francois-Xavier Coudert [Mon, 27 Dec 2021 00:13:59 +0000 (01:13 +0100)]
LTO: Prune some warnings in the testsuite
Warnings like:
warning: using serial compilation of 2 LTRANS jobs
warning: visibility attribute not supported in this configuration; ignored\[^\n\]*" $text "" text
are pruned by lto.exp, but not for LTO testcases when run in other parts
of the testsuite. They will be, now.
gcc/testsuite/ChangeLog:
PR testsuite/47334
PR testsuite/103823
* lib/prune.exp: Prune some warnings related to LTO and
visibility.
Harald Anlauf [Mon, 27 Dec 2021 22:06:18 +0000 (23:06 +0100)]
Fortran: avoid several NULL pointer dereferences during error recovery
gcc/fortran/ChangeLog:
PR fortran/102332
* expr.c (gfc_get_variable_expr): Avoid NULL pointer dereferences
during handling of errors with invalid uses of CLASS variables.
* match.c (select_type_set_tmp): Likewise.
* primary.c (gfc_match_varspec): Likewise.
* resolve.c (resolve_variable): Likewise.
(resolve_select_type): Likewise.
gcc/testsuite/ChangeLog:
PR fortran/102332
* gfortran.dg/pr102332.f90: New test.
Martin Liska [Tue, 21 Dec 2021 16:43:55 +0000 (17:43 +0100)]
Support ld.mold linker.
gcc/ChangeLog:
* collect2.c (main): Add ld.mold.
* common.opt: Add -fuse-ld=mold.
* doc/invoke.texi: Document it.
* gcc.c (driver_handle_option): Handle -fuse-ld=mold.
* opts.c (common_handle_option): Likewise.
Uros Bizjak [Wed, 29 Dec 2021 08:34:32 +0000 (09:34 +0100)]
i386: Robustify some expanders w.r.t. paradoxical SUBREGs
lowpart_subreg might fail in some cases when trying to create paradoxical
SUBREGs. Use force_reg on input operand, use new temporary output operand
and emit move into the destination afterwards.
Also, replace simplify_gen_subreg (Mx, op, My, 0)
with equivalent lowpart_subreg (Mx, op, My).
2021-12-29 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
* config/i386/sse.md (vec_pack<floatprefix>_float_<mode>):
Perform gen_avx512dq_float<floatunssuffix>v2div2sf2 into a
pseudo and emit move insn into operands[0].
(fix<fixunssuffix>_truncv2sfv2di2): Use lowpart_subreg
instead of simplify_gen_subreg.
(trunc<mode><pmov_dst_3_lower>2): Perform
gen_avx512vl_truncate<mode>v<ssescalarnum>qi2 into a
pseudo and emit move insn into operands[0].
(trunc<mode><pmov_dst_4_lower>2): Perform
gen_avx512vl_truncate<mode>v<ssescalarnum>hi2 into a
pseudo and emit move insn into operands[0].
(truncv2div2si2): Perform gen_avx512vl_truncatev2div2si2 into a
pseudo and emit move insn into operands[0].
(truncv8div8qi2): Perform gen_avx512f_truncatev8div16qi2 into a
pseudo and emit move insn into operands[0].
(<any_extend:insn>v8qiv8hi2): Use lowpart_subreg
instead of simplify_gen_subreg.
(<any_extend:insn>v8qiv8si2): Ditto.
(<any_extend:insn>v4qiv4si2): Ditto.
(<any_extend:insn>v4hiv4si2): Ditto.
(<any_extend:insn>v8qiv8di2): Ditto.
(<any_extend:insn>v4qiv4di2): Ditto.
(<any_extend:insn>v2qiv2di2): Ditto.
(<any_extend:insn>v4hiv4di2): Ditto.
(<any_extend:insn>v2hiv2di2): Ditto.
(<any_extend:insn>v2siv2di2): Ditto.
Xionghu Luo [Wed, 29 Dec 2021 01:09:14 +0000 (19:09 -0600)]
Fix ICE in lsplit when built with -O3 -fno-guess-branch-probability [PR103793]
no-guess-branch-probability option requires profile_count scaling with
initialized_p guard, use multiply instead of apply_scale, which will do
the right thing to undefined probabilities and will not cause unnecesary
roundoff errors and precision info loss.
Also merge the missed part of r12-6086 of factor out function to avoid
duplicate code.
Regression testest pass on Power and X86.
gcc/ChangeLog:
PR tree-optimization/103793
* tree-ssa-loop-split.c (fix_loop_bb_probability): New function.
(split_loop): Use multiply to scale loop1's exit probability.
(do_split_loop_on_cond): Call fix_loop_bb_probability.
gcc/testsuite/ChangeLog:
PR tree-optimization/103793
* gcc.dg/pr103793.c: New test.
GCC Administrator [Wed, 29 Dec 2021 00:16:34 +0000 (00:16 +0000)]
Daily bump.
Francois-Xavier Coudert [Tue, 28 Dec 2021 22:28:49 +0000 (23:28 +0100)]
Libbacktrace: Fix the use of newline in sed replacement
On non-ELF targets, the Makefile needs a newline inside the sed REPLACE
string. The way it is currently done fails with GNU Make < 4, but GCC
only requires "GNU make version 3.80 (or later)".
The portable solution is given in the autoconf manual:
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Newlines-in-Make-Rules.html
libbacktrace/ChangeLog:
PR libbacktrace/103822
* Makefile.am: Fix newline.
* Makefile.in: Regenerate.
Francois-Xavier Coudert [Sun, 26 Dec 2021 19:18:01 +0000 (20:18 +0100)]
Fortran: Emit correct types for CHARACTER(C_CHAR), VALUE arguments
Make the front-end emit the right type for CHARACTER(C_CHAR), VALUE
arguments to BIND(C) procedures. They are scalar integers of C type
char, and should be emitted as such. They are not strings or arrays,
and are not promoted to C int, either.
gcc/fortran/ChangeLog:
PR fortran/103828
* trans-decl.c (generate_local_decl): Do not call
gfc_conv_scalar_char_value(), but check the type tree.
* trans-expr.c (gfc_conv_scalar_char_value): Rename to
conv_scalar_char_value, do not alter type tree.
(gfc_conv_procedure_call): Adjust call to renamed
conv_scalar_char_value() function.
* trans-types.c (gfc_sym_type): Take care of
CHARACTER(C_CHAR), VALUE arguments.
* trans.h (gfc_conv_scalar_char_value): Remove prototype.
gcc/testsuite/ChangeLog:
PR fortran/103828
* gfortran.dg/c_char_tests_3.f90: New file.
* gfortran.dg/c_char_tests_3_c.c: New file.
* gfortran.dg/c_char_tests_4.f90: New file.
* gfortran.dg/c_char_tests_5.f90: New file.
Jason Merrill [Tue, 28 Dec 2021 04:46:13 +0000 (23:46 -0500)]
c++: ICE on enum with bool value [PR99968]
BOOLEAN_TYPE also counts as integral, so verify_type should allow it.
PR c++/99968
gcc/ChangeLog:
* tree.c (verify_type): Allow enumerator with BOOLEAN_TYPE.
gcc/testsuite/ChangeLog:
* g++.dg/ext/is_enum2.C: New test.
Jakub Jelinek [Tue, 28 Dec 2021 16:41:24 +0000 (17:41 +0100)]
fold-const: Fix up fold_truth_andor_1 shift handling [PR103813]
Some time ago I've changed const_binop -> wide_int_binop, so that it punts
on shifts by negative count. fold_truth_andor_1 doesn't check the results
of const_binop (?SHIFT_EXPR, ) though and assumes they will be always
non-NULL, which is no longer the case.
2021-12-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/103813
* fold-const.c (fold_truth_andor_1): Punt of const_binop LSHIFT_EXPR
or RSHIFT_EXPR returns NULL. Formatting fix.
* gcc.c-torture/compile/pr103813.c: New test.
Jakub Jelinek [Tue, 28 Dec 2021 16:40:17 +0000 (17:40 +0100)]
loop-invariant: Fix -fcompare-debug failure [PR103837]
In the following testcase we have a -fcompare-debug failure, because
can_move_invariant_reg doesn't ignore DEBUG_INSNs in its decisions.
In the testcase we have due to uninitialized variable:
loop_header
debug_insn using pseudo84
pseudo84 = invariant
insn using pseudo84
end loop
and with -g decide not to move the pseudo84 = invariant before the
loop header; in this case not resetting the debug insns might be fine.
But, we could have also:
pseudo84 = whatever
loop_header
debug_insn using pseudo84
pseudo84 = invariant
insn using pseudo84
end loop
and in that case not resetting the debug insns would result in wrong-debug.
And, we don't really have generally a good substitution on what pseudo84
contains, it could inherit various values from different paths.
So, the following patch ignores DEBUG_INSNs in the decisions, and if there
are any that previously prevented the optimization, resets them before
return true.
2021-12-28 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/103837
* loop-invariant.c (can_move_invariant_reg): Ignore DEBUG_INSNs in
the decisions whether to return false or continue and right before
returning true reset those debug insns that previously caused
returning false.
* gcc.dg/pr103837.c: New test.
Jakub Jelinek [Tue, 28 Dec 2021 16:39:23 +0000 (17:39 +0100)]
optabs: Fix up checking for CALLs in newly added code by double-word divmod [PR103838]
These two spots are meant to punt if the newly added code contains
any CALL_INSNs, because in that case having a large sequence of insns
that also calls something is undesirable, better have one call that
is optimized in itself well.
The functions do last = get_last_insn (); before emitting any insns
(and expand_binop as the ultimate caller uses delete_insns_since if
the expansion fails), but the checks were incorrect for 2 reasons:
1) it checked not just what follows after that last insn, but also
the last insn itself; so, if the division or modulo is immediately
preceded by a CALL_INSN, then we punt; this also causes -fcompare-debug
failures if the CALL_INSN is with -g followed by one or more DEBUG_INSNs
2) if get_last_insn () is NULL (i.e. emitting into a new sequence), then
we didn't check anything
2021-12-28 Jakub Jelinek <jakub@redhat.com>
PR debug/103838
* optabs.c (expand_doubleword_mod, expand_doubleword_divmod): Only
check newly added insns for CALL_P, not the last insn of previous
code.
* gcc.dg/pr103838.c: New test.
Martin Liska [Tue, 28 Dec 2021 10:11:45 +0000 (11:11 +0100)]
docs: Use https in manual.
gcc/d/ChangeLog:
* gdc.texi: Use one more https.
Martin Liska [Fri, 10 Dec 2021 08:58:52 +0000 (09:58 +0100)]
driver: Improve option diagnostics [PR103465]
It happens that options are parsed and various diagnostics happen
in finish_options. That's a proper place as the function is also called
for optimize/target attributes (pragmas). However, it is possible that
target overwrites an option from command line and so the diagnostics
does not happen. That's fixed in the patch.
- options are parsed and finish_options is called:
if (opts->x_flag_unwind_tables
&& !targetm_common.unwind_tables_default
&& opts->x_flag_reorder_blocks_and_partition
&& (ui_except == UI_SJLJ || ui_except >= UI_TARGET))
{
if (opts_set->x_flag_reorder_blocks_and_partition)
inform (loc,
"%<-freorder-blocks-and-partition%> does not support "
"unwind info on this architecture");
opts->x_flag_reorder_blocks_and_partition = 0;
opts->x_flag_reorder_blocks = 1;
}
It's not triggered because of opts->x_flag_unwind_tables is false by default, but
the option is overwritten in target:
...
if (TARGET_64BIT_P (opts->x_ix86_isa_flags))
{
if (opts->x_optimize >= 1)
SET_OPTION_IF_UNSET (opts, opts_set, flag_omit_frame_pointer,
!USE_IX86_FRAME_POINTER);
if (opts->x_flag_asynchronous_unwind_tables
&& TARGET_64BIT_MS_ABI)
SET_OPTION_IF_UNSET (opts, opts_set, flag_unwind_tables, 1);
...
PR driver/103465
gcc/ChangeLog:
* opts.c (finish_options): More part of diagnostics to ...
(diagnose_options): ... here. Call the function from both
finish_options and process_options.
* opts.h (diagnose_options): Declare.
* toplev.c (process_options): Call diagnose_options.
Martin Liska [Wed, 22 Dec 2021 12:55:28 +0000 (13:55 +0100)]
docs: replace http:// with https://
I replaced and verified http:// links for various domains.
gcc/ada/ChangeLog:
* doc/share/gnu_free_documentation_license.rst: Replace http:// with https.
* gnat-style.texi: Likewise.
* gnat_rm.texi: Likewise.
* gnat_ugn.texi: Likewise.
gcc/d/ChangeLog:
* gdc.texi: Replace http:// with https.
gcc/ChangeLog:
* doc/contrib.texi: Replace http:// with https.
* doc/contribute.texi: Likewise.
* doc/extend.texi: Likewise.
* doc/gccint.texi: Likewise.
* doc/gnu.texi: Likewise.
* doc/implement-c.texi: Likewise.
* doc/implement-cxx.texi: Likewise.
* doc/include/fdl.texi: Likewise.
* doc/include/gpl_v3.texi: Likewise.
* doc/install.texi: Likewise.
* doc/invoke.texi: Likewise.
* doc/passes.texi: Likewise.
* doc/service.texi: Likewise.
* doc/sourcebuild.texi: Likewise.
* doc/standards.texi: Likewise.
gcc/fortran/ChangeLog:
* gfortran.texi: Replace http:// with https.
* intrinsic.texi: Likewise.
gcc/go/ChangeLog:
* gccgo.texi: Replace http:// with https.
gcc/jit/ChangeLog:
* docs/_build/texinfo/libgccjit.texi: Replace http:// with https.
* docs/cp/index.rst: Likewise.
* docs/cp/intro/index.rst: Likewise.
* docs/cp/intro/tutorial01.rst: Likewise.
* docs/cp/intro/tutorial02.rst: Likewise.
* docs/cp/intro/tutorial03.rst: Likewise.
* docs/cp/intro/tutorial04.rst: Likewise.
* docs/cp/topics/asm.rst: Likewise.
* docs/cp/topics/compilation.rst: Likewise.
* docs/cp/topics/contexts.rst: Likewise.
* docs/cp/topics/expressions.rst: Likewise.
* docs/cp/topics/functions.rst: Likewise.
* docs/cp/topics/index.rst: Likewise.
* docs/cp/topics/locations.rst: Likewise.
* docs/cp/topics/objects.rst: Likewise.
* docs/cp/topics/types.rst: Likewise.
* docs/index.rst: Likewise.
* docs/internals/index.rst: Likewise.
* docs/intro/index.rst: Likewise.
* docs/intro/tutorial01.rst: Likewise.
* docs/intro/tutorial02.rst: Likewise.
* docs/intro/tutorial03.rst: Likewise.
* docs/intro/tutorial04.rst: Likewise.
* docs/intro/tutorial05.rst: Likewise.
* docs/topics/asm.rst: Likewise.
* docs/topics/compatibility.rst: Likewise.
* docs/topics/compilation.rst: Likewise.
* docs/topics/contexts.rst: Likewise.
* docs/topics/expressions.rst: Likewise.
* docs/topics/function-pointers.rst: Likewise.
* docs/topics/functions.rst: Likewise.
* docs/topics/index.rst: Likewise.
* docs/topics/locations.rst: Likewise.
* docs/topics/objects.rst: Likewise.
* docs/topics/performance.rst: Likewise.
* docs/topics/types.rst: Likewise.
Jakub Jelinek [Tue, 28 Dec 2021 09:58:43 +0000 (10:58 +0100)]
i386: Fix handling of SUBREGs in divv2sf3 [PR103842]
register_operand predicate allows not just REGs, but also SUBREGs of REGs,
and for the latter lowpart_subreg might FAIL when trying to create paradoxical
SUBREG in some cases. For the input operand fixed by force_reg on it first,
for the output operand handled by always dividing into a fresh V4SFmode temporary
and emit_move_insn into the destination afterwards, that is also beneficial for
combine.
2021-12-28 Jakub Jelinek <jakub@redhat.com>
PR target/103842
* config/i386/mmx.md (divv2sf3): Use force_reg on op1. Always perform
divv4sf3 into a pseudo and emit_move_insn into operands[0].
* g++.dg/opt/pr103842.C: New test.
Haochen Jiang [Fri, 24 Dec 2021 05:55:06 +0000 (13:55 +0800)]
Fix tdpbf16ps testcase
gcc/testsuite/ChangeLog:
* gcc.target/i386/amx-check.h (check_float_tile_register):
New check function for float to prevent precision loss.
* gcc.target/i386/amxbf16-dpbf16ps-2.c: Correct the type convert
and byte offset. Use the new check function.
GCC Administrator [Tue, 28 Dec 2021 00:16:37 +0000 (00:16 +0000)]
Daily bump.
Francois-Xavier Coudert [Mon, 27 Dec 2021 20:32:08 +0000 (21:32 +0100)]
Fortran: fix use of static_assert() to conform to C11
libgfortran/ChangeLog:
PR libfortran/98076
* runtime/string.c (gfc_itoa): Use two args for static_assert().
John David Anglin [Mon, 27 Dec 2021 17:56:19 +0000 (17:56 +0000)]
Improve atomic store implementation on hppa-linux.
2021-12-27 John David Anglin <danglin@gcc.gnu.org>
gcc/ChangeLog:
* config/pa/pa-protos.h: Delete
pa_maybe_emit_compare_and_swap_exchange_loop() declaration.
* config/pa/pa.c (pa_expand_compare_and_swap_loop): Delete.
(pa_maybe_emit_compare_and_swap_exchange_loop): Delete.
* config/pa/pa.md (atomic_storeq): Use __sync_lock_test_and_set
instead of pa_maybe_emit_compare_and_swap_exchange_loop.
(atomic_storehi, atomic_storesi, atomic_storedi): Likewise.
Patrick Palka [Mon, 27 Dec 2021 15:01:42 +0000 (10:01 -0500)]
c++: Add testcase for SFINAE w/ p[N] and incomplete type [PR101239]
The r12-6123 fix for SFINAE with p+N and incomplete type also fixed
the analogous issue with p[N].
PR c++/101239
gcc/testsuite/ChangeLog:
* g++.dg/template/sfinae32a.C: New test.
Patrick Palka [Mon, 27 Dec 2021 14:05:17 +0000 (09:05 -0500)]
c++: hard error w/ ptr+N and incomplete type [PR103700]
In pointer_int_sum when called from a SFINAE context, we need to avoid
calling size_in_bytes_loc on an incomplete pointed-to type since this
latter function isn't SFINAE-enabled and always emits an error on such
input.
PR c++/103700
gcc/c-family/ChangeLog:
* c-common.c (pointer_int_sum): When quiet, return
error_mark_node for an incomplete pointed-to type and don't
call size_in_bytes_loc.
gcc/testsuite/ChangeLog:
* g++.dg/template/sfinae32.C: New test.
H.J. Lu [Sun, 19 Dec 2021 16:47:03 +0000 (08:47 -0800)]
ix86: Don't use the 'm' constraint for x86_64_general_operand
The 'm' constraint is defined with define_memory_constraint which allows
LRA to convert the operand to the form '(mem (reg X))', where X is a
base register. To prevent LRA from generating '(mem (reg X))' from a
register:
1. Add a 'BM' constraint which is similar to the 'm' constraint, but
is defined with define_constraint.
2. Add a 'm' mode attribute which is mapped to the 'm' constraint for
general_operand and the 'BM' constraint for x86_64_general_operand.
3. Replace the 'm' constraint on <general_operand> with the '<m>'
constraint.
4. Replace the 'm' constraint on x86_64_general_operand with the 'BM'
constraint.
gcc/
PR target/103762
* config/i386/constraints.md (BM): New constraint.
* config/i386/i386.md (m): New mode attribute.
Replace the 'm' constraint on <general_operand> with the '<m>'
constraint.
Replace the 'm' constraint on x86_64_general_operand with the
'BM' constraint.
gcc/testsuite/
* gcc.target/i386/pr103762-1a.c: New test.
* gcc.target/i386/pr103762-1b.c: Likewise.
* gcc.target/i386/pr103762-1c.c: Likewise.
Uros Bizjak [Mon, 27 Dec 2021 09:00:28 +0000 (10:00 +0100)]
testsuite: Avoid unwanted vecorization [PR95046]
2021-12-27 Uroš Bizjak <ubizjak@gmail.com>
gcc/testsuite/ChangeLog:
PR target/95046
* gfortran.dg/extract_recip_1.f: Adjust testcase.
LiaoShihua [Mon, 27 Dec 2021 04:03:08 +0000 (12:03 +0800)]
RISC-V: fixed testcase riscv/pr103302.c
Because riscv32 not support __int128, so skip if -march=rv32*.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/pr103302.c: skip if -march=rv32*
GCC Administrator [Mon, 27 Dec 2021 00:16:20 +0000 (00:16 +0000)]
Daily bump.
H.J. Lu [Fri, 24 Dec 2021 20:50:21 +0000 (12:50 -0800)]
i386: Check AX input in any_mul_highpart peepholes
When applying peephole optimization to transform
mov imm, %reg0
mov %reg1, %AX_REG
imul %reg0
to
mov imm, %AX_REG
imul %reg1
disable peephole optimization if reg1 == AX_REG.
gcc/
PR target/103785
* config/i386/i386.md: Swap operand order in comments and check
AX input in any_mul_highpart peepholes.
gcc/testsuite/
PR target/103785
* gcc.target/i386/pr103785.c: New test.
Francois-Xavier Coudert [Sun, 26 Dec 2021 10:59:14 +0000 (11:59 +0100)]
Fortran: speed up decimal output of integers
libgfortran/ChangeLog:
PR libfortran/98076
* runtime/string.c (itoa64, itoa64_pad19): New helper functions.
(gfc_itoa): On targets with 128-bit integers, call fast
64-bit functions to avoid many slow divisions.
gcc/testsuite/ChangeLog:
PR libfortran/98076
* gfortran.dg/pr98076.f90: New test.
GCC Administrator [Sun, 26 Dec 2021 00:16:17 +0000 (00:16 +0000)]
Daily bump.
Francois-Xavier Coudert [Sat, 25 Dec 2021 14:07:12 +0000 (15:07 +0100)]
Fortran: simplify library code for integer-to-decimal conversion
libgfortran/ChangeLog:
PR libfortran/81986
PR libfortran/99191
* libgfortran.h: Remove gfc_xtoa(), adjust gfc_itoa() and
GFC_ITOA_BUF_SIZE.
* io/write.c (write_decimal): conversion parameter is always
gfc_itoa(), so remove it. Protect from overflow.
(xtoa): Move gfc_xtoa and update its name.
(xtoa_big): Renamed from ztoa_big for consistency.
(write_z): Adjust to new function names.
(write_i, write_integer): Remove last arg of write_decimal.
* runtime/backtrace.c (error_callback): Comment on the use of
gfc_itoa().
* runtime/error.c (gfc_xtoa): Move to io/write.c.
* runtime/string.c (gfc_itoa): Take an unsigned argument,
remove the handling of negative values.
GCC Administrator [Sat, 25 Dec 2021 00:16:18 +0000 (00:16 +0000)]
Daily bump.
Uros Bizjak [Fri, 24 Dec 2021 16:09:36 +0000 (17:09 +0100)]
i386: Add V2SFmode DIV insn pattern [PR95046, PR103797]
Use V4SFmode "DIVPS X,Y" with [y0, y1, 1.0f, 1.0f] as a divisor
to avoid division by zero.
2021-12-24 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/95046
PR target/103797
* config/i386/mmx.md (divv2sf3): New instruction pattern.
gcc/testsuite/ChangeLog:
PR target/95046
PR target/103797
* gcc.target/i386/pr95046-1.c (test_div): Add.
(dg-options): Add -mno-recip.
Iain Sandoe [Fri, 24 Dec 2021 10:59:35 +0000 (10:59 +0000)]
Darwin: Amend a comment to be more inclusive [NFC].
As per title.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* config/darwin.c (darwin_override_options): Make a comment
more inclusive.
Iain Sandoe [Mon, 20 Dec 2021 15:19:50 +0000 (15:19 +0000)]
Darwin: Update rules for handling alignment of globals.
The current rule was too strict and has not been required since Darwin11.
This relaxes the constraint to allow up to 2^28 alignment for non-common
entities. Common is still restricted to a maximum aligment of 2^15.
When the host is an older version of Darwin ( earlier that 11 ) then the
existing constraint is still applied. Note that this is a host constraint
not a target one (so that a compilation on 10.7 targeting 10.6 is allowed
to use a greater alignment than the tools on 10.6 support). This matches
the behaviour of clang.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* config.gcc: Emit L2_MAX_OFILE_ALIGNMENT with suitable
values for the host.
* config/darwin.c (darwin_emit_common): Error for alignment
values > 32768.
* config/darwin.h (MAX_OFILE_ALIGNMENT): Rework to use the
configured L2_MAX_OFILE_ALIGNMENT.
gcc/testsuite/ChangeLog:
* gcc.dg/darwin-aligned-globals.c: New test.
* gcc.dg/darwin-comm-1.c: New test.
* gcc.dg/attr-aligned.c: Amend for new alignment values on
Darwin.
* gcc.target/i386/pr89261.c: Likewise.
Iain Sandoe [Fri, 10 Dec 2021 23:55:49 +0000 (23:55 +0000)]
Darwin: Check for that flag-reorder-and-partition.
We were checking whether the flag had been set by the user, but not if
it was set to true. Which means that the check fails in its intent when
the user puts -fno-reorder-and-partition.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* config/darwin.c (darwin_override_options): When checking for the
flag-reorder-and-partition case, also check that it is set on.
Iain Sandoe [Wed, 22 Dec 2021 14:00:25 +0000 (14:00 +0000)]
Darwin: Define OBJECT_FORMAT_MACHO.
There are places that we need to make different codegen depending
on the object format rather than on the arch. We already have
definitions for ELF, COFF etc. this adds one for MACHO.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* config/darwin.h (OBJECT_FORMAT_MACHO): New.
GCC Administrator [Fri, 24 Dec 2021 00:16:27 +0000 (00:16 +0000)]
Daily bump.
H.J. Lu [Thu, 23 Dec 2021 18:07:25 +0000 (10:07 -0800)]
smuldi3_highpart.c: Replace long with long long for -mx32
* gcc.target/i386/smuldi3_highpart.c: Replace long with long long.
Roger Sayle [Thu, 23 Dec 2021 12:33:07 +0000 (12:33 +0000)]
x86: PR target/103773: Fix wrong-code with -Oz from pop to memory.
This is a fix to PR target/103773 where -Oz shouldn't use push/pop
on x86 to shrink writing small integer constants to memory.
Instead clang uses "andl $0, mem" for writing zero, and "orl $-1, mem"
when writing -1 to memory when using -Oz. This patch implements this
via peephole2 where we can confirm that its ok to clobber the flags.
2021-12-23 Roger Sayle <roger@nextmovesoftware.com>
Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog
PR target/103773
* config/i386/i386.md (*mov<mode>_and): New define_insn for
writing a zero to memory using AND.
(*mov<mode>_or): Extend to allow memory destination and HImode.
(*movdi_internal): Remove -Oz push/pop optimization from here.
(*movsi_internal): Likewise.
(peephole2): Perform -Oz push/pop optimization here, only for
register destinations, values other than zero, and in functions
that don't used the red zone.
(peephole2): With -Oz, convert writes of 0 or -1 to memory into
their clobber forms, i.e. *mov<mode>_and and *mov<mode>_or resp.
gcc/testsuite/ChangeLog
PR target/103773
* gcc.target/i386/pr103773-2.c: New test case.
* gcc.target/i386/pr103773.c: New test case.
konglin1 [Tue, 7 Dec 2021 09:08:23 +0000 (17:08 +0800)]
i386: Enable intrinsics that convert float and bf16 data to each other.
gcc/ChangeLog:
* config/i386/avx512bf16intrin.h (_mm_cvtsbh_ss): Add new intrinsic.
(_mm512_cvtpbh_ps): Likewise.
(_mm512_maskz_cvtpbh_ps): Likewise.
(_mm512_mask_cvtpbh_ps): Likewise.
* config/i386/avx512bf16vlintrin.h (_mm_cvtness_sbh): Likewise.
(_mm_cvtpbh_ps): Likewise.
(_mm256_cvtpbh_ps): Likewise.
(_mm_maskz_cvtpbh_ps): Likewise.
(_mm256_maskz_cvtpbh_ps): Likewise.
(_mm_mask_cvtpbh_ps): Likewise.
(_mm256_mask_cvtpbh_ps): Likewise.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512bf16-cvtsbh2ss-1.c: New test.
* gcc.target/i386/avx512bf16-vcvtpbh2ps-1.c: Ditto.
* gcc.target/i386/avx512bf16vl-cvtness2sbh-1.c: Ditto.
* gcc.target/i386/avx512bf16vl-vcvtpbh2ps-1.c: Ditto.
Feng Xue [Tue, 21 Dec 2021 08:48:16 +0000 (09:48 +0100)]
Fix typo in type verification.
PR ipa/103786
gcc/ChangeLog:
* tree.c (verify_type): Fix typo.
liuhongt [Wed, 22 Dec 2021 08:48:54 +0000 (16:48 +0800)]
Combine vpcmpuw + zero_extend to vpcmpuw.
vcmp{ps,ph,pd} and vpcmp{,u}{b,w,d,q} implicitly clear the upper bits
of dest.
gcc/ChangeLog:
PR target/103750
* config/i386/sse.md
(*<avx512>_cmp<V48H_AVX512VL:mode>3_zero_extend<SWI248x:mode>):
New pre_reload define_insn_and_split.
(*<avx512>_cmp<VI12_AVX512VL:mode>3_zero_extend<SWI248x:mode>):
Ditto.
(*<avx512>_ucmp<VI12_AVX512VL:mode>3_zero_extend<SWI248x:mode>):
Ditto.
(*<avx512>_ucmp<VI48_AVX512VL:mode>3_zero_extend<SWI248x:mode>):
Ditto.
(*<avx512>_cmp<V48H_AVX512VL:mode>3_zero_extend<SWI248x:mode>_2):
Ditto.
(*<avx512>_cmp<VI12_AVX512VL:mode>3_zero_extend<SWI248x:mode>_2):
Ditto.
(*<avx512>_ucmp<VI12_AVX512VL:mode>3_zero_extend<SWI248x:mode>_2):
Ditto.
(*<avx512>_ucmp<VI48_AVX512VL:mode>3_zero_extend<SWI248x:mode>_2):
Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512bw-pr103750-1.c: New test.
* gcc.target/i386/avx512bw-pr103750-2.c: New test.
* gcc.target/i386/avx512f-pr103750-1.c: New test.
* gcc.target/i386/avx512f-pr103750-2.c: New test.
* gcc.target/i386/avx512fp16-pr103750-1.c: New test.
* gcc.target/i386/avx512fp16-pr103750-2.c: New test.
GCC Administrator [Thu, 23 Dec 2021 00:16:29 +0000 (00:16 +0000)]
Daily bump.
Harald Anlauf [Mon, 20 Dec 2021 21:12:33 +0000 (22:12 +0100)]
Fortran: BOZ literal constants are not interoperable
gcc/fortran/ChangeLog:
PR fortran/103778
* check.c (is_c_interoperable): A BOZ literal constant is not
interoperable.
gcc/testsuite/ChangeLog:
PR fortran/103778
* gfortran.dg/illegal_boz_arg_3.f90: New test.
Harald Anlauf [Mon, 20 Dec 2021 21:01:05 +0000 (22:01 +0100)]
Fortran: CASE selector expressions must be scalar
gcc/fortran/ChangeLog:
PR fortran/103776
* match.c (match_case_selector): Reject expressions in CASE
selector which are not scalar.
gcc/testsuite/ChangeLog:
PR fortran/103776
* gfortran.dg/select_10.f90: New test.
Murray Steele [Wed, 22 Dec 2021 14:55:07 +0000 (14:55 +0000)]
arm: Declare MVE types internally via pragma
Move the implementation of MVE ACLE types from arm_mve_types.h to
inside GCC via a new pragma, which replaces the prior type
definitions. This allows for the types to be used internally for
intrinsic function definitions.
gcc/ChangeLog:
* config.gcc (arm*-*-*): Add arm-mve-builtins.o to extra_objs.
* config/arm/arm-c.c (arm_pragma_arm): Handle "#pragma GCC arm".
(arm_register_target_pragmas): Register it.
* config/arm/arm-protos.h: (arm_mve::arm_handle_mve_types_h): New
prototype.
* config/arm/arm_mve_types.h: Replace MVE type definitions with
new pragma.
* config/arm/t-arm: (arm-mve-builtins.o): New target rule.
* config/arm/arm-mve-builtins.cc: New file.
* config/arm/arm-mve-builtins.def: New file.
* config/arm/arm-mve-builtins.h: New file.
gcc/testsuite/ChangeLog:
* gcc.target/arm/mve/mve.exp: Add new subdirectories.
* gcc.target/arm/mve/general-c/type_redef_1.c: New test.
* gcc.target/arm/mve/general/double_pragmas_1.c: New test.
* gcc.target/arm/mve/general/nomve_1.c: New test.
Murray Steele [Wed, 22 Dec 2021 14:50:00 +0000 (14:50 +0000)]
arm: Move arm_simd_info array declaration into header
Move the arm_simd_type and arm_type_qualifiers enums, and
arm_simd_info struct from arm-builtins.c into arm-builtins.h header.
This is a first step towards internalising the type definitions for
MVE predicate, vector, and tuple types. By moving arm_simd_types into
a header, we allow future patches to use these type trees externally
to arm-builtins.c, which is a crucial step towards developing an MVE
intrinsics framework similar to the current SVE implementation.
gcc/ChangeLog:
* config/arm/arm-builtins.c (enum arm_type_qualifiers): Move to
arm_builtins.h.
(enum arm_simd_type): Move to arm-builtins.h.
(struct arm_simd_type_info): Move to arm-builtins.h.
* config/arm/arm-builtins.h (enum arm_simd_type): Move from
arm-builtins.c.
(enum arm_type_qualifiers): Move from arm-builtins.c.
(struct arm_simd_type_info): Move from arm-builtins.c.
Francois-Xavier Coudert [Wed, 22 Dec 2021 11:46:07 +0000 (12:46 +0100)]
Fortran: allow __float128 on targets where long double is not REAL(KIND=10)
The logic for detection of REAL(KIND=16) in kinds-override.h made
assumptions:
-- if real(kind=10) exists, i.e. if HAVE_GFC_REAL_10 is defined,
then it is necessarily the "long double" type
-- if real(kind=16) exists, then:
* if HAVE_GFC_REAL_10, real(kind=16) is "__float128"
* otherwise, real(kind=16) is "long double"
This may not always be true. Take the aarch64-apple-darwin port,
it has double == long double == binary64, and __float128 == binary128.
We already have more fine-grained logic in the mk-kinds-h.sh script,
where we actually check the Fortran kind corresponding to C’s long
double. So let's use it, and emit the GFC_REAL_16_IS_FLOAT128 /
GFC_REAL_16_IS_LONG_DOUBLE macros there.
libgfortran/ChangeLog:
* kinds-override.h: Move GFC_REAL_16_IS_* macros...
* mk-kinds-h.sh: ... here.
Martin Liska [Wed, 22 Dec 2021 11:16:47 +0000 (12:16 +0100)]
docs: docs: use ';' for function declarations. (part 3)
gcc/ChangeLog:
* doc/extend.texi: Unify all function declarations in examples
where some miss trailing ';'.
Martin Liska [Wed, 22 Dec 2021 11:06:53 +0000 (12:06 +0100)]
docs: docs: use ';' for function declarations. (part 2)
gcc/ChangeLog:
* doc/extend.texi: Unify all function declarations in examples
where some miss trailing ';'.
Martin Liska [Wed, 22 Dec 2021 10:59:28 +0000 (11:59 +0100)]
docs: use ';' for function declarations.
gcc/ChangeLog:
* doc/extend.texi: Unify all function declarations in examples
where some miss trailing ';'.
Martin Liska [Wed, 22 Dec 2021 10:20:42 +0000 (11:20 +0100)]
docs: Unify instruct set name.
gcc/ChangeLog:
* doc/extend.texi: Use uppercase letters for SSEx.
GCC Administrator [Wed, 22 Dec 2021 00:16:30 +0000 (00:16 +0000)]
Daily bump.
Iain Buclaw [Thu, 16 Dec 2021 22:56:16 +0000 (23:56 +0100)]
config: Add check whether D compiler works (PR103528)
As well as checking for the existence of a GDC compiler, also validate
that it has also been built with libphobos, otherwise warn or fail with
the message that GDC is required to build d.
config/ChangeLog:
PR d/103528
* acx.m4 (ACX_PROG_GDC): Add check whether D compiler works.
ChangeLog:
* configure: Regenerate.
Iain Buclaw [Tue, 21 Dec 2021 14:03:47 +0000 (15:03 +0100)]
libphobos: Add power*-*-freebsd* as supported target
This has been tested on powerpc64-freebsd13 and powerpc64le-freebsd13,
and used to build dub, along with some D tools from ports.
libphobos/ChangeLog:
* configure.tgt: Add power*-*-freebsd* as a supported target.
Jiang Haochen [Tue, 21 Dec 2021 08:12:02 +0000 (16:12 +0800)]
i386: Add missing BMI intrinsic to align with clang
gcc/ChangeLog:
* config/i386/bmiintrin.h (_tzcnt_u16): New intrinsic.
(_andn_u32): Ditto.
(_andn_u64): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/i386/bmi-1.c: Add test for new intrinsic.
* gcc.target/i386/bmi-2.c: Ditto.
* gcc.target/i386/bmi-3.c: Ditto.
Martin Liska [Tue, 21 Dec 2021 08:10:43 +0000 (09:10 +0100)]
config.sub: change mode to 755.
ChangeLog:
* config.sub: Change mode back to 755.
Xionghu Luo [Wed, 8 Dec 2021 01:24:35 +0000 (19:24 -0600)]
Don't move cold code out of loop by checking bb count
v8 changes:
1. Use hotter_than_inner_loop instead of colder to store a hotter loop
nearest to loop.
2. Update the logic in fill_coldest_and_hotter_out_loop and
get_coldest_out_loop to make common case O(1).
3. Update function argument bb_colder_than_loop_preheader.
4. Make cached array to vec<class *loop> for index checking.
v7 changes:
1. Refine get_coldest_out_loop to replace loop with checking
pre-computed coldest_outermost_loop and colder_than_inner_loop.
2. Add function fill_cold_out_loop, compute coldest_outermost_loop and
colder_than_inner_loop recursively without loop.
v6 changes:
1. Add function fill_coldest_out_loop to pre compute the coldest
outermost loop for each loop.
2. Rename find_coldest_out_loop to get_coldest_out_loop.
3. Add testcase ssa-lim-22.c to differentiate with ssa-lim-19.c.
v5 changes:
1. Refine comments for new functions.
2. Use basic_block instead of count in bb_colder_than_loop_preheader
to align with function name.
3. Refine with simpler implementation for get_coldest_out_loop and
ref_in_loop_hot_body::operator for better understanding.
v4 changes:
1. Sort out profile_count comparision to function bb_cold_than_loop_preheader.
2. Update ref_in_loop_hot_body::operator () to find cold_loop before compare.
3. Split RTL invariant motion part out.
4. Remove aux changes.
v3 changes:
1. Handle max_loop in determine_max_movement instead of outermost_invariant_loop.
2. Remove unnecessary changes.
3. Add for_all_locs_in_loop (loop, ref, ref_in_loop_hot_body) in can_sm_ref_p.
4. "gsi_next (&bsi);" in move_computations_worker is kept since it caused
infinite loop when implementing v1 and the iteration is missed to be
updated actually.
v1: https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576488.html
v2: https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579086.html
v3: https://gcc.gnu.org/pipermail/gcc-patches/2021-September/580211.html
v4: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581231.html
v5: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/581961.html
...
v8: https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586209.html
There was a patch trying to avoid move cold block out of loop:
https://gcc.gnu.org/pipermail/gcc/2014-November/215551.html
Richard suggested to "never hoist anything from a bb with lower execution
frequency to a bb with higher one in LIM invariantness_dom_walker
before_dom_children".
In gimple LIM analysis, add get_coldest_out_loop to move invariants to
expected target loop, if profile count of the loop bb is colder
than target loop preheader, it won't be hoisted out of loop.
Likely for store motion, if all locations of the REF in loop is cold,
don't do store motion of it.
SPEC2017 performance evaluation shows 1% performance improvement for
intrate GEOMEAN and no obvious regression for others. Especially,
500.perlbench_r +7.52% (Perf shows function S_regtry of perlbench is
largely improved.), and 548.exchange2_r+1.98%, 526.blender_r +1.00%
on P8LE.
gcc/ChangeLog:
2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com>
* tree-ssa-loop-im.c (bb_colder_than_loop_preheader): New
function.
(get_coldest_out_loop): New function.
(determine_max_movement): Use get_coldest_out_loop.
(move_computations_worker): Adjust and fix iteration udpate.
(class ref_in_loop_hot_body): New functor.
(ref_in_loop_hot_body::operator): New.
(can_sm_ref_p): Use for_all_locs_in_loop.
(fill_coldest_and_hotter_out_loop): New.
(tree_ssa_lim_finalize): Free coldest_outermost_loop and
hotter_than_inner_loop.
(loop_invariant_motion_in_fun): Call fill_coldest_and_hotter_out_loop.
gcc/testsuite/ChangeLog:
2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com>
* gcc.dg/tree-ssa/recip-3.c: Adjust.
* gcc.dg/tree-ssa/ssa-lim-19.c: New test.
* gcc.dg/tree-ssa/ssa-lim-20.c: New test.
* gcc.dg/tree-ssa/ssa-lim-21.c: New test.
* gcc.dg/tree-ssa/ssa-lim-22.c: New test.
* gcc.dg/tree-ssa/ssa-lim-23.c: New test.
Xionghu Luo [Wed, 8 Dec 2021 05:17:51 +0000 (23:17 -0600)]
Fix loop split incorrect count and probability
In tree-ssa-loop-split.c, split_loop and split_loop_on_cond does two
kind of split. split_loop only works for single loop and insert edge at
exit when split, while split_loop_on_cond is not limited to single loop
and insert edge at latch when split. Both split behavior should consider
loop count and probability update. For split_loop, loop split condition
is moved in front of loop1 and loop2; But split_loop_on_cond moves the
condition between loop1 and loop2, this patch does:
1) profile count proportion for both original loop and copied loop
without dropping down the true branch's count;
2) probability update in the two loops and between the two loops.
Regression tested pass.
Changes diff for split_loop and split_loop_on_cond cases:
1) diff base/loop-split.c.151t.lsplit patched/loop-split.c.152t.lsplit
...
<bb 2> [local count:
118111600]:
if (beg_5(D) < end_8(D))
goto <bb 14>; [89.00%]
else
goto <bb 6>; [11.00%]
<bb 14> [local count:
105119324]:
if (beg2_6(D) < c_9(D))
- goto <bb 15>; [100.00%]
+ goto <bb 15>; [33.00%]
else
- goto <bb 16>; [100.00%]
+ goto <bb 16>; [67.00%]
- <bb 15> [local count:
105119324]:
+ <bb 15> [local count:
34689377]:
_25 = beg_5(D) + 1;
_26 = end_8(D) - beg_5(D);
_27 = beg2_6(D) + _26;
_28 = MIN_EXPR <c_9(D), _27>;
- <bb 3> [local count:
955630225]:
+ <bb 3> [local count:
315357973]:
# i_16 = PHI <i_11(8), beg_5(D)(15)>
# j_17 = PHI <j_12(8), beg2_6(D)(15)>
printf ("a: %d %d\n", i_16, j_17);
i_11 = i_16 + 1;
j_12 = j_17 + 1;
if (j_12 < _28)
- goto <bb 8>; [89.00%]
+ goto <bb 8>; [29.37%]
else
- goto <bb 17>; [11.00%]
+ goto <bb 17>; [70.63%]
- <bb 8> [local count:
850510901]:
+ <bb 8> [local count:
280668596]:
goto <bb 3>; [100.00%]
- <bb 16> [local count:
105119324]:
+ <bb 16> [local count:
70429947]:
# i_22 = PHI <beg_5(D)(14), i_29(17)>
# j_23 = PHI <beg2_6(D)(14), j_30(17)>
<bb 10> [local count:
955630225]:
# i_2 = PHI <i_22(16), i_20(13)>
# j_1 = PHI <j_23(16), j_21(13)>
i_20 = i_2 + 1;
j_21 = j_1 + 1;
if (end_8(D) > i_20)
- goto <bb 13>; [89.00%]
+ goto <bb 13>; [59.63%]
else
- goto <bb 9>; [11.00%]
+ goto <bb 9>; [40.37%]
- <bb 13> [local count:
850510901]:
+ <bb 13> [local count:
569842305]:
goto <bb 10>; [100.00%]
<bb 17> [local count:
105119324]:
# i_29 = PHI <i_11(3)>
# j_30 = PHI <j_12(3)>
if (end_8(D) > i_29)
goto <bb 16>; [80.00%]
else
goto <bb 9>; [20.00%]
<bb 9> [local count:
105119324]:
<bb 6> [local count:
118111600]:
return 0;
}
<bb 2> [local count:
118111600]:
- if (beg_5(D) < end_8(D))
+ _1 = end_6(D) - beg_7(D);
+ j_9 = _1 + beg2_8(D);
+ if (end_6(D) > beg_7(D))
goto <bb 14>; [89.00%]
else
goto <bb 6>; [11.00%]
<bb 14> [local count:
105119324]:
- if (beg2_6(D) < c_9(D))
- goto <bb 15>; [100.00%]
+ if (j_9 >= c_11(D))
+ goto <bb 15>; [33.00%]
else
- goto <bb 16>; [100.00%]
+ goto <bb 16>; [67.00%]
- <bb 15> [local count:
105119324]:
- _25 = beg_5(D) + 1;
- _26 = end_8(D) - beg_5(D);
- _27 = beg2_6(D) + _26;
- _28 = MIN_EXPR <c_9(D), _27>;
-
- <bb 3> [local count:
955630225]:
- # i_16 = PHI <i_11(8), beg_5(D)(15)>
- # j_17 = PHI <j_12(8), beg2_6(D)(15)>
- printf ("a: %d %d\n", i_16, j_17);
- i_11 = i_16 + 1;
- j_12 = j_17 + 1;
- if (j_12 < _28)
- goto <bb 8>; [89.00%]
+ <bb 15> [local count:
34689377]:
+ _27 = end_6(D) + -1;
+ _28 = beg_7(D) - end_6(D);
+ _29 = j_9 + _28;
+ _30 = _29 + 1;
+ _31 = MAX_EXPR <c_11(D), _30>;
+
+ <bb 3> [local count:
315357973]:
+ # i_18 = PHI <i_13(8), end_6(D)(15)>
+ # j_19 = PHI <j_14(8), j_9(15)>
+ printf ("a: %d %d\n", i_18, j_19);
+ i_13 = i_18 + -1;
+ j_14 = j_19 + -1;
+ if (j_14 >= _31)
+ goto <bb 8>; [29.37%]
else
- goto <bb 17>; [11.00%]
+ goto <bb 17>; [70.63%]
- <bb 8> [local count:
850510901]:
+ <bb 8> [local count:
280668596]:
goto <bb 3>; [100.00%]
- <bb 16> [local count:
105119324]:
- # i_22 = PHI <beg_5(D)(14), i_29(17)>
- # j_23 = PHI <beg2_6(D)(14), j_30(17)>
+ <bb 16> [local count:
70429947]:
+ # i_24 = PHI <end_6(D)(14), i_32(17)>
+ # j_25 = PHI <j_9(14), j_33(17)>
<bb 10> [local count:
955630225]:
- # i_2 = PHI <i_22(16), i_20(13)>
- # j_1 = PHI <j_23(16), j_21(13)>
- i_20 = i_2 + 1;
- j_21 = j_1 + 1;
- if (end_8(D) > i_20)
+ # i_3 = PHI <i_24(16), i_22(13)>
+ # j_2 = PHI <j_25(16), j_23(13)>
+ i_22 = i_3 + -1;
+ j_23 = j_2 + -1;
+ if (beg_7(D) < i_22)
goto <bb 13>; [89.00%]
else
goto <bb 9>; [11.00%]
- <bb 13> [local count:
850510901]:
+ <bb 13> [local count:
569842305]:
goto <bb 10>; [100.00%]
<bb 17> [local count:
105119324]:
- # i_29 = PHI <i_11(3)>
- # j_30 = PHI <j_12(3)>
- if (end_8(D) > i_29)
+ # i_32 = PHI <i_13(3)>
+ # j_33 = PHI <j_14(3)>
+ if (beg_7(D) < i_32)
goto <bb 16>; [80.00%]
else
goto <bb 9>; [20.00%]
<bb 9> [local count:
105119324]:
<bb 6> [local count:
118111600]:
return 0;
}
2) diff base/loop-cond-split-1.c.151t.lsplit patched/loop-cond-split-1.c.151t.lsplit:
...
<bb 2> [local count:
118111600]:
if (n_7(D) > 0)
goto <bb 4>; [89.00%]
else
goto <bb 3>; [11.00%]
<bb 3> [local count:
118111600]:
return;
<bb 4> [local count:
105119324]:
pretmp_3 = ga;
- <bb 5> [local count:
955630225]:
+ <bb 5> [local count:
315357973]:
# i_13 = PHI <i_10(20), 0(4)>
# prephitmp_12 = PHI <prephitmp_5(20), pretmp_3(4)>
if (prephitmp_12 != 0)
goto <bb 6>; [33.00%]
else
goto <bb 7>; [67.00%]
<bb 6> [local count:
315357972]:
_2 = do_something ();
ga = _2;
- <bb 7> [local count:
955630225]:
+ <bb 7> [local count:
315357973]:
# prephitmp_5 = PHI <prephitmp_12(5), _2(6)>
i_10 = inc (i_13);
if (n_7(D) > i_10)
goto <bb 21>; [89.00%]
else
goto <bb 11>; [11.00%]
<bb 11> [local count:
105119324]:
goto <bb 3>; [100.00%]
- <bb 21> [local count:
850510901]:
+ <bb 21> [local count:
280668596]:
if (prephitmp_12 != 0)
- goto <bb 20>; [100.00%]
+ goto <bb 20>; [33.00%]
else
- goto <bb 19>; [INV]
+ goto <bb 19>; [67.00%]
- <bb 20> [local count:
850510901]:
+ <bb 20> [local count:
280668596]:
goto <bb 5>; [100.00%]
- <bb 19> [count: 0]:
+ <bb 19> [local count:
70429947]:
# i_23 = PHI <i_10(21)>
# prephitmp_25 = PHI <prephitmp_5(21)>
- <bb 12> [local count:
955630225]:
+ <bb 12> [local count:
640272252]:
# i_15 = PHI <i_23(19), i_22(16)>
# prephitmp_16 = PHI <prephitmp_25(19), prephitmp_16(16)>
i_22 = inc (i_15);
if (n_7(D) > i_22)
goto <bb 16>; [89.00%]
else
goto <bb 11>; [11.00%]
- <bb 16> [local count:
850510901]:
+ <bb 16> [local count:
569842305]:
goto <bb 12>; [100.00%]
}
gcc/ChangeLog:
2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com>
* tree-ssa-loop-split.c (split_loop): Fix incorrect
profile_count and probability.
(do_split_loop_on_cond): Likewise.
Xionghu Luo [Tue, 21 Dec 2021 03:10:09 +0000 (21:10 -0600)]
Fix incorrect loop exit edge probability [PR103270]
r12-4526 cancelled jump thread path rotates loop. It exposes a issue in
profile-estimate when predict_extra_loop_exits, outer loop's exit edge
is marked as inner loop's extra loop exit and set with incorrect
prediction, then a hot inner loop will become cold loop finally through
optimizations, this patch add loop check when searching extra exit edges
to avoid unexpected predict_edge from predict_paths_for_bb.
Regression tested on P8LE.
gcc/ChangeLog:
2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com>
PR middle-end/103270
* predict.c (predict_extra_loop_exits): Add loop parameter.
(predict_loops): Call with loop argument.
gcc/testsuite/ChangeLog:
2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com>
PR middle-end/103270
* gcc.dg/pr103270.c: New test.
Xionghu Luo [Tue, 21 Dec 2021 03:02:50 +0000 (21:02 -0600)]
rs6000: Replace UNSPECS with ss_plus/us_plus and ss_minus/us_minus
These four UNSPECS seems could be replaced with native RTL.
For
"(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))":
Quoted David's explanation:
"The design came from the early implementation of Altivec:
https://gcc.gnu.org/pipermail/gcc-patches/2002-May/077409.html
If one later checks for saturation (reads VSCR), one needs a
corresponding SET of the value. It's set in an architecture-specific
manner that isn't described to GCC, but it's set, not just clobbered
and in an undefined state.
The RTL does not describe that VSCR is set to the value 0. The
(const_int 0) is not the value set. You can think of the (const_int
0) as a dummy RTL argument to the VSCR UNSPEC. UNSPEC requires at
least one argument and the pattern doesn't try to express the
argument, so it uses a dummy RTL constant. It's part of a PARALLEL
and the plus or minus already expresses the data dependency of the
pattern on the input operands."
gcc/ChangeLog:
2021-12-21 Xionghu Luo <luoxhu@linux.ibm.com>
* config/rs6000/altivec.md (altivec_vaddu<VI_char>s): Replace
UNSPEC_VADDU with us_plus.
(altivec_vadds<VI_char>s): Replace UNSPEC_VADDS with ss_plus.
(altivec_vsubu<VI_char>s): Replace UNSPEC_VSUBU with us_minus.
(altivec_vsubs<VI_char>s): Replace UNSPEC_VSUBS with ss_minus.
(altivec_abss_<mode>): Likewise.
GCC Administrator [Tue, 21 Dec 2021 00:16:24 +0000 (00:16 +0000)]
Daily bump.
Joseph Myers [Mon, 20 Dec 2021 23:09:37 +0000 (23:09 +0000)]
Update cpplib es.po
* es.po: Update.
Uros Bizjak [Mon, 20 Dec 2021 20:15:50 +0000 (21:15 +0100)]
i386: Fix <sse2p4_1>_pinsr<ssemodesuffix> and its splitters [PR103772]
The clever trick to duplicate the value of the input operand into itself
proved not so clever after all. The splitter should not clobber the input
operand in any case, since the register can hold the value outside the HImode
lowpart when accessed as subreg. Use the standard earlyclobber approach
instead.
The testcase fails with avx2 ISA, but I was not able to create the testcase
that wouldn't require -mavx512fp16 compile flag.
2021-12-20 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/103772
* config/i386/sse.md (<sse2p4_1>_pinsr<ssemodesuffix>): Add
earlyclobber to (x,x,x,i) alternative.
(<sse2p4_1>_pinsr<ssemodesuffix> peephole2): Remove.
(<sse2p4_1>_pinsr<ssemodesuffix> splitter): Use output
operand as a temporary register. Split after reload_completed.
Patrick Palka [Mon, 20 Dec 2021 20:02:40 +0000 (15:02 -0500)]
c++: memfn lookup consistency in incomplete-class ctx
When instantiating a call to a member function of a class template, we
repeat the member function lookup in order to obtain the corresponding
partially instantiated functions. Within an incomplete-class context
however, we need to be more careful when repeating the lookup because we
don't want to introduce later-declared member functions that weren't
visible at template definition time. We're currently not careful enough
in this respect, which causes us to reject memfn1.C below.
This patch fixes this issue by making tsubst_baselink filter out from
the instantiation-time lookup those member functions that were invisible
at template definition time. This is really only necessary within an
incomplete-class context, so this patch adds a heuristic flag to BASELINK
to help us avoid needlessly performing this filtering step (which would
be a no-op) in complete-class contexts.
This is also necessary for the ahead-of-time overload set pruning
implemented in r12-6075 to be effective for member functions within
class templates.
gcc/cp/ChangeLog:
* call.c (build_new_method_call): Set
BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P on the pruned baselink.
* cp-tree.h (BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P): Define.
* pt.c (filter_memfn_lookup): New subroutine of tsubst_baselink.
(tsubst_baselink): Use filter_memfn_lookup on the new lookup
result when BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P is set on the
old baselink. Remove redundant BASELINK_P check.
* search.c (build_baselink): Set
BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P appropriately.
gcc/testsuite/ChangeLog:
* g++.dg/lookup/memfn1.C: New test.
* g++.dg/template/non-dependent16b.C: New test.
Iain Buclaw [Mon, 20 Dec 2021 18:25:32 +0000 (19:25 +0100)]
d: Merge upstream dmd
ad8412530, druntime
fd9a4544, phobos
495e835c2.
D front-end changes:
- Import dmd v2.098.1
- Remove calling of _d_delstruct from code generator.
Druntime changes:
- Import druntime v2.098.1
Phobos changes:
- Import phobos v2.098.1
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
ad8412530.
* expr.cc (ExprVisitor::visit (DeleteExp *)): Remove code generation
of _d_delstruct.
* runtime.def (DELSTRUCT): Remove.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime
fd9a4544.
* src/MERGE: Merge upstream phobos
495e835c2.
Olivier Hainque [Wed, 3 Nov 2021 14:18:16 +0000 (14:18 +0000)]
Fix static array size in gcc.dg/vect/vect-simd-20.c
10000 / 78 is strictly greater than 128 so we will
actually do 128+1 strides in foo() for s == 78 and p[]
needs to be dimensioned accordingly.
2021-12-20 Olivier Hainque <hainque@adacore.com>
gcc/testsuite/
* gcc.dg/vect/vect-simd-20.c: Fix size of p[]
to accommodate the number of strides performed
by foo() for s == 78.
Roger Sayle [Mon, 20 Dec 2021 15:22:18 +0000 (15:22 +0000)]
x86_64: Improve code expanded for highpart multiplications.
While working on a middle-end patch to more aggressively use highpart
multiplications on targets that support them, I noticed that the RTL
expanded by the x86 backend interacts poorly with register allocation
leading to suboptimal code.
For the testcase,
typedef int __attribute ((mode(TI))) ti_t;
long foo(long x)
{
return ((ti_t)x * 19065) >> 64;
}
we'd like to avoid:
foo: movq %rdi, %rax
movl $19065, %edx
imulq %rdx
movq %rdx, %rax
ret
and would prefer:
foo: movl $19065, %eax
imulq %rdi
movq %rdx, %rax
ret
This patch provides a pair of peephole2 transformations to tweak the
spills generated by reload, and at the same time replaces the current
define_expand with a define_insn pattern using the new [su]mul_highpart
RTX codes.
2021-12-20 Roger Sayle <roger@nextmovesoftware.com>
Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog
* config/i386/i386.md (any_mul_highpart): New code iterator.
(sgnprefix, s): Add attribute support for [su]mul_highpart.
(<s>mul<mode>3_highpart): Delete expander.
(<s>mul<mode>3_highpart, <s>mulsi32_highpart_zext):
New define_insn patterns.
(define_peephole2): Tweak the register allocation for the above
instructions after reload.
gcc/testsuite/ChangeLog
* gcc.target/i386/smuldi3_highpart.c: New test case.
Joel Sherrill [Fri, 17 Dec 2021 16:10:10 +0000 (10:10 -0600)]
Obsolete m32c-rtems target
2021-12-20 Joel Sherrill <joel@rtems.org>
gcc/
* config.gcc: Obsolete m32c-*-rtems* target.
Patrick Palka [Mon, 20 Dec 2021 14:28:20 +0000 (09:28 -0500)]
c++: ahead-of-time overload set pruning for non-dep calls
This patch makes us remember the function selected by overload resolution
during ahead of time processing of a non-dependent call expression, so
that at instantiation time we avoid repeating some of the work of overload
resolution for the call. Note that we already do this for non-dependent
operator expressions via build_min_non_dep_op_overload.
Some caveats:
* When processing ahead of time a non-dependent call to a member
function template of a currently open class template (as in
g++.dg/template/deduce4.C), we end up generating an "inside-out"
partial instantiation such as S<T>::foo<int, int>(), the likes of
which we're apparently not prepared to fully instantiate. So in this
situation, we instead prune to the selected template instead of the
specialization in this situation.
* This change triggered a latent FUNCTION_DECL pretty printing issue
in cpp0x/error2.C -- since we now resolve the call to foo<0> ahead
of time, the error now looks like:
error: expansion pattern ‘foo()()=0’ contains no parameter pack
where the FUNCTION_DECL for foo<0> is clearly misprinted. But this
pretty-printing issue could be reproduced without this patch if
we define foo as a non-template function. Since this testcase was
added to verify pretty printing of TEMPLATE_ID_EXPR, I work around
this test failure by making the call to foo type-dependent and thus
immune to this ahead of time pruning.
* We now reject parts of cpp0x/fntmp-equiv1.C because we notice that
the non-dependent call d(f, b) in
int d(int, int);
template <unsigned long f, unsigned b, typename> e<d(f, b)> d();
is non-constexpr. Since this testcase is about equivalency of
dependent names in the context of declaration matching, it seems the
best fix here is to make the calls to d, d2 and d3 within the
function signatures dependent.
gcc/cp/ChangeLog:
* call.c (build_new_method_call): For a non-dependent call
expression inside a template, returning a templated tree
whose overload set contains just the selected function.
* semantics.c (finish_call_expr): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/error2.C: Make the call to foo type-dependent in
order to avoid latent pretty-printing issue for FUNCTION_DECL
inside MODOP_EXPR.
* g++.dg/cpp0x/fntmp-equiv1.C: Make the calls to d, d2 and d3
within the function signatures dependent.
* g++.dg/template/non-dependent16.C: New test.
* g++.dg/template/non-dependent16a.C: New test.
* g++.dg/template/non-dependent17.C: New test.