Commit Graph

200153 Commits

Author SHA1 Message Date
Jakub Jelinek 32c51d0911 fortran: Fix ICE on pr96024.f90 on big-endian hosts [PR96024]
The pr96024.f90 testcase ICEs on big-endian hosts.  The problem is
that length->val.integer is accessed after checking
length->expr_type == EXPR_CONSTANT, but it is a CHARACTER constant
which uses length->val.character union member instead and on big-endian
we end up reading constant 0x100000000 rather than some small number
on little-endian and if target doesn't have enough memory for 4 times
that (i.e. 16GB allocation), it ICEs.

2023-06-09  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/96024
	* primary.cc (gfc_convert_to_structure_constructor): Only do
	constant string ctor length verification and truncation/padding
	if constant length has INTEGER type.

(cherry picked from commit 4cf6e322adc19f927859e0a5edfa93cec4b8c844)
2023-06-09 09:20:53 +02:00
liuhongt 5e01a590aa Explicitly view_convert_expr mask to signed type when folding pblendvb builtins.
Since mask < 0 will be always false for vector char when
-funsigned-char, but vpblendvb needs to check the most significant
bit. The patch explicitly VCE to vector signed char.

gcc/ChangeLog:

	PR target/110108
	* config/i386/i386.cc (ix86_gimple_fold_builtin): Explicitly
	view_convert_expr mask to signed type when folding pblendvb
	builtins.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr110108-2.c: New test.
2023-06-09 09:46:02 +08:00
GCC Administrator b91956fc7d Daily bump. 2023-06-09 00:21:12 +00:00
Kyrylo Tkachov 8f170995aa arm: PR target/109939 Correct signedness of return type of __ssat intrinsics
As the PR says we shouldn't be using qualifier_unsigned for the return type of the __ssat intrinsics.
UNSIGNED_SAT_BINOP_UNSIGNED_IMM_QUALIFIERS already exists for that.
This was just a thinko.
This patch fixes this and the warning with -Wconversion goes away.

Bootstrapped and tested on arm-none-linux-gnueabihf.

gcc/ChangeLog:

	PR target/109939
	* config/arm/arm-builtins.cc (SAT_BINOP_UNSIGNED_IMM_QUALIFIERS): Use
	qualifier_none for the return operand.

gcc/testsuite/ChangeLog:

	PR target/109939
	* gcc.target/arm/pr109939.c: New test.

(cherry picked from commit 95542a6ec4b350c653b793b7c36a8210b0e9a89d)
2023-06-08 09:31:11 +01:00
GCC Administrator 65ed436a08 Daily bump. 2023-06-08 00:21:33 +00:00
Jeevitha Palanisamy dda4745eb1 rs6000: Remove duplicate expression [PR106907]
PR106907 has few warnings spotted from cppcheck. In that addressing duplicate
expression issue here. Here the same expression is used twice in logical
AND(&&) operation which result in same result so removing that.

2023-06-06  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

gcc/
	PR target/106907
	* config/rs6000/rs6000.cc (vec_const_128bit_to_bytes): Remove
	duplicate expression.

(cherry picked from commit c4deccd44655c5d748dfed200a37f2b678c32fe8)
2023-06-07 10:31:23 -05:00
Alex Coplan 98682182e3 arm: Fix ICE due to infinite splitting [PR109800]
In r11-966-g9a182ef9ee011935d827ab5c6c9a7cd8e22257d8 we introduce a
simplification to emit_move_insn that attempts to simplify moves of the form:

(set (subreg:M1 (reg:M2 ...)) (constant C))

where M1 and M2 are of equal mode size. That is problematic for the splitter
vfp.md:no_literal_pool_df_immediate in the arm backend, which tries to pun an
lvalue DFmode pseudo into DImode and assign a constant to it with
emit_move_insn, as the new transformation simply undoes this, and we end up
splitting indefinitely.

This patch changes things around in the arm backend so that we use a
DImode temporary (instead of DFmode) and first load the DImode constant
into the pseudo, and then pun the pseudo into DFmode as an rvalue in a
reg -> reg move. I believe this should be semantically equivalent but
avoids the pathalogical behaviour seen in the PR.

