Commit Graph

200187 Commits

Author SHA1 Message Date
GCC Administrator fd8fc2c2ef Daily bump. 2023-06-23 00:20:49 +00:00
GCC Administrator d116ce7610 Daily bump. 2023-06-22 00:20:21 +00:00
GCC Administrator fedfab9d88 Daily bump. 2023-06-21 00:21:27 +00:00
Alex Coplan 4eb01f9876 aarch64: Allow compiler to define ls64 builtins [PR110132]
This patch refactors the ls64 builtins to allow the compiler to define them
directly instead of having wrapper functions in arm_acle.h. This should be not
only easier to maintain, but it makes two important correctness fixes:
 - It fixes PR110132, where the builtins ended up getting declared with
   invisible bindings in the C FE, so the FE ended up synthesizing
   incompatible implicit definitions for these builtins.
 - It allows the builtins to be used with LTO, which didn't work previously.

We also take the opportunity to add test coverage from C++ for these
builtins.

gcc/ChangeLog:

	PR target/110132
	* config/aarch64/aarch64-builtins.cc (aarch64_general_simulate_builtin):
	New. Use it ...
	(aarch64_init_ls64_builtins): ... here. Switch to declaring public ACLE
	names for builtins.
	(aarch64_general_init_builtins): Ensure we invoke the arm_acle.h
	setup if in_lto_p, just like we do for SVE.
	* config/aarch64/arm_acle.h: (__arm_ld64b): Delete.
	(__arm_st64b): Delete.
	(__arm_st64bv): Delete.
	(__arm_st64bv0): Delete.

gcc/testsuite/ChangeLog:

	PR target/110132
	* lib/target-supports.exp (check_effective_target_aarch64_asm_FUNC_ok):
	Extend to ls64.
	* g++.target/aarch64/acle/acle.exp: New.
	* g++.target/aarch64/acle/ls64.C: New test.
	* g++.target/aarch64/acle/ls64_lto.C: New test.
	* gcc.target/aarch64/acle/ls64_lto.c: New test.
	* gcc.target/aarch64/acle/pr110132.c: New test.

(cherry picked from commit 9963029a24f2d2510b82e7106fae3f364da33c5d)
2023-06-20 22:21:27 +01:00
Alex Coplan 9df688cbf9 aarch64: Fix wrong code with st64b builtin [PR110100]
The st64b pattern incorrectly had an output constraint on the register
operand containing the destination address for the store, leading to
wrong code. This patch fixes that.

gcc/ChangeLog:

	PR target/110100
	* config/aarch64/aarch64-builtins.cc (aarch64_expand_builtin_ls64):
	Use input operand for the destination address.
	* config/aarch64/aarch64.md (st64b): Fix constraint on address
	operand.

gcc/testsuite/ChangeLog:

	PR target/110100
	* gcc.target/aarch64/acle/pr110100.c: New test.

(cherry picked from commit 737a0b749a7bc3e7cb904ea2d4b18dc130514b85)
2023-06-20 22:21:26 +01:00
Alex Coplan ff00fa1914 aarch64: Fix whitespace in ls64 builtin implementation [PR110100]
The ls64 builtin code was using incorrect GNU style with eight spaces where
there should be a tab. Fixed thusly.

gcc/ChangeLog:

	PR target/110100
	* config/aarch64/aarch64-builtins.cc (aarch64_init_ls64_builtins_types):
	Replace eight consecutive spaces with tabs.
	(aarch64_init_ls64_builtins): Likewise.
	(aarch64_expand_builtin_ls64): Likewise.
	* config/aarch64/aarch64.md (ld64b): Likewise.
	(st64b): Likewise.
	(st64bv): Likewise
	(st64bv0): Likewise.

(cherry picked from commit 713613541254039a34e1dd8fd4a613a299af1fd6)
2023-06-20 22:21:26 +01:00
Ian Lance Taylor 4ac89ab358 runtime: use a C function to call mmap
The final argument to mmap, of type off_t, varies.
In CL 445375 we changed it to always use the C off_t type,
but that broke 32-bit big-endian Linux systems.  On those systems,
using the C off_t type requires calling the mmap64 function.
In C this is automatically handled by the <sys/mman.h> file.
In Go, we would have to change the magic //extern comment to
call mmap64 when appropriate.  Rather than try to get that right,
we instead go through a C function that uses C implicit type
conversions to pick the right type.

