Commit Graph

200195 Commits

Author SHA1 Message Date
Ian Lance Taylor 9df1f362e0 compiler, libgo: support bootstrapping gc compiler
In the Go 1.21 release the package internal/profile imports
internal/lazyregexp.  That works when bootstrapping with Go 1.17,
because that compiler has internal/lazyregep and permits importing it.
We also have internal/lazyregexp in libgo, but since it is not installed
it is not available for importing.  This CL adds internal/lazyregexp
to the list of internal packages that are installed for bootstrapping.

The Go 1.21, and earlier, releases have a couple of functions in
the internal/abi package that are always fully intrinsified.
The gofrontend recognizes and intrinsifies those functions as well.
However, the gofrontend was also building function descriptors
for references to the functions without calling them, which
failed because there was nothing to refer to.  That is OK for the
gc compiler, which guarantees that the functions are only called,
not referenced.  This CL arranges to not generate function descriptors
for these functions.

For golang/go#60913

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/504798
2023-06-23 16:15:56 -07:00
Jason Merrill b7e9dd97c8 c++: fix PR110102 backport
The argument for is_xible changed from list to vec in GCC 14.

gcc/cp/ChangeLog:

	* call.cc (maybe_init_list_as_array): Build a list.
2023-06-23 13:16:22 -04:00
Jason Merrill be1e122bd2 c++: init-list of uncopyable type [PR110102]
The maybe_init_list_as_range optimization is a form of copy elision, but we
can only elide well-formed copies.

	PR c++/110102

gcc/cp/ChangeLog:

	* call.cc (maybe_init_list_as_array): Check that the element type is
	copyable.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/initlist-opt1.C: New test.
2023-06-23 10:49:10 -04:00
Jason Merrill dc7f1bfbe5 c++: fix explicit/copy problem [PR109247]
In the testcase, the user wants the assignment to use the operator= declared
in the class, but because [over.match.list] says that explicit constructors
are also considered for list-initialization, as affirmed in CWG1228, we end
up choosing the implicitly-declared copy assignment operator, using the
explicit constructor template for the argument, which is ill-formed.  Other
implementations haven't implemented CWG1228, so we keep getting bug reports.

Discussion in CWG led to the idea for this targeted relaxation: if we use an
explicit constructor for the conversion to the argument of a copy or move
special member function, that makes the candidate worse than another.

	DR 2735
	PR c++/109247

gcc/cp/ChangeLog:

	* call.cc (sfk_copy_or_move): New.
	(joust): Add tiebreaker for explicit conv and copy ctor.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/initlist-explicit3.C: New test.
2023-06-23 10:49:10 -04:00
Richard Biener 9da2ef362f tree-optimization/110298 - CFG cleanup and stale nb_iterations
When unrolling we eventually kill nb_iterations info since it may
refer to removed SSA names.  But we do this only after cleaning
up the CFG which in turn can end up accessing it.  Fixed by
swapping the two.

	PR tree-optimization/110298
	* tree-ssa-loop-ivcanon.cc (tree_unroll_loops_completely):
	Clear number of iterations info before cleaning up the CFG.

	* gcc.dg/torture/pr110298.c: New testcase.

(cherry picked from commit 916add3bf6e46467e4391e358b11ecfbc4daa275)
2023-06-23 12:29:30 +02:00
Richard Biener 0b69fea6cf debug/110295 - mixed up early/late debug for member DIEs
When we process a scope typedef during early debug creation and
we have already created a DIE for the type when the decl is
TYPE_DECL_IS_STUB and this DIE is still in limbo we end up
just re-parenting that type DIE instead of properly creating
a DIE for the decl, eventually picking up the now completed
type and creating DIEs for the members.  Instead this is currently
defered to the second time we come here, when we annotate the
DIEs with locations late where now the type DIE is no longer
in limbo and we fall through doing the job for the decl.

The following makes sure we perform the necessary early tasks
for this by continuing with the decl DIE creation after setting
a parent for the limbo type DIE.

	PR debug/110295
	* dwarf2out.cc (process_scope_var): Continue processing
	the decl after setting a parent in case the existing DIE
	was in limbo.

	* g++.dg/debug/pr110295.C: New testcase.

(cherry picked from commit 963f87f8a65ec82f503ac4334a3da83b0a8a43b2)
2023-06-23 12:29:30 +02:00
Richard Biener b0856bb588 middle-end/110055 - avoid CLOBBERing static variables
The gimplifier can elide initialized constant automatic variables
to static storage in which case TARGET_EXPR gimplification needs
to avoid emitting a CLOBBER for them since their lifetime is no
longer limited.  Failing to do so causes spurious dangling-pointer
diagnostics on the added testcase for some targets.

	PR middle-end/110055
	* gimplify.cc (gimplify_target_expr): Do not emit
	CLOBBERs for variables which have static storage duration
	after gimplifying their initializers.

	* g++.dg/warn/Wdangling-pointer-pr110055.C: New testcase.

(cherry picked from commit 84eec2916fa68cd2e2b3a2cf764f2ba595cce843)
2023-06-23 11:17:49 +02:00
Richard Biener a737da4885 ipa/109983 - (IPA) PTA speedup
This improves the edge avoidance heuristic by re-ordering the
topological sort of the graph to make sure the component with
the ESCAPED node is processed first.  This improves the number
of created edges which directly correlates with the number
of bitmap_ior_into calls from 141447426 to 239596 and the
compile-time from 1083s to 3s.  It also improves the compile-time
for the related PR109143 from 81s to 27s.

I've modernized the topological sorting API on the way as well.

	PR ipa/109983
	PR tree-optimization/109143
	* tree-ssa-structalias.cc (struct topo_info): Remove.
	(init_topo_info): Likewise.
	(free_topo_info): Likewise.
	(compute_topo_order): Simplify API, put the component
	with ESCAPED last so it's processed first.
	(topo_visit): Adjust.
	(solve_graph): Likewise.

(cherry picked from commit 95e5c38a98cc64a797b1d766a20f8c0d0c807a74)
2023-06-23 11:16:39 +02:00
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