gcc/ChangeLog:

	PR target/109800
	* config/arm/arm.md (movdf): Generate temporary pseudo in DImode
	instead of DFmode.
	* config/arm/vfp.md (no_literal_pool_df_immediate): Rather than punning an
	lvalue DFmode pseudo into DImode, use a DImode pseudo and pun it into
	DFmode as an rvalue.

gcc/testsuite/ChangeLog:

	PR target/109800
	* gcc.target/arm/pure-code/pr109800.c: New test.

(cherry picked from commit f5298d9969b4fa34ff3aecd54b9630e22b2984a5)
2023-06-07 15:12:12 +01:00
GCC Administrator 4513d0a2eb Daily bump. 2023-06-07 00:22:21 +00:00
Jonathan Wakely ff58310f27 libstdc++: Do not use std::expected::value() in monadic ops (LWG 3938)
The monadic operations in std::expected always check has_value() so we
can avoid the execptional path in value() and the assertions in error()
by accessing _M_val and _M_unex directly. This means that the monadic
operations no longer require _M_unex to be copyable so that it can be
thrown from value(), as modified by LWG 3938.

This also fixes two incorrect uses of std::move in transform(F&&)& and
transform(F&&) const& which I found while making these changes.

Now that move-only error types are supported, it's possible to properly
test the constraints that LWG 3877 added to and_then and transform. The
lwg3877.cc test now does that.

libstdc++-v3/ChangeLog:

	* include/std/expected (expected::and_then, expected::or_else)
	(expected::transform_error): Use _M_val and _M_unex instead of
	calling value() and error(), as per LWG 3938.
	(expected::transform): Likewise. Remove incorrect std::move
	calls from lvalue overloads.
	(expected<void, E>::and_then, expected<void, E>::or_else)
	(expected<void, E>::transform): Use _M_unex instead of calling
	error().
	* testsuite/20_util/expected/lwg3877.cc: Add checks for and_then
	and transform, and for std::expected<void, E>.
	* testsuite/20_util/expected/lwg3938.cc: New test.

(cherry picked from commit fe94f8b7e022b7e154f6c47cc292d4463bddac5e)
2023-06-06 23:58:17 +01:00
Jonathan Wakely b14121a2ac libstdc++: Implement LWG 3877 for std::expected monadic ops
This was approved in Issaquah 2023. As well as fixing the value
categories, this fixes the fact that we were incorrectly testing E
instead of T in the or_else constraints.

libstdc++-v3/ChangeLog:

	* include/std/expected (expected::and_then, expected::or_else)
	(expected::transform, expected::transform_error): Fix exception
	specifications as per LWG 3877.
	(expected<void, E>::and_then, expected<void, E>::transform):
	Likewise.
	* testsuite/20_util/expected/lwg3877.cc: New test.

(cherry picked from commit ba490492e51834db645a3165d14f2ba0af62a8c7)
2023-06-06 23:58:17 +01:00
Andrew Pinski 044ee48215 Fix PR 110085: make clean in GCC directory on sh target causes a failure
On sh target, there is a MULTILIB_DIRNAMES (or is it MULTILIB_OPTIONS) named m2,
this conflicts with the langauge m2. So when you do a `make clean`, it will remove
the m2 directory and then a build will fail. Now since r0-78222-gfa9585134f6f58,
the multilib directories are no longer created in the gcc directory as libgcc
was moved to the toplevel. So we can remove the part of clean that removes those
directories.

Tested on x86_64-linux-gnu and a cross to sh-elf that `make clean` followed by
`make` works again.

Committed as approved.

gcc/ChangeLog:

	PR bootstrap/110085
	* Makefile.in (clean): Remove the removing of
	MULTILIB_DIR/MULTILIB_OPTIONS directories.

(cherry picked from commit afd87299cefd021daf0158d5b6276c37013996b9)
2023-06-06 14:31:13 -07:00
Jonathan Wakely c0a5790430 libstdc++: Make std::filesystem::copy_file work for procfs [PR108178]
The size reported by stat is always zero for some special files such as
those under /proc, which means the current copy_file implementation
thinks there is nothing to copy. Instead of trusting the stat value, try
to read a character from a streambuf and check for EOF.