Fixes PR go/110297

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/504415
2023-06-20 09:57:20 -07:00
Kewen Lin 4b4a21c934 testsuite: Check int128 effective target for pr109932-{1,2}.c [PR110230]
This patch is to make newly added test cases pr109932-{1,2}.c
check int128 effective target to avoid unsupported type error
on 32-bit.  I did hit this failure during testing and fixed
it, but made a stupid mistake not updating the local formatted
patch which was actually out of date.

	PR testsuite/110230
	PR target/109932

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr109932-1.c: Adjust with int128 effective target.
	* gcc.target/powerpc/pr109932-2.c: Ditto.

(cherry picked from commit 16eb9d69079d769b2aa2c07ce54aca20f5547c14)
2023-06-19 22:21:11 -05:00
Kewen Lin 4e67d73ee5 rs6000: Guard __builtin_{un,}pack_vector_int128 with vsx [PR109932]
As PR109932 shows, builtins __builtin_{un,}pack_vector_int128
should be guarded under vsx rather than power7, as their
corresponding bif patterns have the conditions TARGET_VSX
and VECTOR_MEM_ALTIVEC_OR_VSX_P (V1TImode).  This patch is to
move __builtin_{un,}pack_vector_int128 to stanza vsx to ensure
their supports.

	PR target/109932

gcc/ChangeLog:

	* config/rs6000/rs6000-builtins.def (__builtin_pack_vector_int128,
	__builtin_unpack_vector_int128): Move from stanza power7 to vsx.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr109932-1.c: New test.
	* gcc.target/powerpc/pr109932-2.c: New test.

(cherry picked from commit ff83d1b47aadcdaf80a4fda84b0dc00bb2cd3641)
2023-06-19 22:21:11 -05:00
Kewen Lin cefe925fe4 rs6000: Don't use TFmode for 128 bits fp constant in toc [PR110011]
As PR110011 shows, when encoding 128 bits fp constant into
toc, we adopts REAL_VALUE_TO_TARGET_LONG_DOUBLE which is
to find the first float mode with LONG_DOUBLE_TYPE_SIZE
bits of precision, it would be TFmode here.  But the 128
bits fp constant can be with mode IFmode or KFmode, which
doesn't necessarily have the same underlying float format
as the one of TFmode, like this PR exposes, with option
-mabi=ibmlongdouble TFmode has ibm_extended_format while
KFmode has ieee_quad_format, mixing up the formats (the
encoding/decoding ways) would cause unexpected results.

This patch is to make it use constant's own mode instead
of TFmode for real_to_target call.

	PR target/110011

gcc/ChangeLog:

	* config/rs6000/rs6000.cc (output_toc): Use the mode of the 128-bit
	floating constant itself for real_to_target call.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr110011.c: New test.

(cherry picked from commit 388809f2afde874180da0669c669e241037eeba0)
2023-06-19 22:21:11 -05:00
GCC Administrator 8bed12134d Daily bump. 2023-06-20 00:21:43 +00:00
GCC Administrator a5b089b183 Daily bump. 2023-06-19 00:21:06 +00:00
GCC Administrator 7e178d0478 Daily bump. 2023-06-18 00:21:11 +00:00
GCC Administrator 4ca87c85ce Daily bump. 2023-06-17 00:21:49 +00:00
Vladimir N. Makarov 5568d224f2 RA: Constrain class of pic offset table pseudo to general regs
On some targets an integer pseudo can be assigned to a FP reg.  For
pic offset table pseudo it means we will reload the pseudo in this
case and, as a consequence, memory containing the pseudo might be
recognized as wrong one.  The patch fix this problem.

        PR target/109541

gcc/ChangeLog:

	* ira-costs.cc: (find_costs_and_classes): Constrain classes of pic
	offset table pseudo to a general reg subset.

gcc/testsuite/ChangeLog:

	* gcc.target/sparc/pr109541.c: New.
2023-06-16 15:28:06 -04:00
GCC Administrator 0ba1be4c4d Daily bump. 2023-06-16 00:21:38 +00:00
Eric Botcazou 3b66becf77 ada: Fix internal error on loop iterator filter with -gnatVa
The problem is that the condition of the iterator filter is expanded early,
before it is integrated into an if statement of the loop body, so there is
no place to attach the actions generated by this expansion.