For the backport, we also need to avoid trying to use sendfile when stat
reports a zero size, so that we use streambufs to copy the file.

libstdc++-v3/ChangeLog:

	PR libstdc++/108178
	* src/filesystem/ops-common.h (do_copy_file): Check for empty
	files by trying to read a character.
	* testsuite/27_io/filesystem/operations/copy_file_108178.cc:
	New test.

(cherry picked from commit 07a0e108247f23fcb919c61595adae143f1ea02a)
2023-06-06 15:07:44 +01:00
Jonathan Wakely bae27ba9de libstdc++: Use close-on-exec for file descriptors in filesystem::copy_file
libstdc++-v3/ChangeLog:

	* src/filesystem/ops-common.h (do_copy_file) [O_CLOEXEC]: Set
	close-on-exec flag on file descriptors.

(cherry picked from commit 7e8e071c4b64f1b6ea5ddf528724fc793a0f0e36)
2023-06-06 14:33:47 +01:00
Jonathan Wakely 32f2b0f328 libstdc++: Fix ambiguous expression in std::array<T, 0>::front() [PR110139]
For 32-bit targets using -pedantic (or using Clang) makes the expression
_M_elems[0] ambiguous.  The overloaded operator[] that we want to call
has a size_t parameter, but 0 is type ptrdiff_t for many ILP32 targets,
so using the implicit conversion from _M_elems to T* and then
subscripting that is also viable.

Change the 0 to (size_type)0 and also make the conversion to T*
explicit, so that's it's not viable here. The latter change requires a
static_cast in data() where we really do want to convert _M_elems to a
pointer.

libstdc++-v3/ChangeLog:

	PR libstdc++/110139
	* include/std/array (__array_traits<T, 0>::operator T*()): Make
	conversion operator explicit.
	(array::front): Use size_type as subscript operand.
	(array::data): Use static_cast to make conversion explicit.
	* testsuite/23_containers/array/element_access/110139.cc: New
	test.

(cherry picked from commit 56001fad4ecc32396beead6644906e3846244b67)
2023-06-06 14:33:47 +01:00
Joseph Faulls ad12d81e59 libstdc++: Do not assume existence of char8_t codecvt facet
It is not required that codecvt<char8_t, char, mbstate_t> facet be
supported by the locale, nor is it added as part of the default locale.
This can lead to dangerous behaviour when static_cast.

libstdc++-v3/ChangeLog:

	* include/bits/locale_classes.tcc: Remove check for
	codecvt<char8_t, char, mbstate_t> facet.

(cherry picked from commit 3d9b3ddb5fc9087c17645d53e6bcb1881e1955a4)
2023-06-06 14:33:46 +01:00
GCC Administrator 34c039cd8a Daily bump. 2023-06-06 00:22:05 +00:00
Iain Buclaw 54422c7e53 d: Warn when declared size of a special enum does not match its intrinsic type.
All special enums have declarations in the D runtime library, but the
compiler will recognize and treat them specially if declared in any
module.  When the underlying base type of a special enum is a different
size to its matched intrinsic, then this can cause undefined behavior at
runtime.  Detect and warn about when such a mismatch occurs.

gcc/d/ChangeLog:

	* gdc.texi (Warnings): Document -Wextra and -Wmismatched-special-enum.
	* implement-d.texi (Special Enums): Add reference to warning option
	-Wmismatched-special-enum.
	* lang.opt: Add -Wextra and -Wmismatched-special-enum.
	* types.cc (TypeVisitor::visit (TypeEnum *)): Warn when declared
	special enum size mismatches its intrinsic type.

gcc/testsuite/ChangeLog:

	* gdc.dg/Wmismatched_enum.d: New test.

(cherry picked from commit 3ad9313a2e28287aa350d9dc3ea7746d8302662d)
2023-06-05 18:51:10 +02:00
GCC Administrator 3e8a0e5b1a Daily bump. 2023-06-05 00:21:10 +00:00
GCC Administrator 4397517b14 Daily bump. 2023-06-04 00:20:45 +00:00
Steve Kargl bedb3eb533 Fortran: fix diagnostics for SELECT RANK [PR100607]
gcc/fortran/ChangeLog:

	PR fortran/100607
	* resolve.cc (resolve_select_rank): Remove duplicate error.
	(resolve_fl_var_and_proc): Prevent NULL pointer dereference and
	suppress error message for temporary.

gcc/testsuite/ChangeLog:

	PR fortran/100607
	* gfortran.dg/select_rank_6.f90: New test.

(cherry picked from commit fae09dfc0e6bf4cfe35d817558827aea78c6426f)
2023-06-03 20:03:42 +02:00
Thomas Neumann 7b21a74b41 fix radix sort on 32bit platforms [PR109670]
The radix sort uses two buffers, a1 for input and a2 for output.
After every digit the role of the two buffers is swapped.
When terminating the sort early the code made sure the output
was in a2.  However, when we run out of bits, as can happen on
32bit platforms, the sorted result was in a1, as we had just
swapped a1 and a2.
This patch fixes the problem by unconditionally having a1 as
output after every loop iteration.

This bug manifested itself only on 32bit platforms and even then
only in some circumstances, as it needs frames where a swap
is required due to differences in the top-most byte, which is
affected by ASLR. The new logic was validated by exhaustive
search over 32bit input values.

libgcc/ChangeLog:
	PR libgcc/109670
	* unwind-dw2-fde.c: Fix radix sort buffer management.
2023-06-03 09:50:51 +02:00
Thomas Neumann fd68f60c4c release the sorted FDE array when deregistering a frame [PR109685]
The atomic fastpath bypasses the code that releases the sort
array which was lazily allocated during unwinding. We now
check after deregistering if there is an array to free.

libgcc/ChangeLog:
	PR libgcc/109685
	* unwind-dw2-fde.c: Free sort array in atomic fast path.
2023-06-03 09:50:38 +02:00
GCC Administrator f980418ba0 Daily bump. 2023-06-03 00:21:17 +00:00
Georg-Johann Lay 7cbaf2f96e target/110088: Improve operation of l-reg with const after move from d-reg.
After reload, there may be sequences like
   lreg = dreg
   lreg = lreg <op> const
with an LD_REGS dreg, non-LD_REGS lreg, and <op> in PLUS, IOR, AND.
If dreg dies after the first insn, it is possible to use
   dreg = dreg <op> const
   lreg = dreg
instead which is more efficient.

gcc/
	PR target/110088
	* config/avr/avr.md: Add an RTL peephole to optimize operations on
	non-LD_REGS after a move from LD_REGS.
	(piaop): New code iterator.
2023-06-02 12:46:09 +02:00
GCC Administrator c3e954f9d8 Daily bump. 2023-06-02 00:21:53 +00:00
Jonathan Wakely 099d469df6 libstdc++: Fix std::abs(__float128) for -NaN and -0.0 [PR109758]
The current implementation of this non-standard overload of std::abs
incorrectly returns a negative value for negative NaNs and negative
zero, because x < 0 is false in both cases.

Use fabsl(long double) or fabsf128(_Float128) if those do the right
thing.  Otherwise, use __builtin_signbit(x) instead of x < 0 to detect
negative inputs. This assumes that __builtin_signbit handles __float128
correctly, but that seems to be true for all of GCC, clang and icc.

libstdc++-v3/ChangeLog:

	PR libstdc++/109758
	* include/bits/std_abs.h (abs(__float128)): Handle negative NaN
	and negative zero correctly.
	* testsuite/26_numerics/headers/cmath/109758.cc: New test.

(cherry picked from commit af595613acbd9863198ae69c7b1c9e856bca9e4f)
2023-06-01 18:11:08 +01:00
Jonathan Wakely 19527073d0 libstdc++: Remove test dependency on _GLIBCXX_USE_C99_STDINT_TR1
This should have been done in r9-2028-g8ba7f29e3dd064 when
std::shared_mutex was changed to be defined without depending on
_GLIBCXX_USE_C99_STDINT_TR1.

libstdc++-v3/ChangeLog:

	* testsuite/experimental/feat-cxx14.cc: Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1.