This happens only for simple loops, i.e. with a parameter specification, so
the fix uses the same approach for them as for loops based on iterators.

gcc/ada/

	* sinfo.ads (Iterator_Filter): Document field.
	* sem_ch5.adb (Analyze_Iterator_Specification): Move comment around.
	(Analyze_Loop_Parameter_Specification): Only preanalyze the iterator
	filter, if any.
	* exp_ch5.adb (Expand_N_Loop_Statement): Analyze the new list built
	when an iterator filter is present.
2023-06-15 16:46:50 +02:00
Lulu Cheng f829733b5c LoongArch: Avoid non-returning indirect jumps through $ra [PR110136]
Micro-architecture unconditionally treats a "jr $ra" as "return from subroutine",
hence doing "jr $ra" would interfere with both subroutine return prediction and
the more general indirect branch prediction.

Therefore, a problem like PR110136 can cause a significant increase in branch error
prediction rate and affect performance. The same problem exists with "indirect_jump".

gcc/ChangeLog:

	PR target/110136
	* config/loongarch/loongarch.md: Modify the register constraints for template
	"jumptable" and "indirect_jump" from "r" to "e".

Co-authored-by: Andrew Pinski <apinski@marvell.com>

(cherry picked from commit 5430c86e71927492399129f3df80824c6c334ddf)
2023-06-15 16:26:02 +08:00
GCC Administrator 523dc26b63 Daily bump. 2023-06-15 00:21:26 +00:00
Jakub Jelinek a79f49f934 i386: Fix up whitespace in assembly
I've noticed that standard_sse_constant_opcode emits some spurious
whitespace around tab, that isn't something which is done for
any other instruction and looks wrong.

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

	* config/i386/i386.cc (standard_sse_constant_opcode): Remove
	superfluous spaces around \t for vpcmpeqd.

(cherry picked from commit 1c188877bfc5a4aee3f777f0d4d60500bc222b54)
2023-06-14 17:49:00 +02:00
liuhongt 66f8f9b35f Use x instead of v for alternative 2 (v, BH) in mov<mode>_internal.
Since there's no evex version for vpcmpeq ymm, ymm, ymm.

gcc/ChangeLog:

	PR target/110227
	* config/i386/sse.md (mov<mode>_internal>): Use x instead of v
	for alternative 2 since there's no evex version for vpcmpeqd
	ymm, ymm, ymm.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr110227.c: New test.
2023-06-14 16:19:44 +08:00
GCC Administrator 0cdaf87f03 Daily bump. 2023-06-14 00:21:27 +00:00
Richard Biener 09c6f003aa Fix disambiguation against .MASK_LOAD
Alias analysis was treating .MASK_LOAD as storing a full vector
which means we disambiguate against decls of smaller than vector size.
This complements the previous patch handling .MASK_STORE and fixes
runtime execution FAILs of gfortran.dg/matmul_3.f90 and
gfortran.dg/inline_sum_2.f90 when using AVX512 with full masked loop
vectorization on Zen4.

	* tree-ssa-alias.cc (ref_maybe_used_by_call_p_1): For
	.MASK_LOAD and friends set the size of the access to unknown.

(cherry picked from commit 1c3661e224e3ddfc6f773b095740c0f5a7ddf5fc)
2023-06-13 12:39:18 +02:00
Richard Biener 6955c36ab3 Fix disambiguation against .MASK_STORE
Alias analysis was treating .MASK_STORE as storing a full vector
which means we disambiguate against decls of smaller than vector size.
That's of course wrong and a similar issue was fixed for DSE already.
The following makes sure we set the size of the access to unknown
and only constrain max_size.

This fixes runtime execution FAILs of gfortran.dg/matmul_2.f90,
gfortran.dg/matmul_6.f90 and gfortran.dg/pr91577.f90 when using
AVX512 with full masked loop vectorization on Zen4.

	* tree-ssa-alias.cc (call_may_clobber_ref_p_1): For
	.MASK_STORE and friend set the size of the access to
	unknown.

(cherry picked from commit 8d3eb3ad5388d2f523e4a6f886c4b3364f77f51f)
2023-06-13 12:39:18 +02:00
Alexandre Oliva 5e5b66f49d fix frange_nextafter odr violation
C++ requires inline functions to be declared inline and defined in
every translation unit that uses them.  frange_nextafter is used in
gimple-range-op.cc but it's only defined as inline in
range-op-float.cc.  Drop the extraneous inline specifier.