(cherry picked from commit 2c04284abe5d5f1148c709a769f3b83bee2485d0)
2023-06-01 18:08:29 +01:00
Jonathan Wakely 8c221f315d libstdc++: Remove test dependencies on _GLIBCXX_USE_C99_STDINT_TR1
These #ifdef checks should have been removed in r9-2029-g612c9c702e2c9e
when the u16string_view and u32string_view aliases were changed to be
defined unconditionally.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string_view/typedefs.cc: Remove
	dependency on _GLIBCXX_USE_C99_STDINT_TR1.
	* testsuite/experimental/string_view/typedefs.cc: Likewise.

(cherry picked from commit fe0e3df6f3751a0164c8e92a0d6519f2e10527a8)
2023-06-01 18:08:29 +01:00
Jonathan Wakely cfaacee1f9 libstdc++: Fix PSTL test that fails in C++20
This test fails in C++20 and later due to a warning:

warning: C++20 says that these are ambiguous, even though the second is reversed:
note: candidate 1: 'bool MyClass::operator==(const MyClass&)'
note: candidate 2: 'bool MyClass::operator==(const MyClass&)' (reversed)
note: try making the operator a 'const' member function
FAIL: 26_numerics/pstl/numeric_ops/transform_reduce.cc (test for excess errors)

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/pstl/numeric_ops/transform_reduce.cc:
	Add const to equality operator.

(cherry picked from commit f8403c43045cd56b5f775e1cf12a3f22feca4b58)
2023-06-01 18:08:29 +01:00
Jonathan Wakely d50255d8d2 libstdc++: Document removal of implicit allocator rebinding extensions
Traditionally libstdc++ allowed containers to be
instantiated with allocator's that have the wrong value type, implicitly
rebinding the allocator to the container's value type. Since C++20 that
has been explicitly ill-formed, so the extension is no longer supported
in strict modes (e.g. -std=c++17) and in C++20 and later.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/evolution.xml: Document removal of implicit
	allocator rebinding extensions in strict mode and for C++20.
	* doc/html/*: Regenerate.

(cherry picked from commit 8cbaf679a3c1875c5475bd1cb0fb86fb9d03b2d4)
2023-06-01 18:08:12 +01:00
Jonathan Wakely 81059051f8 libstdc++: Fix -Wnonnull warnings during configure
We should not test for nan by passing it a null pointer, as this can
trigger -Wnonnull warnings.

Also fix an outdated comment about the default -std mode.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_C99_TR1): Use a non-null pointer
	to check for nan, nanf, and nanl.
	* configure: Regenerate.

(cherry picked from commit 6190a74ebee69415b501996821c92f60d892fb81)
2023-06-01 17:22:53 +01:00
Jonathan Wakely 2162c2082d libstdc++: Require tzdb support for chrono::zoned_time printer test
libstdc++-v3/ChangeLog:

	* testsuite/libstdc++-prettyprinters/chrono.cc: Only test
	printer for chrono::zoned_time for cx11 ABI and tzdb effective
	target.

(cherry picked from commit 151bad410218d266e16b90da0147d57f9d661c1a)
2023-06-01 17:22:19 +01:00
Jonathan Wakely b05b8c9a1f libstdc++: Fix <chrono> pretty printers and add tests
This fixes a couple of errors in the printers for chrono types, and adds
tests to ensure they keep working.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdChronoDurationPrinter):
	Print floating-point durations correctly.
	(StdChronoTimePointPrinter): Support printing only the value,
	not the type name. Uncomment handling for known clocks.
	(StdChronoZonedTimePrinter): Remove type names from output.
	(StdChronoCalendarPrinter): Fix hh_mm_ss member access.
	(StdChronoTimeZonePrinter): Add equals sign to output.
	* testsuite/libstdc++-prettyprinters/chrono.cc: New test.

(cherry picked from commit 7bd251ca751317385f7e2e4e031736a99f376012)
2023-06-01 17:21:54 +01:00
Jonathan Wakely 3b95319b62 doc: Fix description of x86 -m32 option [PR109954]
This option does not imply -march=i386 so it's incorrect to say it
generates code that will run on "any i386 system".

gcc/ChangeLog:

	PR target/109954
	* doc/invoke.texi (x86 Options): Fix description of -m32 option.

(cherry picked from commit eeb92704967875411416b0b9508aa6f49e8192fd)
2023-06-01 13:00:44 +01:00
GCC Administrator ab72fb45a0 Daily bump. 2023-06-01 00:21:18 +00:00
GCC Administrator c9e208b213 Daily bump. 2023-05-31 00:21:11 +00:00
Alexandre Oliva 7d92616a9b [libstdc++] [testsuite] xfail double-prec from_chars for x86_64 ldbl
When long double is wider than double, but from_chars is implemented
in terms of double, tests that involve the full precision of long
double are expected to fail.  Mark them as such on x86_64-*-vxworks*.

for  libstdc++-v3/ChangeLog

	* testsuite/20_util/from_chars/4.cc: Skip long double test06
	on x86_64-vxworks.
	* testsuite/20_util/to_chars/long_double.cc: Xfail run on
	x86_64-vxworks.

(cherry picked from commit 282e4e745981c5c6e3edaae315e1f499a45402df)
2023-05-30 18:46:26 -03:00
Christophe Lyon becd6794c6 testsuite: make mve_intrinsic_type_overloads-int.c libc-agnostic
Glibc defines int32_t as 'int' while newlib defines it as 'long int'.

Although these correspond to the same size, g++ complains when using the
'wrong' version:
  invalid conversion from 'long int*' to 'int32_t*' {aka 'int*'} [-fpermissive]
or
  invalid conversion from 'int*' to 'int32_t*' {aka 'long int*'} [-fpermissive]

when calling vst1q(int32*, int32x4_t) with a first parameter of type
'long int *' (resp. 'int *')

To make this test pass with any type of toolchain, this patch defines
'word_type' according to which libc is in use.

2023-05-23  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c:
	Support both definitions of int32_t.

(cherry picked from commit d12d2aa4fccc76a9a08c8120c5e37d9cab8683e8)
2023-05-30 15:50:07 +00:00
Matthias Kretz 717a14e727 libstdc++: Correct NTTP and simd_mask ctor call
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	PR libstdc++/109822
	* include/experimental/bits/simd.h (to_native): Use int NTTP
	as specified in PTS2.
	(to_compatible): Likewise. Add missing tag to call mask
	generator ctor.
	* testsuite/experimental/simd/pr109822_cast_functions.cc: New
	test.

(cherry picked from commit 668d43502f465d48adbc1fe2956b979f36657e5f)
2023-05-30 16:24:24 +02:00
Matthias Kretz 3f90a56c08 libstdc++: Simplify calculation of expected value in simd test
This avoids a failure on PR109964.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/tests/integer_operators.cc:
	Compute expected value differently to avoid getting turned into
	a vector shift.

(cherry picked from commit 3e2689e568425f14d6728504ad6f5d32b90320ad)
2023-05-30 16:24:19 +02:00
Matthias Kretz f51bb83b51 libstdc++: Fix test assumptions on long and long double
Expect that long might not fit into the long double mantissa bits.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/tests/operator_cvt.cc: Make long
	double <-> (u)long conversion tests conditional on sizeof(long
	double) and sizeof(long).

(cherry picked from commit 291549d43e823f163fa9961e42a751b5ce0d57fb)
2023-05-30 16:24:04 +02:00
Matthias Kretz 15aca2cbe9 libstdc++: Resolve -Wsign-compare issue
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_ppc.h (_S_bit_shift_left):
	Negative __y is UB, so prefer signed compare.

(cherry picked from commit 1a1abec1d618cde709c585fcce89330bb33b07ac)
2023-05-30 16:24:02 +02:00
Andreas Schwab acf4fac6c5 riscv: update riscv_asan_shadow_offset
gcc/
	PR target/110036
	* config/riscv/riscv.cc (riscv_asan_shadow_offset): Update to
	match libsanitizer.
2023-05-30 13:16:55 +02:00
GCC Administrator 8f1e18c75e Daily bump. 2023-05-30 00:20:44 +00:00
GCC Administrator 965c44741f Daily bump. 2023-05-29 11:18:40 +00:00
Juzhe-Zhong 98fc9d38db RISC-V: Add local user vsetvl instruction elimination [PR109547]
This patch is to enhance optimization for auto-vectorization.

Before this patch:

Loop:
vsetvl a5,a2...
vsetvl zero,a5...
vle

After this patch:

Loop:
vsetvl a5,a2
vle

gcc/ChangeLog:

	PR target/109547
	* config/riscv/riscv-vsetvl.cc (local_eliminate_vsetvl_insn): New function.
	(vector_insn_info::skip_avl_compatible_p): Ditto.
	(vector_insn_info::merge): Remove default value.
	(pass_vsetvl::compute_local_backward_infos): Ditto.
	(pass_vsetvl::cleanup_insns): Add local vsetvl elimination.
	* config/riscv/riscv-vsetvl.h: Ditto.

gcc/testsuite/ChangeLog:

	PR target/109547
	* gcc.target/riscv/rvv/vsetvl/pr109547.c: New.
	* gcc.target/riscv/rvv/vsetvl/vsetvl-17.c: Update scan
	condition.

(cherry picked from commit d51f2456ee51bd59a79b4725ca0e488c25260bbf)
2023-05-29 14:38:46 +08:00
Kito Cheng 554aabc267 RISC-V: Fix wrong select_kind in riscv_compute_multilib
Seems like I screw up bare-metal toolchian multi lib selection during
finxing linux multi-lib selction...

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc (riscv_compute_multilib):
	Fix wrong select_kind...

(cherry picked from commit 008cbecf622a413ebcc8b41a737f30fd7e2a1abf)
2023-05-29 14:38:46 +08:00
Kito Cheng 49d596e90d RISC-V: Suppress unused parameter warning in riscv-common.cc
gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc (riscv_select_multilib_by_abi):
	Drop unused parameter.
	(riscv_select_multilib): Ditto.
	(riscv_compute_multilib): Update call site of
	riscv_select_multilib_by_abi and riscv_select_multilib_by_abi.

(cherry picked from commit 7a7f6b26259d22115ee4813ce130622ad1073d16)
2023-05-29 14:38:46 +08:00
Kito Cheng 6f0eb99c9b RISC-V: Handle multi-lib path correclty for linux
RISC-V Linux encodes the ABI into the path, so in theory, we can only use that
to select multi-lib paths, and no way to use different multi-lib paths between
`rv32i/ilp32` and `rv32ima/ilp32`, we'll mapping both to `/lib/ilp32`.

It's hard to do that with GCC's builtin multi-lib selection mechanism; builtin
mechanism did the option string compare and then enumerate all possible reuse
rules during the build time. However, it's impossible to RISC-V; we have a huge
number of combinations of `-march`, so implementing a customized multi-lib
selection becomes the only solution.

Multi-lib configuration is only used for determines which ISA should be used
when compiling the corresponding ABI variant after this patch.

During the multi-lib selection stage, only consider -mabi as the only key to
select the multi-lib path.

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc (riscv_select_multilib_by_abi): New.
	(riscv_select_multilib): New.
	(riscv_compute_multilib): Extract logic to riscv_select_multilib and
	also handle select_by_abi.
	* config/riscv/elf.h (RISCV_USE_CUSTOMISED_MULTI_LIB): Change it
	to select_by_abi_arch_cmodel from 1.
	* config/riscv/linux.h (RISCV_USE_CUSTOMISED_MULTI_LIB): Define.
	* config/riscv/riscv-opts.h (enum riscv_multilib_select_kind): New.

(cherry picked from commit 17d683d4d3dc95d13096ec52ad9937a2b011f9a4)
2023-05-29 14:38:45 +08:00
Juzhe-Zhong b5e24772a3 RISC-V: Fix ternary instruction attribute bug
Fix bug of vector.md which generate incorrect information to
VSETVL PASS when testing FMA auto vectorization ternop-3.c.

Signed-off-by: Juzhe-Zhong <juzhe.zhong@rivai.ai>

gcc/ChangeLog:

	* config/riscv/vector.md: Fix vimuladd instruction bug.

(cherry picked from commit f8af48d8755018272cdb0cf2f250cf278829d7be)
2023-05-29 14:38:45 +08:00