Other non-static inline functions in range-op-float.cc are not
referenced elsewhere, so I'm making them static.


for  gcc/ChangeLog

	* range-op-float.cc (frange_nextafter): Drop inline.
	(frelop_early_resolve): Add static.
	(frange_float): Likewise.

(cherry picked from commit d438b67e005bf8fc9e4af26410bf69816c30e969)
2023-06-13 05:27:33 -03:00
GCC Administrator b69596f7cc Daily bump. 2023-06-13 00:21:51 +00:00
Richard Biener 73ae34bb69 middle-end/110200 - genmatch force-leaf and convert interaction
The following fixes code GENERIC generation for (convert! ...)
which currently generates

  if (TREE_TYPE (_o1[0]) != type)
    _r1 = fold_build1_loc (loc, NOP_EXPR, type, _o1[0]);
    if (EXPR_P (_r1))
      goto next_after_fail867;
  else
    _r1 = _o1[0];

where obviously braces are missing.

	PR middle-end/110200
	* genmatch.cc (expr::gen_transform): Put braces around
	the if arm for the (convert ...) short-cut.

(cherry picked from commit 820d1aec89c43dbbc70d3d0b888201878388454c)
2023-06-12 11:02:15 +02:00
GCC Administrator d67b4ecf5c Daily bump. 2023-06-12 00:21:28 +00:00
GCC Administrator 2bfa8b687e Daily bump. 2023-06-11 00:21:25 +00:00
Georg-Johann Lay 6165b233ec target/109650: Fix wrong code after cc0 -> CCmode transition.
This patch fixes a wrong-code bug in the wake of PR92729, the transition that
turned the AVR backend from cc0 to CCmode.  In cc0, the insn that uses cc0 like
a conditional branch always follows the cc0 setter, which is no more the case
with CCmode where set and use of REG_CC might be in different basic blocks.

This patch removes the machine-dependent reorg pass in avr_reorg entirely.

It is replaced by a new, AVR specific mini-pass that runs prior to split2.
Canonicalization of comparisons away from the "difficult" codes GT[U] and LE[U]
is now mostly performed by implementing TARGET_CANONICALIZE_COMPARISON.

Moreover:

* Text peephole conditions get "dead_or_set_regno_p (*, REG_CC)" as needed.

* RTL peephole conditions get "peep2_regno_dead_p (*, REG_CC)" as needed.

* Conditional branches no more clobber REG_CC.

* insn output for compares looks ahead to determine the branch mode in use.
  This needs also "dead_or_set_regno_p (*, REG_CC)".

* Add RTL peepholes for decrement-and-branch detection.

* Some of the patterns like "*cmphi.zero-extend.0" lost their
  combine-ational part wit PR92729.  Restore them.

Finally, it fixes some of the many indentation glitches left over from PR92729.

gcc/
	PR target/109650
	PR target/92729
	Backport from 2023-05-10 master r14-1688.
	* config/avr/avr-passes.def (avr_pass_ifelse): Insert new pass.
	* config/avr/avr.cc (avr_pass_ifelse): New RTL pass.
	(avr_pass_data_ifelse): New pass_data for it.
	(make_avr_pass_ifelse, avr_redundant_compare, avr_cbranch_cost)
	(avr_canonicalize_comparison, avr_out_plus_set_ZN)
	(avr_out_cmp_ext): New functions.
	(compare_condtition): Make sure REG_CC dies in the branch insn.
	(avr_rtx_costs_1): Add computation of cbranch costs.
	(avr_adjust_insn_length) [ADJUST_LEN_ADD_SET_ZN, ADJUST_LEN_CMP_ZEXT]:
	[ADJUST_LEN_CMP_SEXT]Handle them.
	(TARGET_CANONICALIZE_COMPARISON): New define.
	(avr_simplify_comparison_p, compare_diff_p, avr_compare_pattern)
	(avr_reorg_remove_redundant_compare, avr_reorg): Remove functions.
	(TARGET_MACHINE_DEPENDENT_REORG): Remove define.
	* config/avr/avr-protos.h (avr_simplify_comparison_p): Remove proto.
	(make_avr_pass_ifelse, avr_out_plus_set_ZN, cc_reg_rtx)
	(avr_out_cmp_zext): New Protos
	* config/avr/avr.md (branch, difficult_branch): Don't split insns.
	(*cbranchhi.zero-extend.0", *cbranchhi.zero-extend.1")
	(*swapped_tst<mode>, *add.for.eqne.<mode>): New insns.
	(*cbranch<mode>4): Rename to cbranch<mode>4_insn.
	(define_peephole): Add dead_or_set_regno_p(insn,REG_CC) as needed.
	(define_deephole2): Add peep2_regno_dead_p(*,REG_CC) as needed.
	Add new RTL peepholes for decrement-and-branch and *swapped_tst<mode>.
	Rework signtest-and-branch peepholes for *sbrx_branch<mode>.
	(adjust_len) [add_set_ZN, cmp_zext]: New.
	(QIPSI): New mode iterator.
	(ALLs1, ALLs2, ALLs4, ALLs234): New mode iterators.
	(gelt): New code iterator.
	(gelt_eqne): New code attribute.
	(rvbranch, *rvbranch, difficult_rvbranch, *difficult_rvbranch)
	(branch_unspec, *negated_tst<mode>, *reversed_tst<mode>)
	(*cmpqi_sign_extend): Remove insns.
	(define_c_enum "unspec") [UNSPEC_IDENTITY]: Remove.
	* config/avr/avr-dimode.md (cbranch<mode>4): Canonicalize comparisons.
	* config/avr/predicates.md (scratch_or_d_register_operand): New.
	* config/avr/constraints.md (Yxx): New constraint.

gcc/testsuite/
	PR target/109650
	Backport from 2023-05-10 master r14-1688.
	* gcc.target/avr/torture/pr109650-1.c: New test.
	* gcc.target/avr/torture/pr109650-2.c: New test.
2023-06-10 22:24:00 +02:00
GCC Administrator d722a0f665 Daily bump. 2023-06-10 00:21:45 +00:00
Andrew Pinski 682bbd3647 MATCH: Fix zero_one_valued_p not to match signed 1 bit integers
So for the attached testcase, we assumed that zero_one_valued_p would
be the value [0,1] but currently zero_one_valued_p matches also
signed 1 bit integers.
This changes that not to match that and fixes the 2 new testcases at
all optimization levels.

OK for GCC 13? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

	PR tree-optimization/110165
	PR tree-optimization/110166

gcc/ChangeLog:

	* match.pd (zero_one_valued_p): Don't accept
	signed 1-bit integers.

gcc/testsuite/ChangeLog:

	* gcc.c-torture/execute/pr110165-1.c: New test.
	* gcc.c-torture/execute/pr110166-1.c: New test.

(cherry picked from commit 72e652f3425079259faa4edefe1dc571f72f91e0)
2023-06-09 07:55:43 -07:00
Richard Biener b6118b8155 middle-end/110182 - TYPE_PRECISION on VECTOR_TYPE causes wrong-code
When folding two conversions in a row we use TYPE_PRECISION but
that's invalid for VECTOR_TYPE.  The following fixes this by
using element_precision instead.

	middle-end/110182
	* match.pd (two conversions in a row): Use element_precision
	to DTRT for VECTOR_TYPE.

(cherry picked from commit 3e12669a0eb968cfcbe9242b382fd8020935edf8)
2023-06-09 11:08:40 +02:00
Iain Sandoe 46e585c5c3 Darwin, PPC: Fix struct layout with pragma pack [PR110044].
This bug was essentially that darwin_rs6000_special_round_type_align()
was ignoring externally-imposed capping of field alignment.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

	PR target/110044

gcc/ChangeLog:

	* config/rs6000/rs6000.cc (darwin_rs6000_special_round_type_align):
	Make sure that we do not have a cap on field alignment before altering
	the struct layout based on the type alignment of the first entry.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/darwin-abi-13-0.c: New test.
	* gcc.target/powerpc/darwin-abi-13-1.c: New test.
	* gcc.target/powerpc/darwin-abi-13-2.c: New test.
	* gcc.target/powerpc/darwin-structs-0.h: New test.

(cherry picked from commit 84d080a29a780973bef47171ba708ae2f7b4ee47)
2023-06-09 09:19:27 +01:00
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