aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2024-06-13MIPS: Use FPU-enabled tune for mips32/mips64/mips64r2/mips64r3/mips64r5YunQiang Su1-5/+5
Currently, the default tune value of mips32 is PROCESSOR_4KC, and the default tune value of mips64/mips64r2/mips64r3/mips64r5 is PROCESSOR_5KC. PROCESSOR_4KC and PROCESSOR_5KC are both FPU-less. Let's use PROCESSOR_24KF1_1 for mips32, and PROCESSOR_5KF for mips64/ mips64r2/mips64r3/mips64r5. We find this problem when we try to fix gcc.target/mips/movcc-3.c. gcc: * config/mips/mips-cpus.def: Use PROCESSOR_24KF1_1 for mips32; Use PROCESSOR_5KF for mips64/mips64r2/mips64r3/mips64r5.
2024-06-13MIPS: Use signaling fcmp instructions for LT/LE/LTGTYunQiang Su5-11/+61
LT/LE: c.lt.fmt/c.le.fmt on pre-R6 and cmp.lt.fmt/cmp.le.fmt have different semantic: c.lt.fmt will signal for all NaN, including qNaN; cmp.lt.fmt will only signal sNaN, while not qNaN; cmp.slt.fmt has the same semantic as c.lt.fmt; lt/le of RTL will signaling qNaN. while in `s<code>_<SCALARF:mode>_using_<FPCC:mode>`, RTL operation `lt`/`le` are convert to c/cmp's lt/le, which is correct for C.cond.fmt, while not for CMP.cond.fmt. Let's convert them to slt/sle if ISA_HAS_CCF. For LTGT, which signals qNaN, `sne` of r6 has same semantic, while pre-R6 has only inverse one `ngl`. Thus for RTL we have to use the `uneq` as the operator, and introduce a new CC mode: CCEmode to mark it as signaling. This patch can fix gcc.dg/torture/pr91323.c for pre-R6; gcc.dg/torture/builtin-iseqsig-* for R6. gcc: * config/mips/mips-modes.def: New CC_MODE CCE. * config/mips/mips-protos.h(mips_output_compare): New function. * config/mips/mips.cc(mips_allocate_fcc): Set CCEmode count=1. (mips_emit_compare): Use CCEmode for LTGT/LT/LE for pre-R6. (mips_output_compare): New function. Convert lt/le to slt/sle for R6; convert ueq to ngl for CCEmode. (mips_hard_regno_mode_ok_uncached): Mention CCEmode. * config/mips/mips.h: Mention CCEmode for LOAD_EXTEND_OP. * config/mips/mips.md(FPCC): Add CCE. (define_mode_iterator MOVECC): Mention CCE. (define_mode_attr reg): Add CCE with "z". (define_mode_attr fpcmp): Add CCE with "c". (define_code_attr fcond): ltgt should use sne instead of ne. (s<code>_<SCALARF:mode>_using_<FPCC:mode>): call mips_output_compare.
2024-06-13[APX ZU] Support APX zero-upperLingling Kong6-3/+86
Enable ZU for IMUL (opcodes 0x69 and 0x6B) and SETcc. gcc/ChangeLog: * config/i386/i386-opts.h (enum apx_features): Add apx_zu. * config/i386/i386.h (TARGET_APX_ZU): Define. * config/i386/i386.md (*imulhi<mode>zu): New define_insn. (*setcc_<mode>_zu): Ditto. * config/i386/i386.opt: Add enum value for zu. gcc/testsuite/ChangeLog: * gcc.target/i386/apx-zu-1.c: New test. * gcc.target/i386/apx-zu-2.c: New test.
2024-06-13Daily bump.GCC Administrator10-1/+658
2024-06-12c++: visibility wrt concept-id as targ [PR115283]Patrick Palka2-2/+17
Like with alias templates, it seems we don't maintain visibility flags for concepts either, so min_vis_expr_r should ignore them for now. Otherwise after r14-6789 we may incorrectly give a function template that uses a concept-id in its signature internal linkage. PR c++/115283 gcc/cp/ChangeLog: * decl2.cc (min_vis_expr_r) <case TEMPLATE_DECL>: Ignore concepts. gcc/testsuite/ChangeLog: * g++.dg/template/linkage5.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2024-06-12c++: repeated export usingJason Merrill2-2/+17
A sample implementation of module std was breaking because the exports included 'using std::operator&' twice. Since Nathaniel's r15-964 for PR114867, the first using added an extra instance of each function that was revealed/exported by that using, resulting in duplicates for lookup_maybe_add to dedup. But if the duplicate is the first thing in the list, lookup_add doesn't make an OVERLOAD, so trying to set OVL_USING_P crashes. Fixed by using ovl_make in the case where we want to set the flag. gcc/cp/ChangeLog: * tree.cc (lookup_maybe_add): Use ovl_make when setting OVL_USING_P. gcc/testsuite/ChangeLog: * g++.dg/modules/using-21_a.C: New test.
2024-06-12c++: module std and exception_ptrJason Merrill2-2/+19
exception_ptr.h contains namespace __exception_ptr { class exception_ptr; } using __exception_ptr::exception_ptr; so when module std tries to 'export using std::exception_ptr', it names another using-directive rather than the class directly, so __exception_ptr is never explicitly opened in module purview. gcc/cp/ChangeLog: * module.cc (depset::hash::add_binding_entity): Set DECL_MODULE_PURVIEW_P instead of asserting. gcc/testsuite/ChangeLog: * g++.dg/modules/using-20_a.C: New test.
2024-06-12c++: fix testcase diagnosticsJason Merrill1-2/+2
The r15-1180 adjustments to this testcase broke a couple of tests in C++26 mode. gcc/testsuite/ChangeLog: * g++.dg/cpp26/static_assert1.C: Fix diagnostic typos.
2024-06-12Whitespace cleanup for target-supports.expPatrick O'Neill1-584/+584
This patch removes trailing whitespace and replaces leading groups of 8-16 spaces with tabs. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Cleanup whitespace.
2024-06-12pretty_printer: unbreak build on aarch64 [PR115465]David Malcolm1-1/+1
I missed this target-specific usage of pretty_printer::buffer when making the fields private in r15-1209-gc5e3be456888aa; sorry. gcc/ChangeLog: PR bootstrap/115465 * config/aarch64/aarch64-early-ra.cc (early_ra::process_block): Update for fields of pretty_printer becoming private in r15-1209-gc5e3be456888aa. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-06-12RISC-V: Allow any temp register to be used in amo testsPatrick O'Neill12-24/+24
We artifically restrict the temp registers to be a[0-9]+ when other registers like t[0-9]+ are valid too. Update to make the regex accept any register for the temp value. gcc/testsuite/ChangeLog: * gcc.target/riscv/amo/amo-table-a-6-load-1.c: Update temp register regex. * gcc.target/riscv/amo/amo-table-a-6-load-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-load-3.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-store-1.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-store-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-store-compat-3.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-load-1.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-load-2.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-load-3.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-store-1.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-store-2.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-store-3.c: Ditto. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
2024-06-12RISC-V: Fix amoadd call argumentsPatrick O'Neill26-26/+26
Update __atomic_add_fetch arguments to be a pointer and value rather than two pointers. gcc/testsuite/ChangeLog: * gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c: Update __atomic_add_fetch args. * gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-1.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-2.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-3.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-4.c: Ditto. * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-5.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-1.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-2.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-3.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-4.c: Ditto. * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-5.c: Ditto. * gcc.target/riscv/amo/amo-zaamo-preferred-over-zalrsc.c: Ditto. * gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c: Ditto. * gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c: Ditto. * gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c: Ditto. * gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c: Ditto. * gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c: Ditto. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
2024-06-12RISC-V: Move amo tests into subfolderPatrick O'Neill73-0/+41
There's a large number of atomic related testcases in the riscv folder. Move them into a subfolder similar to what was done for rvv testcases. gcc/testsuite/ChangeLog: * gcc.target/riscv/amo-table-a-6-amo-add-1.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-amo-add-1.c: ...here. * gcc.target/riscv/amo-table-a-6-amo-add-2.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-amo-add-2.c: ...here. * gcc.target/riscv/amo-table-a-6-amo-add-3.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-amo-add-3.c: ...here. * gcc.target/riscv/amo-table-a-6-amo-add-4.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-amo-add-4.c: ...here. * gcc.target/riscv/amo-table-a-6-amo-add-5.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-amo-add-5.c: ...here. * gcc.target/riscv/amo-table-a-6-compare-exchange-1.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-1.c: ...here. * gcc.target/riscv/amo-table-a-6-compare-exchange-2.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-2.c: ...here. * gcc.target/riscv/amo-table-a-6-compare-exchange-3.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-3.c: ...here. * gcc.target/riscv/amo-table-a-6-compare-exchange-4.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-4.c: ...here. * gcc.target/riscv/amo-table-a-6-compare-exchange-5.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-5.c: ...here. * gcc.target/riscv/amo-table-a-6-compare-exchange-6.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-6.c: ...here. * gcc.target/riscv/amo-table-a-6-compare-exchange-7.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-compare-exchange-7.c: ...here. * gcc.target/riscv/amo-table-a-6-fence-1.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-fence-1.c: ...here. * gcc.target/riscv/amo-table-a-6-fence-2.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-fence-2.c: ...here. * gcc.target/riscv/amo-table-a-6-fence-3.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-fence-3.c: ...here. * gcc.target/riscv/amo-table-a-6-fence-4.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-fence-4.c: ...here. * gcc.target/riscv/amo-table-a-6-fence-5.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-fence-5.c: ...here. * gcc.target/riscv/amo-table-a-6-load-1.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-load-1.c: ...here. * gcc.target/riscv/amo-table-a-6-load-2.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-load-2.c: ...here. * gcc.target/riscv/amo-table-a-6-load-3.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-load-3.c: ...here. * gcc.target/riscv/amo-table-a-6-store-1.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-store-1.c: ...here. * gcc.target/riscv/amo-table-a-6-store-2.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-store-2.c: ...here. * gcc.target/riscv/amo-table-a-6-store-compat-3.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-store-compat-3.c: ...here. * gcc.target/riscv/amo-table-a-6-subword-amo-add-1.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-1.c: ...here. * gcc.target/riscv/amo-table-a-6-subword-amo-add-2.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-2.c: ...here. * gcc.target/riscv/amo-table-a-6-subword-amo-add-3.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-3.c: ...here. * gcc.target/riscv/amo-table-a-6-subword-amo-add-4.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-4.c: ...here. * gcc.target/riscv/amo-table-a-6-subword-amo-add-5.c: Move to... * gcc.target/riscv/amo/amo-table-a-6-subword-amo-add-5.c: ...here. * gcc.target/riscv/amo-table-ztso-amo-add-1.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-amo-add-1.c: ...here. * gcc.target/riscv/amo-table-ztso-amo-add-2.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-amo-add-2.c: ...here. * gcc.target/riscv/amo-table-ztso-amo-add-3.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-amo-add-3.c: ...here. * gcc.target/riscv/amo-table-ztso-amo-add-4.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-amo-add-4.c: ...here. * gcc.target/riscv/amo-table-ztso-amo-add-5.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-amo-add-5.c: ...here. * gcc.target/riscv/amo-table-ztso-compare-exchange-1.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-compare-exchange-1.c: ...here. * gcc.target/riscv/amo-table-ztso-compare-exchange-2.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-compare-exchange-2.c: ...here. * gcc.target/riscv/amo-table-ztso-compare-exchange-3.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-compare-exchange-3.c: ...here. * gcc.target/riscv/amo-table-ztso-compare-exchange-4.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-compare-exchange-4.c: ...here. * gcc.target/riscv/amo-table-ztso-compare-exchange-5.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-compare-exchange-5.c: ...here. * gcc.target/riscv/amo-table-ztso-compare-exchange-6.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-compare-exchange-6.c: ...here. * gcc.target/riscv/amo-table-ztso-compare-exchange-7.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-compare-exchange-7.c: ...here. * gcc.target/riscv/amo-table-ztso-fence-1.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-fence-1.c: ...here. * gcc.target/riscv/amo-table-ztso-fence-2.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-fence-2.c: ...here. * gcc.target/riscv/amo-table-ztso-fence-3.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-fence-3.c: ...here. * gcc.target/riscv/amo-table-ztso-fence-4.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-fence-4.c: ...here. * gcc.target/riscv/amo-table-ztso-fence-5.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-fence-5.c: ...here. * gcc.target/riscv/amo-table-ztso-load-1.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-load-1.c: ...here. * gcc.target/riscv/amo-table-ztso-load-2.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-load-2.c: ...here. * gcc.target/riscv/amo-table-ztso-load-3.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-load-3.c: ...here. * gcc.target/riscv/amo-table-ztso-store-1.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-store-1.c: ...here. * gcc.target/riscv/amo-table-ztso-store-2.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-store-2.c: ...here. * gcc.target/riscv/amo-table-ztso-store-3.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-store-3.c: ...here. * gcc.target/riscv/amo-table-ztso-subword-amo-add-1.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-1.c: ...here. * gcc.target/riscv/amo-table-ztso-subword-amo-add-2.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-2.c: ...here. * gcc.target/riscv/amo-table-ztso-subword-amo-add-3.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-3.c: ...here. * gcc.target/riscv/amo-table-ztso-subword-amo-add-4.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-4.c: ...here. * gcc.target/riscv/amo-table-ztso-subword-amo-add-5.c: Move to... * gcc.target/riscv/amo/amo-table-ztso-subword-amo-add-5.c: ...here. * gcc.target/riscv/amo-zaamo-preferred-over-zalrsc.c: Move to... * gcc.target/riscv/amo/amo-zaamo-preferred-over-zalrsc.c: ...here. * gcc.target/riscv/amo-zalrsc-amo-add-1.c: Move to... * gcc.target/riscv/amo/amo-zalrsc-amo-add-1.c: ...here. * gcc.target/riscv/amo-zalrsc-amo-add-2.c: Move to... * gcc.target/riscv/amo/amo-zalrsc-amo-add-2.c: ...here. * gcc.target/riscv/amo-zalrsc-amo-add-3.c: Move to... * gcc.target/riscv/amo/amo-zalrsc-amo-add-3.c: ...here. * gcc.target/riscv/amo-zalrsc-amo-add-4.c: Move to... * gcc.target/riscv/amo/amo-zalrsc-amo-add-4.c: ...here. * gcc.target/riscv/amo-zalrsc-amo-add-5.c: Move to... * gcc.target/riscv/amo/amo-zalrsc-amo-add-5.c: ...here. * gcc.target/riscv/inline-atomics-1.c: Move to... * gcc.target/riscv/amo/inline-atomics-1.c: ...here. * gcc.target/riscv/inline-atomics-2.c: Move to... * gcc.target/riscv/amo/inline-atomics-2.c: ...here. * gcc.target/riscv/inline-atomics-3.c: Move to... * gcc.target/riscv/amo/inline-atomics-3.c: ...here. * gcc.target/riscv/inline-atomics-4.c: Move to... * gcc.target/riscv/amo/inline-atomics-4.c: ...here. * gcc.target/riscv/inline-atomics-5.c: Move to... * gcc.target/riscv/amo/inline-atomics-5.c: ...here. * gcc.target/riscv/inline-atomics-6.c: Move to... * gcc.target/riscv/amo/inline-atomics-6.c: ...here. * gcc.target/riscv/inline-atomics-7.c: Move to... * gcc.target/riscv/amo/inline-atomics-7.c: ...here. * gcc.target/riscv/inline-atomics-8.c: Move to... * gcc.target/riscv/amo/inline-atomics-8.c: ...here. * gcc.target/riscv/pr114130.c: Move to... * gcc.target/riscv/amo/pr114130.c: ...here. * gcc.target/riscv/pr89835.c: Move to... * gcc.target/riscv/amo/pr89835.c: ...here. * gcc.target/riscv/amo/amo.exp: New file. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
2024-06-12aarch64: Use bitreverse rtl code instead of unspec [PR115176]Andrew Pinski6-19/+10
Bitreverse rtl code was added with r14-1586-g6160572f8d243c. So let's use it instead of an unspec. This is just a small cleanup but it does have one small fix with respect to rtx costs which didn't handle vector modes correctly for the UNSPEC and now it does. This is part of the first step in adding __builtin_bitreverse's builtins but it is independent of it though. Bootstrapped and tested on aarch64-linux-gnu with no regressions. gcc/ChangeLog: PR target/115176 * config/aarch64/aarch64-simd.md (aarch64_rbit<mode><vczle><vczbe>): Use bitreverse instead of unspec. * config/aarch64/aarch64-sve-builtins-base.cc (svrbit): Convert over to using rtx_code_function instead of unspec_based_function. * config/aarch64/aarch64-sve.md: Update comment where RBIT is included. * config/aarch64/aarch64.cc (aarch64_rtx_costs): Handle BITREVERSE like BSWAP. Remove UNSPEC_RBIT support. * config/aarch64/aarch64.md (unspec): Remove UNSPEC_RBIT. (aarch64_rbit<mode>): Use bitreverse instead of unspec. * config/aarch64/iterators.md (SVE_INT_UNARY): Add bitreverse. (optab): Likewise. (sve_int_op): Likewise. (SVE_INT_UNARY): Remove UNSPEC_RBIT. (optab): Likewise. (sve_int_op): Likewise. (min_elem_bits): Likewise. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-06-12match: Improve gimple_bitwise_equal_p and gimple_bitwise_inverted_equal_p ↵Andrew Pinski3-10/+48
for truncating casts [PR115449] As mentioned by Jeff in r15-831-g05daf617ea22e1d818295ed2d037456937e23530, we don't handle `(X | Y) & ~Y` -> `X & ~Y` on the gimple level when there are some different signed (but same precision) types dealing with matching `~Y` with the `Y` part. This improves both gimple_bitwise_equal_p and gimple_bitwise_inverted_equal_p to be able to say `(truncate)a` and `(truncate)a` are bitwise_equal and that `~(truncate)a` and `(truncate)a` are bitwise_invert_equal. Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/115449 gcc/ChangeLog: * gimple-match-head.cc (gimple_maybe_truncate): New declaration. (gimple_bitwise_equal_p): Match truncations that differ only in types with the same precision. (gimple_bitwise_inverted_equal_p): For matching after bit_not_with_nop call gimple_bitwise_equal_p. * match.pd (maybe_truncate): New match pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/bitops-10.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-06-12Move cexpr_stree tree string build into utility functionAndi Kleen3-4/+16
No semantics changes. gcc/cp/ChangeLog: * cp-tree.h (extract): Add new overload to return tree. * parser.cc (cp_parser_asm_string_expression): Use tree extract. * semantics.cc (cexpr_str::extract): Add new overload to return tree.
2024-06-12middle-end: Drop __builtin_prefetch calls in autovectorization [PR114061]Victor Do Nascimento4-2/+31
At present the autovectorizer fails to vectorize simple loops involving calls to `__builtin_prefetch'. A simple example of such loop is given below: void foo(double * restrict a, double * restrict b, int n){ int i; for(i=0; i<n; ++i){ a[i] = a[i] + b[i]; __builtin_prefetch(&(b[i+8])); } } The failure stems from two issues: 1. Given that it is typically not possible to fully reason about a function call due to the possibility of side effects, the autovectorizer does not attempt to vectorize loops which make such calls. Given the memory reference passed to `__builtin_prefetch', in the absence of assurances about its effect on the passed memory location the compiler deems the function unsafe to vectorize, marking it as clobbering memory in `vect_find_stmt_data_reference'. This leads to the failure in autovectorization. 2. Notwithstanding the above issue, though the prefetch statement would be classed as `vect_unused_in_scope', the loop invariant that is used in the address of the prefetch is the scalar loop's and not the vector loop's IV. That is, it still uses `i' and not `vec_iv' because the instruction wasn't vectorized, causing DCE to think the value is live, such that we now have both the vector and scalar loop invariant actively used in the loop. This patch addresses both of these: 1. About the issue regarding the memory clobber, data prefetch does not generate faults if its address argument is invalid and does not write to memory. Therefore, it does not alter the internal state of the program or its control flow under any circumstance. As such, it is reasonable that the function be marked as not affecting memory contents. To achieve this, we add the necessary logic to `get_references_in_stmt' to ensure that builtin functions are given given the same treatment as internal functions. If the gimple call is to a builtin function and its function code is `BUILT_IN_PREFETCH', we mark `clobbers_memory' as false. 2. Finding precedence in the way clobber statements are handled, whereby the vectorizer drops these from both the scalar and vectorized versions of a given loop, we choose to drop prefetch hints in a similar fashion. This seems appropriate given how software prefetch hints are typically ignored by processors across architectures, as they seldom lead to performance gain over their hardware counterparts. gcc/ChangeLog: PR tree-optimization/114061 * tree-data-ref.cc (get_references_in_stmt): set `clobbers_memory' to false for __builtin_prefetch. * tree-vect-loop.cc (vect_transform_loop): Drop all __builtin_prefetch calls from loops. gcc/testsuite/ChangeLog: * gcc.dg/vect/vect-prefetch-drop.c: New test. * gcc.target/aarch64/vect-prefetch-drop.c: Likewise.
2024-06-12pretty_printer: convert chunk_info into a classDavid Malcolm4-55/+90
No functional change intended. gcc/cp/ChangeLog: * error.cc (append_formatted_chunk): Move part of body into chunk_info::append_formatted_chunk. gcc/ChangeLog: * dumpfile.cc (dump_pretty_printer::emit_items): Update for changes to chunk_info. * pretty-print.cc (chunk_info::append_formatted_chunk): New, based on code in cp/error.cc's append_formatted_chunk. (chunk_info::pop_from_output_buffer): New, based on code in pp_output_formatted_text and dump_pretty_printer::emit_items. (on_begin_quote): Convert to... (chunk_info::on_begin_quote): ...this. (on_end_quote): Convert to... (chunk_info::on_end_quote): ...this. (pretty_printer::format): Update for chunk_info becoming a class and its fields gaining "m_" prefixes. Update for on_begin_quote and on_end_quote moving to chunk_info. (quoting_info::handle_phase_3): Update for changes to chunk_info. (pp_output_formatted_text): Likewise. Move cleanup code to chunk_info::pop_from_output_buffer. * pretty-print.h (class output_buffer): New forward decl. (class urlifier): New forward decl. (struct chunk_info): Convert to... (class chunk_info): ...this. Add friend class pretty_printer. (chunk_info::get_args): New accessor. (chunk_info::get_quoting_info): New accessor. (chunk_info::append_formatted_chunk): New decl. (chunk_info::pop_from_output_buffer): New decl. (chunk_info::on_begin_quote): New decl. (chunk_info::on_end_quote): New decl. (chunk_info::prev): Rename to... (chunk_info::m_prev): ...this. (chunk_info::args): Rename to... (chunk_info::m_args): ...this. (output_buffer::cur_chunk_array): Drop "struct" from decl. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-06-12pretty_printer: make all fields privateDavid Malcolm50-373/+516
No functional change intended. gcc/analyzer/ChangeLog: * access-diagram.cc (access_range::dump): Update for fields of pretty_printer becoming private. * call-details.cc (call_details::dump): Likewise. * call-summary.cc (call_summary::dump): Likewise. (call_summary_replay::dump): Likewise. * checker-event.cc (checker_event::debug): Likewise. * constraint-manager.cc (range::dump): Likewise. (bounded_range::dump): Likewise. (constraint_manager::dump): Likewise. * engine.cc (exploded_node::dump): Likewise. (exploded_path::dump): Likewise. (exploded_path::dump_to_file): Likewise. * feasible-graph.cc (feasible_graph::dump_feasible_path): Likewise. * program-point.cc (program_point::dump): Likewise. * program-state.cc (extrinsic_state::dump_to_file): Likewise. (sm_state_map::dump): Likewise. (program_state::dump_to_file): Likewise. * ranges.cc (symbolic_byte_offset::dump): Likewise. (symbolic_byte_range::dump): Likewise. * record-layout.cc (record_layout::dump): Likewise. * region-model-reachability.cc (reachable_regions::dump): Likewise. * region-model.cc (region_to_value_map::dump): Likewise. (region_model::dump): Likewise. (model_merger::dump): Likewise. * region-model.h (one_way_id_map<T>::dump): Likewise. * region.cc (region_offset::dump): Likewise. (region::dump): Likewise. * sm-malloc.cc (deallocator_set::dump): Likewise. * store.cc (uncertainty_t::dump): Likewise. (binding_key::dump): Likewise. (bit_range::dump): Likewise. (byte_range::dump): Likewise. (binding_map::dump): Likewise. (binding_cluster::dump): Likewise. (store::dump): Likewise. * supergraph.cc (supergraph::dump_dot_to_file): Likewise. (superedge::dump): Likewise. * svalue.cc (svalue::dump): Likewise. gcc/c-family/ChangeLog: * c-ada-spec.cc (dump_ads): Update for fields of pretty_printer becoming private. * c-pretty-print.cc: Likewise throughout. gcc/c/ChangeLog: * c-objc-common.cc (print_type): Update for fields of pretty_printer becoming private. (c_tree_printer): Likewise. gcc/cp/ChangeLog: * cxx-pretty-print.cc: Update throughout for fields of pretty_printer becoming private. * error.cc: Likewise. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::urls_init): Update for fields of pretty_printer becoming private. (diagnostic_context::print_any_cwe): Likewise. (diagnostic_context::print_any_rules): Likewise. (diagnostic_context::print_option_information): Likewise. * diagnostic.h (diagnostic_format_decoder): Likewise. (diagnostic_prefixing_rule): Likewise, fixing typo. * digraph.cc (test_dump_to_dot): Likewise. * digraph.h (digraph<GraphTraits>::dump_dot_to_file): Likewise. * dumpfile.cc (dump_pretty_printer::emit_any_pending_textual_chunks): Likewise. * gimple-pretty-print.cc (print_gimple_stmt): Likewise. (print_gimple_expr): Likewise. (print_gimple_seq): Likewise. (dump_ssaname_info_to_file): Likewise. (gimple_dump_bb): Likewise. * graph.cc (print_graph_cfg): Likewise. (start_graph_dump): Likewise. * langhooks.cc (lhd_print_error_function): Likewise. * lto-wrapper.cc (print_lto_docs_link): Likewise. * pretty-print.cc (pp_set_real_maximum_length): Convert to... (pretty_printer::set_real_maximum_length): ...this. (pp_clear_state): Convert to... (pretty_printer::clear_state): ...this. (pp_wrap_text): Update for pp_remaining_character_count_for_line becoming a member function. (urlify_quoted_string): Update for fields of pretty_printer becoming private. (pp_format): Convert to... (pretty_printer::format): ...this. Reduce the scope of local variables "old_line_length" and "old_wrapping_mode" and make const. Reduce the scope of locals "args", "new_chunk_array", "curarg", "any_unnumbered", and "any_numbered". (pp_output_formatted_text): Update for fields of pretty_printer becoming private. (pp_flush): Likewise. (pp_really_flush): Likewise. (pp_set_line_maximum_length): Likewise. (pp_set_prefix): Convert to... (pretty_printer::set_prefix): ...this. (pp_take_prefix): Update for fields of pretty_printer gaining "m_" prefixes. (pp_destroy_prefix): Likewise. (pp_emit_prefix): Convert to... (pretty_printer::emit_prefix): ...this. (pretty_printer::pretty_printer): Update both ctors for fields gaining "m_" prefixes. (pretty_printer::~pretty_printer): Likewise for dtor. (pp_append_text): Update for pp_emit_prefix becoming pretty_printer::emit_prefix. (pp_remaining_character_count_for_line): Convert to... (pretty_printer::remaining_character_count_for_line): ...this. (pp_character): Update for above change. (pp_maybe_space): Convert to... (pretty_printer::maybe_space): ...this. (pp_begin_url): Convert to... (pretty_printer::begin_url): ...this. (get_end_url_string): Update for fields of pretty_printer becoming private. (pp_end_url): Convert to... (pretty_printer::end_url): ...this. (selftest::test_pretty_printer::test_pretty_printer): Update for fields of pretty_printer becoming private. (selftest::test_urls): Likewise. (selftest::test_null_urls): Likewise. (selftest::test_urlification): Likewise. * pretty-print.h (pp_line_cutoff): Convert from macro to inline function. (pp_prefixing_rule): Likewise. (pp_wrapping_mode): Likewise. (pp_format_decoder): Likewise. (pp_needs_newline): Likewise. (pp_indentation): Likewise. (pp_translate_identifiers): Likewise. (pp_show_color): Likewise. (pp_buffer): Likewise. (pp_get_prefix): Add forward decl to allow friend decl. (pp_take_prefix): Likewise. (pp_destroy_prefix): Likewise. (class pretty_printer): Fix typo in leading comment. Add "friend" decls for the various new accessor functions that were formerly macros and for pp_get_prefix, pp_take_prefix, and pp_destroy_prefix. Make all fields private. (pretty_printer::set_output_stream): New. (pretty_printer::set_prefix): New decl. (pretty_printer::emit_prefix): New decl. (pretty_printer::format): New decl. (pretty_printer::maybe_space): New decl. (pretty_printer::supports_urls_p): New. (pretty_printer::get_url_format): New. (pretty_printer::set_url_format): New. (pretty_printer::begin_url): New decl. (pretty_printer::end_url): New decl. (pretty_printer::set_verbatim_wrapping): New. (pretty_printer::set_padding): New. (pretty_printer::get_padding): New. (pretty_printer::clear_state): New decl. (pretty_printer::set_real_maximum_length): New decl. (pretty_printer::remaining_character_count_for_line): New decl. (pretty_printer::buffer): Rename to... (pretty_printer::m_buffer): ...this. (pretty_printer::prefix): Rename to... (pretty_printer::m_prefix): ...this; (pretty_printer::padding): Rename to... (pretty_printer::m_padding): ...this; (pretty_printer::maximum_length): Rename to... (pretty_printer::m_maximum_length): ...this; (pretty_printer::indent_skip): Rename to... (pretty_printer::m_indent_skip): ...this; (pretty_printer::wrapping): Rename to... (pretty_printer::m_wrapping): ...this; (pretty_printer::format_decoder): Rename to... (pretty_printer::m_format_decoder): ...this; (pretty_printer::emitted_prefix): Rename to... (pretty_printer::m_emitted_prefix): ...this; (pretty_printer::need_newline): Rename to... (pretty_printer::m_need_newline): ...this; (pretty_printer::translate_identifiers): Rename to... (pretty_printer::m_translate_identifiers): ...this; (pretty_printer::show_color): Rename to... (pretty_printer::m_show_color): ...this; (pretty_printer::url_format): Rename to... (pretty_printer::m_url_format): ...this; (pp_get_prefix): Reformat. (pp_format_postprocessor): New inline function. (pp_take_prefix): Move decl to before class pretty_printer. (pp_destroy_prefix): Likewise. (pp_set_prefix): Convert to inline function. (pp_emit_prefix): Convert to inline function. (pp_format): Convert to inline function. (pp_maybe_space): Convert to inline function. (pp_begin_url): Convert to inline function. (pp_end_url): Convert to inline function. (pp_set_verbatim_wrapping): Convert from macro to inline function, renaming... (pp_set_verbatim_wrapping_): ...this. * print-rtl.cc (dump_value_slim): Update for fields of pretty_printer becoming private. (dump_insn_slim): Likewise. (dump_rtl_slim): Likewise. * print-tree.cc (print_node): Likewise. * sched-rgn.cc (dump_rgn_dependencies_dot): Likewise. * text-art/canvas.cc (canvas::print_to_pp): Likewise. (canvas::debug): Likewise. (selftest::test_canvas_urls): Likewise. * text-art/dump.h (dump_to_file): Likewise. * text-art/selftests.cc (selftest::assert_canvas_streq): Likewise. * text-art/style.cc (style::print_changes): Likewise. * text-art/styled-string.cc (styled_string::from_fmt_va): Likewise. * tree-diagnostic-path.cc (control_flow_tests): Update for pp_show_color becoming an inline function. * tree-loop-distribution.cc (dot_rdg_1): Update for fields of pretty_printer becoming private. * tree-pretty-print.cc (maybe_init_pretty_print): Likewise. * value-range.cc (vrange::dump): Likewise. (irange_bitmask::dump): Likewise. gcc/fortran/ChangeLog: * error.cc (gfc_clear_pp_buffer): Likewise. (gfc_warning): Likewise. (gfc_warning_check): Likewise. (gfc_error_opt): Likewise. (gfc_error_check): Likewise. gcc/jit/ChangeLog: * jit-recording.cc (recording::function::dump_to_dot): Update for fields of pretty_printer becoming private. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.c (dump_refcnt_info): Update for fields of pretty_printer becoming private. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-06-12pretty_printer: rename instances named "buffer" to "pp"David Malcolm6-1348/+1348
Various pretty_printer instances are named "buffer", but a pretty_printer *has* a buffer, rather than *is* a buffer. For example, pp_buffer (buffer)->digit_buffer is referring to "buffer"'s buffer's digit_buffer. This mechanical patch renames such variables to "pp", which I find much clearer; the above becomes: pp_buffer (pp)->digit_buffer i.e. "pp's buffer's digit_buffer". No functional change intended. Signed-off-by: David Malcolm <dmalcolm@redhat.com> gcc/c-family/ChangeLog: * c-ada-spec.cc: Rename pretty_printer "buffer" to "pp" throughout. gcc/ChangeLog: * gimple-pretty-print.cc: Rename pretty_printer "buffer" to "pp" throughout. * print-tree.cc (print_node): Likewise. * tree-loop-distribution.cc (dot_rdg_1): Likewise. * tree-pretty-print.h (dump_location): Likewise. * value-range.cc (vrange::dump): Likewise. (irange_bitmask::dump): Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-06-12LoongArch: Use bstrins for "value & (-1u << const)"Xi Ruoyao5-0/+49
A move/bstrins pair is as fast as a (addi.w|lu12i.w|lu32i.d|lu52i.d)/and pair, and twice fast as a srli/slli pair. When the src reg and the dst reg happens to be the same, the move instruction can be optimized away. gcc/ChangeLog: * config/loongarch/predicates.md (high_bitmask_operand): New predicate. * config/loongarch/constraints.md (Yy): New constriant. * config/loongarch/loongarch.md (and<mode>3_align): New define_insn_and_split. gcc/testsuite/ChangeLog: * gcc.target/loongarch/bstrins-1.c: New test. * gcc.target/loongarch/bstrins-2.c: New test.
2024-06-12LoongArch: Fix mode size comparision in loongarch_expand_conditional_moveXi Ruoyao1-1/+1
We were comparing a mode size with word_mode, but word_mode is an enum value thus this does not really make any sense. (Un)luckily E_DImode happens to be 8 so this seemed to work, but let's make it correct so it won't blow up when we add LA32 support or add another machine mode... gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_expand_conditional_move): Compare mode size with UNITS_PER_WORD instead of word_mode.
2024-06-12testsuite: Fix expand-return CMSE test for Armv8.1-M [PR115253]Torbjörn SVENSSON1-6/+56
For Armv8.1-M, the clearing of the registers is handled differently than for Armv8-M, so update the test case accordingly. gcc/testsuite/ChangeLog: PR target/115253 * gcc.target/arm/cmse/extend-return.c: Update test case condition for Armv8.1-M. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com>
2024-06-12arm: Zero/Sign extends for CMSE security on Armv8-M.baseline [PR115253]Torbjörn SVENSSON1-8/+68
Properly handle zero and sign extension for Armv8-M.baseline as Cortex-M23 can have the security extension active. Currently, there is an internal compiler error on Cortex-M23 for the epilog processing of sign extension. This patch addresses the following CVE-2024-0151 for Armv8-M.baseline. gcc/ChangeLog: PR target/115253 * config/arm/arm.cc (cmse_nonsecure_call_inline_register_clear): Sign extend for Thumb1. (thumb1_expand_prologue): Add zero/sign extend. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com>
2024-06-12doc: Update Cygwin web linkGerald Pfeifer1-1/+1
gcc: PR target/69374 * doc/install.texi (Specific) <*-*-cygwin>: Update web link.
2024-06-12Widening-Mul: Take gsi after_labels instead of start_bb for gcall insertionPan Li1-1/+1
We inserted the gcall of .SAT_ADD before the gsi_start_bb for avoiding the ssa def after use ICE issue. Unfortunately, there will be the potential ICE when the first stmt is label. We cannot insert the gcall before the label. Thus, we take gsi_after_labels to locate the 'really' stmt that the gcall will insert before. The existing test cases pr115387-1.c and pr115387-2.c cover this change. The below test suites are passed for this patch. * The rv64gcv fully regression test with newlib. * The x86 regression test. * The x86 bootstrap test. gcc/ChangeLog: * tree-ssa-math-opts.cc (math_opts_dom_walker::after_dom_children): Leverage gsi_after_labels instead of gsi_start_bb to skip the leading labels of bb. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-06-12doc: Simplify *-*-linux-gnu dependenciesGerald Pfeifer1-3/+0
Glibc 2.1 was released in 1999, binutils 2.12 in 2002; no need to explicitly list them as dependencies any longer. gcc: PR target/69374 * doc/install.texi (Specific) <*-*-linux-gnu>: Do not list glibc 2.1 and binutils 2.12 as minimum dependencies.
2024-06-12[tree-prof] skip if errors were seen [PR113681]Alexandre Oliva2-1/+24
ipa_tree_profile asserts that the symtab is in IPA_SSA state, but we don't reach that state and ICE if e.g. ipa-strub passes report errors. Skip this pass if errors were seen. for gcc/ChangeLog PR tree-optimization/113681 * tree-profile.cc (pass_ipa_tree_profile::gate): Skip if seen_errors. for gcc/testsuite/ChangeLog PR tree-optimization/113681 * c-c++-common/strub-pr113681.c: New.
2024-06-12[testsuite] [arm] test board cflags in multilib.expAlexandre Oliva1-3/+5
multilib.exp tests for multilib-altering flags in a board's multilib_flags and skips the test, but if such flags appear in the board's cflags, with the same distorting effects on tested multilibs, we fail to skip the test. Extend the skipping logic to board's cflags as well. for gcc/testsuite/ChangeLog * gcc.target/arm/multilib.exp: Skip based on board cflags too.
2024-06-12map packed field type to unpacked for debug infoAlexandre Oliva2-1/+6
We create a distinct type for each field in a packed record with a gnu_size, but there is no distinct debug information for them. Use the same unpacked type for debug information. for gcc/ada/ChangeLog * gcc-interface/decl.cc (gnat_to_gnu_field): Use unpacked type as the debug type for packed fields. for gcc/testsuite/ChangeLog * gnat.dg/bias1.adb: Count occurrences of -7.*DW_AT_GNU_bias.
2024-06-12Daily bump.GCC Administrator9-1/+594
2024-06-12Fix ICE in rtl check due to CONST_WIDE_INT in CONST_VECTOR_DUPLICATE_Pliuhongt2-2/+16
The patch add extra check to make sure the component of CONST_VECTOR is CONST_INT_P. gcc/ChangeLog: PR target/115384 * simplify-rtx.cc (simplify_context::simplify_binary_operation_1): Only do the simplification of (AND (ASHIFTRT A imm) mask) to (LSHIFTRT A imm) when the component of const_vector is CONST_INT_P. gcc/testsuite/ChangeLog: * gcc.target/i386/pr115384.c: New test.
2024-06-11c: Add -std=c2y, -std=gnu2y, -Wc23-c2y-compat, C2Y _Generic with type operandJoseph Myers22-39/+316
The first new C2Y feature, _Generic where the controlling operand is a type name rather than an expression (as defined in N3260), was voted into C2Y today. (In particular, this form of _Generic allows distinguishing qualified and unqualified versions of a type.) This feature also includes allowing the generic associations to specify incomplete and function types. Add this feature to GCC, along with the -std=c2y, -std=gnu2y and -Wc23-c2y-compat options to control when and how it is diagnosed. As usual, the feature is allowed by default in older standards modes, subject to diagnosis with -pedantic, -pedantic-errors or -Wc23-c2y-compat. Bootstrapped with no regressions on x86_64-pc-linux-gnu. gcc/ * doc/cpp.texi (__STDC_VERSION__): Document C2Y handling. * doc/invoke.texi (-Wc23-c2y-compat, -std=c2y, -std=gnu2y): Document options. (-std=gnu23): Update documentation. * doc/standards.texi (C Language): Document C2Y. Update C23 description. * config/rl78/rl78.cc (rl78_option_override): Handle "GNU C2Y" language name. * dwarf2out.cc (highest_c_language, gen_compile_unit_die): Likewise. gcc/c-family/ * c-common.cc (flag_isoc2y): New. (flag_isoc99, flag_isoc11, flag_isoc23): Update comments. * c-common.h (flag_isoc2y): New. (clk_c, flag_isoc23): Update comments. * c-opts.cc (set_std_c2y): New. (c_common_handle_option): Handle OPT_std_c2y and OPT_std_gnu2y. (set_std_c89, set_std_c99, set_std_c11, set_std_c17, set_std_c23): Set flag_isoc2y. (set_std_c23): Update comment. * c.opt (Wc23-c2y-compat, std=c2y, std=gnu2y): New. * c.opt.urls: Regenerate. gcc/c/ * c-errors.cc (pedwarn_c23): New. * c-parser.cc (disable_extension_diagnostics) (restore_extension_diagnostics): Save and restore warn_c23_c2y_compat. (c_parser_generic_selection): Handle type name as controlling operand. Allow incomplete and function types subject to pedwarn_c23 calls. * c-tree.h (pedwarn_c23): New. gcc/testsuite/ * gcc.dg/c23-generic-1.c, gcc.dg/c23-generic-2.c, gcc.dg/c23-generic-3.c, gcc.dg/c23-generic-4.c, gcc.dg/c2y-generic-1.c, gcc.dg/c2y-generic-2.c, gcc.dg/c2y-generic-3.c, gcc.dg/gnu2y-generic-1.c: New tests. * gcc.dg/c23-tag-6.c: Use -pedantic-errors. libcpp/ * include/cpplib.h (CLK_GNUC2Y, CLK_STDC2Y): New. * init.cc (lang_defaults): Add GNUC2Y and STDC2Y entries. (cpp_init_builtins): Define __STDC_VERSION__ to 202500L for GNUC2Y and STDC2Y.
2024-06-12doc: Remove redundant introduction of x86-64Gerald Pfeifer1-2/+0
The same sentence as in the x86_64-*-solaris2* section is in the x86_64-*-* section directly above. gcc: PR target/69374 * doc/install.texi (Specific) <x86_64-*-solaris2*>: Remove redundant introduction of x86-64.
2024-06-11Fix building JIT with musl libc [PR115442]Andrew Pinski1-1/+1
Just like r13-6662-g0e6f87835ccabf but this time for jit/jit-recording.cc. Pushed as obvious after a quick build to make sure jit still builds. gcc/jit/ChangeLog: PR jit/115442 * jit-recording.cc: Define INCLUDE_SSTREAM before including system.h and don't directly incldue sstream. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-06-11vect: Merge loop mask and cond_op mask in fold-left reduction [PR115382].Robin Dapp3-2/+13
Currently we discard the cond-op mask when the loop is fully masked which causes wrong code in gcc.dg/vect/vect-cond-reduc-in-order-2-signed-zero.c when compiled with -O3 -march=cascadelake --param vect-partial-vector-usage=2. This patch ANDs both masks. gcc/ChangeLog: PR tree-optimization/115382 * tree-vect-loop.cc (vectorize_fold_left_reduction): Use prepare_vec_mask. * tree-vect-stmts.cc (check_load_store_for_partial_vectors): Remove static of prepare_vec_mask. * tree-vectorizer.h (prepare_vec_mask): Export.
2024-06-11RISC-V: Add Zalrsc amo-op patternsPatrick O'Neill7-5/+231
All amo<op> patterns can be represented with lrsc sequences. Add these patterns as a fallback when Zaamo is not enabled. gcc/ChangeLog: * config/riscv/sync.md (atomic_<atomic_optab><mode>): New expand pattern. (amo_atomic_<atomic_optab><mode>): Rename amo pattern. (atomic_fetch_<atomic_optab><mode>): New lrsc sequence pattern. (lrsc_atomic_<atomic_optab><mode>): New expand pattern. (amo_atomic_fetch_<atomic_optab><mode>): Rename amo pattern. (lrsc_atomic_fetch_<atomic_optab><mode>): New lrsc sequence pattern. (atomic_exchange<mode>): New expand pattern. (amo_atomic_exchange<mode>): Rename amo pattern. (lrsc_atomic_exchange<mode>): New lrsc sequence pattern. gcc/testsuite/ChangeLog: * gcc.target/riscv/amo-zaamo-preferred-over-zalrsc.c: New test. * gcc.target/riscv/amo-zalrsc-amo-add-1.c: New test. * gcc.target/riscv/amo-zalrsc-amo-add-2.c: New test. * gcc.target/riscv/amo-zalrsc-amo-add-3.c: New test. * gcc.target/riscv/amo-zalrsc-amo-add-4.c: New test. * gcc.target/riscv/amo-zalrsc-amo-add-5.c: New test. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
2024-06-11RISC-V: Add Zalrsc and Zaamo testsuite supportPatrick O'Neill36-37/+95
Convert testsuite infrastructure to use Zalrsc and Zaamo rather than A. gcc/ChangeLog: * doc/sourcebuild.texi: Add docs for atomic extension testsuite infra. gcc/testsuite/ChangeLog: * gcc.target/riscv/amo-table-a-6-amo-add-1.c: Use Zaamo rather than A. * gcc.target/riscv/amo-table-a-6-amo-add-2.c: Ditto. * gcc.target/riscv/amo-table-a-6-amo-add-3.c: Ditto. * gcc.target/riscv/amo-table-a-6-amo-add-4.c: Ditto. * gcc.target/riscv/amo-table-a-6-amo-add-5.c: Ditto. * gcc.target/riscv/amo-table-a-6-compare-exchange-1.c: Use Zalrsc rather than A. * gcc.target/riscv/amo-table-a-6-compare-exchange-2.c: Ditto. * gcc.target/riscv/amo-table-a-6-compare-exchange-3.c: Ditto. * gcc.target/riscv/amo-table-a-6-compare-exchange-4.c: Ditto. * gcc.target/riscv/amo-table-a-6-compare-exchange-5.c: Ditto. * gcc.target/riscv/amo-table-a-6-compare-exchange-6.c: Ditto. * gcc.target/riscv/amo-table-a-6-compare-exchange-7.c: Ditto. * gcc.target/riscv/amo-table-a-6-subword-amo-add-1.c: Use Zaamo rather than A. * gcc.target/riscv/amo-table-a-6-subword-amo-add-2.c: Ditto. * gcc.target/riscv/amo-table-a-6-subword-amo-add-3.c: Ditto. * gcc.target/riscv/amo-table-a-6-subword-amo-add-4.c: Ditto. * gcc.target/riscv/amo-table-a-6-subword-amo-add-5.c: Ditto. * gcc.target/riscv/amo-table-ztso-amo-add-1.c: Add Zaamo option. * gcc.target/riscv/amo-table-ztso-amo-add-2.c: Ditto. * gcc.target/riscv/amo-table-ztso-amo-add-3.c: Ditto. * gcc.target/riscv/amo-table-ztso-amo-add-4.c: Ditto. * gcc.target/riscv/amo-table-ztso-amo-add-5.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-1.c: Use Zalrsc rather than A. * gcc.target/riscv/amo-table-ztso-compare-exchange-2.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-3.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-4.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-5.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-6.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-7.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-1.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-2.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-3.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-4.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-5.c: Ditto. * lib/target-supports.exp: Add testsuite infrastructure support for Zaamo and Zalrsc. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
2024-06-11RISC-V: Add basic Zaamo and Zalrsc supportEdwin Lu11-29/+41
There is a proposal to split the A extension into two parts: Zaamo and Zalrsc. This patch adds basic support by making the A extension imply Zaamo and Zalrsc. Proposal: https://github.com/riscv/riscv-zaamo-zalrsc/tags gcc/ChangeLog: * common/config/riscv/riscv-common.cc: Add Zaamo and Zalrsc. * config/riscv/arch-canonicalize: Make A imply Zaamo and Zalrsc. * config/riscv/riscv.opt: Add Zaamo and Zalrsc * config/riscv/sync.md: Convert TARGET_ATOMIC to TARGET_ZAAMO and TARGET_ZALRSC. gcc/testsuite/ChangeLog: * gcc.target/riscv/attribute-15.c: Adjust expected arch string. * gcc.target/riscv/attribute-16.c: Ditto. * gcc.target/riscv/attribute-17.c: Ditto. * gcc.target/riscv/attribute-18.c: Ditto. * gcc.target/riscv/pr110696.c: Ditto. * gcc.target/riscv/rvv/base/pr114352-1.c: Ditto. * gcc.target/riscv/rvv/base/pr114352-3.c: Ditto. Signed-off-by: Edwin Lu <ewlu@rivosinc.com> Co-authored-by: Patrick O'Neill <patrick@rivosinc.com>
2024-06-11i386: Use CMOV in .SAT_{ADD|SUB} expansion for TARGET_CMOV [PR112600]Uros Bizjak3-11/+55
For TARGET_CMOV targets emit insn sequence involving conditonal move. .SAT_ADD: addl %esi, %edi movl $-1, %eax cmovnc %edi, %eax ret .SAT_SUB: subl %esi, %edi movl $0, %eax cmovnc %edi, %eax ret PR target/112600 gcc/ChangeLog: * config/i386/i386.md (usadd<mode>3): Emit insn sequence involving conditional move for TARGET_CMOVE targets. (ussub<mode>3): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pr112600-a.c: Also scan for cmov. * gcc.target/i386/pr112600-b.c: Ditto.
2024-06-11aarch64: Add vector floating point trunc patternPengxuan Zheng3-3/+31
This patch is a follow-up of r15-1079-g230d62a2cdd16c to add vector floating point trunc pattern for V2DF->V2SF and V4SF->V4HF conversions by renaming the existing aarch64_float_truncate_lo_<mode><vczle><vczbe> pattern to the standard optab one, i.e., trunc<Vwide><mode>2<vczle><vczbe>. This allows the vectorizer to vectorize certain floating point narrowing operations for the aarch64 target. gcc/ChangeLog: * config/aarch64/aarch64-builtins.cc (VAR1): Remap float_truncate_lo_ builtin codes to standard optab ones. * config/aarch64/aarch64-simd.md (aarch64_float_truncate_lo_<mode><vczle><vczbe>): Rename to... (trunc<Vwide><mode>2<vczle><vczbe>): ... This. gcc/testsuite/ChangeLog: * gcc.target/aarch64/trunc-vec.c: New test. Signed-off-by: Pengxuan Zheng <quic_pzheng@quicinc.com>
2024-06-11C++: Support constexpr strings for asm statementsAndi Kleen11-42/+193
Some programing styles use a lot of inline assembler, and it is common to use very complex preprocessor macros to generate the assembler strings for the asm statements. In C++ there would be a typesafe alternative using templates and constexpr to generate the assembler strings, but unfortunately the asm statement requires plain string literals, so this doesn't work. This patch modifies the C++ parser to accept strings generated by constexpr instead of just plain strings. This requires new syntax because e.g. asm("..." : "r" (expr)) would be ambigious with a function call. I chose () to make it unique. For example now you can write constexpr const char *genasm() { return "insn"; } constexpr const char *genconstraint() { return "r"; } asm(genasm() :: (genconstraint()) (input)); The constexpr strings are allowed for the asm template, the constraints and the clobbers (every time current asm accepts a string) This version allows the same constexprs as C++26 static_assert, following Jakub's suggestion. The drawback of this scheme is that the constexpr doesn't have full control over the input/output/clobber lists, but that can be usually handled with a switch statement. One could imagine more flexible ways to handle that, for example supporting constexpr vectors for the clobber list, or similar. But even without that it is already useful. Bootstrapped and full test on x86_64-linux. gcc/c-family/ChangeLog: * c-cppbuiltin.cc (c_cpp_builtins): Define __GXX_CONSTEXPR_ASM__ gcc/cp/ChangeLog: * parser.cc (cp_parser_asm_string_expression): New function to handle constexpr strings for asm. (cp_parser_asm_definition): Use cp_parser_asm_string_expression. (cp_parser_yield_expression): Dito. (cp_parser_asm_specification_opt): Dito. (cp_parser_asm_operand_list): Dito. (cp_parser_asm_clobber_list): Dito. gcc/ChangeLog: * doc/extend.texi: Document constexpr asm. gcc/testsuite/ChangeLog: * g++.dg/ext/asm11.C: Adjust to new error message. * g++.dg/ext/asm9.C: Dito. * g++.dg/parse/asm1.C: Dito. * g++.dg/parse/asm2.C: Dito. * g++.dg/parse/asm3.C: Dito. * g++.dg/cpp1z/constexpr-asm-1.C: New test. * g++.dg/cpp1z/constexpr-asm-2.C: New test. * g++.dg/cpp1z/constexpr-asm-3.C: New test.
2024-06-11Factor out static_assert constexpr string extraction for reuseAndi Kleen4-132/+176
The only semantics changes are slightly more vague error messages to generalize. gcc/cp/ChangeLog: * cp-tree.h (class cexpr_str): Add. * semantics.cc (finish_static_assert): Convert to use cexpr_str. (cexpr_str::type_check): Extract constexpr string code to here. (cexpr_str::extract): ... and here. gcc/testsuite/ChangeLog: * g++.dg/cpp26/static_assert1.C: Update to new error message. * g++.dg/cpp0x/udlit-error1.C: Dito.
2024-06-11scev query mismatch messageAndrew MacLeod1-3/+12
Add a message to the listing if SCEV is not invoked because of a range_query mismatch * gimple-range-fold.cc (range_of_ssa_name_with_loop_info): Issue a message if SCEV is not invoked due to a mismatch.
2024-06-11rust: Do not link with libdl and libpthread unconditionallyArthur Cohen1-1/+4
ChangeLog: * Makefile.tpl: Add CRAB1_LIBS variable. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Check if -ldl and -lpthread are needed, and if so, add them to CRAB1_LIBS. gcc/rust/ChangeLog: * Make-lang.in: Remove overazealous LIBS = -ldl -lpthread line, link crab1 against CRAB1_LIBS.
2024-06-11PR modula2/114529 Avoid ODR violations in bootstrap translated sourcesGaius Mulley124-5605/+8057
This patch changes the bootstrap tool mc to avoid redefining any data types and therefore preventing ODR violations. All exported opaque type usages are implemented as void *. Local opaque type usages (static functions containing opaque type parameters) use the full declaration. mc casts usages between void * and full opaque type as necessary. The --extended-opaque option in mc has been disabled, as this generated ODR violations. The extended-opaque option inlined all declarations in the translated implementation module. As this is no longer used there is now a .h file for each .def file and a .cc file for every .mod file. This results in more Makefile rules for the ppg tool in Make-maintainer.in. gcc/m2/ChangeLog: PR modula2/114529 * Make-lang.in (MC_EXTENDED_OPAQUE): Assign to nothing. * Make-maintainer.in (mc-basetest): New rule. (mc-devel-basetest): New rule. (mc-clean): Remove mc. (m2/mc-boot-gen/$(SRC_PREFIX)decl.cc): Replace --extended-opaque with $(EXTENDED_OPAQUE). (PG-SRC): Move define before generic rules. (PGE-DEF): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)%.h): New rule. (m2/gm2-ppg-boot/$(SRC_PREFIX)libc.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)mcrts.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)UnixArgs.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)Selective.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)termios.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)SysExceptions.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)ldtoa.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)wrapc.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)SYSTEM.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)errno.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)Output.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)%.o): Ditto. (m2/ppg$(exeext)): Ditto. (m2/gm2-ppg-boot/main.o): Ditto. (m2/gm2-auto): Ditto. (c-family/m2pp.o): Ditto. (BUILD-BOOT-PG-H): Correct macro definition. (m2/gm2-pg-boot/$(SRC_PREFIX)%.h): New rule. (m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)Lists.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)Lists.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)Output.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)Output.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)RTco.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)RTco.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.o): Ditto. (BUILD-BOOT-PGE-H): Correct macro definition. (m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Lists.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Output.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Output.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTco.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTco.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o): Ditto. (mc-basetest): Ditto. (mc-devel-basetest): Ditto. * gm2-compiler/M2Options.def (SetM2Dump): Add BOOLEAN return. * gm2-compiler/M2Quads.def (BuildAlignment): Add tokno parameter. (BuildBitLength): Ditto. * gm2-compiler/P3Build.bnf (ByteAlignment): Move tokpos assignment to the start of the block. * gm2-compiler/PCBuild.bnf (ConstSetOrQualidentOrFunction): Ditto. (SetOrDesignatorOrFunction): Ditto. * gm2-compiler/PHBuild.bnf (ConstSetOrQualidentOrFunction): Ditto. (SetOrDesignatorOrFunction): Ditto. (ByteAlignment): Ditto. * gm2-libs/dtoa.def (dtoa): Change mode to INTEGER. * gm2-libs/ldtoa.def (ldtoa): Ditto. * mc-boot-ch/GSYSTEM.c (_M2_SYSTEM_init): Correct parameter list. (_M2_SYSTEM_fini): Ditto. * mc-boot-ch/Gdtoa.cc (dtoa_calcsign): Return bool. (dtoa_dtoa): Return void * and use bool in the fifth parameter. (_M2_dtoa_init): Correct parameter list. (_M2_dtoa_fini): Ditto. * mc-boot-ch/Gerrno.cc (_M2_errno_init): Ditto. (_M2_errno_fini): Ditto. * mc-boot-ch/Gldtoa.cc (dtoa_calcsign): Return bool. (ldtoa_ldtoa): Return void * and use bool in the fifth parameter. (_M2_ldtoa_init): Correct parameter list. (_M2_ldtoa_fini): Ditto. * mc-boot-ch/Glibc.c (tracedb_zresult): New function. (libc_read): Return size_t and use size_t in parameter three. (libc_write): Return size_t and use size_t in parameter three. (libc_printf): Add const to the format specifier. Change declaration of c to use const. (libc_snprintf): Add const to the format specifier. Change declaration of c to use const. (libc_malloc): Use size_t. (libc_memcpy): Ditto. * mc-boot/GASCII.cc: Regenerate. * mc-boot/GArgs.cc: Ditto. * mc-boot/GAssertion.cc: Ditto. * mc-boot/GBreak.cc: Ditto. * mc-boot/GCmdArgs.cc: Ditto. * mc-boot/GDebug.cc: Ditto. * mc-boot/GDynamicStrings.cc: Ditto. * mc-boot/GEnvironment.cc: Ditto. * mc-boot/GFIO.cc: Ditto. * mc-boot/GFormatStrings.cc: Ditto. * mc-boot/GFpuIO.cc: Ditto. * mc-boot/GIO.cc: Ditto. * mc-boot/GIndexing.cc: Ditto. * mc-boot/GM2Dependent.cc: Ditto. * mc-boot/GM2EXCEPTION.cc: Ditto. * mc-boot/GM2RTS.cc: Ditto. * mc-boot/GMemUtils.cc: Ditto. * mc-boot/GNumberIO.cc: Ditto. * mc-boot/GPushBackInput.cc: Ditto. * mc-boot/GRTExceptions.cc: Ditto. * mc-boot/GRTint.cc: Ditto. * mc-boot/GSArgs.cc: Ditto. * mc-boot/GSFIO.cc: Ditto. * mc-boot/GStdIO.cc: Ditto. * mc-boot/GStorage.cc: Ditto. * mc-boot/GStrCase.cc: Ditto. * mc-boot/GStrIO.cc: Ditto. * mc-boot/GStrLib.cc: Ditto. * mc-boot/GStringConvert.cc: Ditto. * mc-boot/GSysStorage.cc: Ditto. * mc-boot/GTimeString.cc: Ditto. * mc-boot/Galists.cc: Ditto. * mc-boot/Gdecl.cc: Ditto. * mc-boot/Gkeyc.cc: Ditto. * mc-boot/Glists.cc: Ditto. * mc-boot/GmcComment.cc: Ditto. * mc-boot/GmcComp.cc: Ditto. * mc-boot/GmcDebug.cc: Ditto. * mc-boot/GmcError.cc: Ditto. * mc-boot/GmcFileName.cc: Ditto. * mc-boot/GmcLexBuf.cc: Ditto. * mc-boot/GmcMetaError.cc: Ditto. * mc-boot/GmcOptions.cc: Ditto. * mc-boot/GmcPreprocess.cc: Ditto. * mc-boot/GmcPretty.cc: Ditto. * mc-boot/GmcPrintf.cc: Ditto. * mc-boot/GmcQuiet.cc: Ditto. * mc-boot/GmcReserved.cc: Ditto. * mc-boot/GmcSearch.cc: Ditto. * mc-boot/GmcStack.cc: Ditto. * mc-boot/GmcStream.cc: Ditto. * mc-boot/Gmcp1.cc: Ditto. * mc-boot/Gmcp2.cc: Ditto. * mc-boot/Gmcp3.cc: Ditto. * mc-boot/Gmcp4.cc: Ditto. * mc-boot/Gmcp5.cc: Ditto. * mc-boot/GnameKey.cc: Ditto. * mc-boot/GsymbolKey.cc: Ditto. * mc-boot/Gvarargs.cc: Ditto. * mc-boot/Gwlists.cc: Ditto. * mc-boot/Gdecl.h: Ditto. * mc-boot/Gldtoa.h: Ditto. * mc-boot/Glibc.h: Ditto. * mc/decl.def (putTypeOpaque): New procedure. (isTypeOpaque): New procedure function. * mc/decl.mod (debugOpaque): New constant. (nodeT): New enumeration field opaquecast. (node): New record field opaquecastF. (opaqueCastState): New record. (opaquecastT): New record. (typeT): New field isOpaque. (varT): New field opaqueState. (arrayT): Ditto. (varparamT): Ditto. (paramT): Ditto. (pointerT): Ditto. (recordfieldT): Ditto. (componentrefT): Ditto. (pointerrefT): Ditto. (arrayrefT): Ditto. (procedureT): Ditto. (proctypeT): Ditto. (makeType): Initialize field isOpaque. (makeTypeImp): Initialize field isOpaque. (putVar): Call initNodeOpaqueCastState. (putReturnType): Ditto. (makeProcType): Ditto. (putProcTypeReturn): Ditto. (makeVarParameter): Ditto. (makeNonVarParameter): Ditto. (makeFuncCall): Ditto. (putTypeOpaque): New procedure. (isTypeOpaque): New procedure function. (doMakeComponentRef): Call initNodeOpaqueCastState. (makePointerRef): Call initNodeOpaqueCastState. (doGetFuncType): Call initNodeOpaqueCastState. (doBinary): Add FALSE parameter to doExprCup. (doDeRefC): Rewrite. (doComponentRefC): Call flushOpaque. (doPointerRefC): Call flushOpaque. (doArrayRefC): Add const_cast for unbounded array. (doExprCup): Rewrite. (doTypeAliasC): Remove. (isDeclType): New procedure function. (doEnumerationC): New procedure function. (doParamTypeEmit): Ditto. (doParamTypeNameModifier): Ditto. (initOpaqueCastState): Ditto. (initNodeOpaqueCastState): Ditto. (setOpaqueCastState): Ditto. (setNodeOpaqueVoidStar): Ditto. (nodeUsesOpaque): Ditto. (getNodeOpaqueVoidStar): Ditto. (getOpaqueFlushNecessary): Ditto. (makeOpaqueCast): Ditto. (flushOpaque): Ditto. (castOpaque): Ditto. (isTypeOpaqueDefImp): Ditto. (isParamVoidStar): Ditto. (isRefVoidStar): Ditto. (isReturnVoidStar): Ditto. (isVarVoidStar): Ditto. (initNodeOpaqueState): Ditto. (assignNodeOpaqueCastState): Ditto. (assignNodeOpaqueCastFalse): Ditto. (dumpOpaqueState): Ditto. (doProcTypeC): Rewrite. (isDeclInImp): New procedure function. (doTypeNameModifier): Ditto. (doTypeC): Emit typedef if enum is declared in this module. (doCompletePartialProcType): Rewrite. (outputCompletePartialProcType): New procedure. (doOpaqueModifier): Ditto. (doVarC): Ditto. (doProcedureHeadingC): Add opaque modifier to return type if necessary. (doReturnC): Cast opaque type for return if necessary. (forceCastOpaque): New procedure. (forceReintCastOpaque): New procedure. (doUnConstCastUnbounded): New procedure. (doAssignmentC): Cast opaque for both des and expr if necessary. (doAdrExprC): Use static_cast for void * casting. (doFuncVarParam): New procedure. (doFuncParamC): Rewrite. (doAdrArgC): Rewrite. (getFunction): New procedure function. (stop): Rename to ... (localstop): ... this. (dupFunccall): Call assignNodeOpaqueCastState. (dbg): Rewrite. (addDone): Rewrite. (addDoneDef): Do not add opaque types to the doneQ when declared in the definition module. * mc/mc.flex (openSource): Return bool. (_M2_mcflex_init): Correct parameter list. (_M2_mcflex_fini): Ditto. * mc/mcComment.h (stdbool.h): Include. (mcComment_initComment): Change unsigned int to bool. * mc/mcOptions.mod (handleOption): Disable --extended-opaque and issue warning. * mc/mcp1.bnf (DefTypeDeclaration): Call putTypeOpaque. gcc/testsuite/ChangeLog: PR modula2/114529 * gm2/base-lang/pass/SYSTEM.def: New test. * gm2/base-lang/pass/base-lang-test.sh: New test. * gm2/base-lang/pass/globalproctype.def: New test. * gm2/base-lang/pass/globalproctype.mod: New test. * gm2/base-lang/pass/globalvar.def: New test. * gm2/base-lang/pass/globalvar.mod: New test. * gm2/base-lang/pass/globalvarassign.def: New test. * gm2/base-lang/pass/globalvarassign.mod: New test. * gm2/base-lang/pass/localproctype.def: New test. * gm2/base-lang/pass/localproctype.mod: New test. * gm2/base-lang/pass/localvar.def: New test. * gm2/base-lang/pass/localvar.mod: New test. * gm2/base-lang/pass/localvarassign.def: New test. * gm2/base-lang/pass/localvarassign.mod: New test. * gm2/base-lang/pass/opaquefield.def: New test. * gm2/base-lang/pass/opaquefield.mod: New test. * gm2/base-lang/pass/opaquenew.def: New test. * gm2/base-lang/pass/opaquenew.mod: New test. * gm2/base-lang/pass/opaqueparam.def: New test. * gm2/base-lang/pass/opaqueparam.mod: New test. * gm2/base-lang/pass/opaquestr.def: New test. * gm2/base-lang/pass/opaqueuse.def: New test. * gm2/base-lang/pass/opaqueuse.mod: New test. * gm2/base-lang/pass/opaqueusestr.def: New test. * gm2/base-lang/pass/opaqueusestr.mod: New test. * gm2/base-lang/pass/opaquevariant.def: New test. * gm2/base-lang/pass/opaquevariant.mod: New test. * gm2/base-lang/pass/opaquevarparam.def: New test. * gm2/base-lang/pass/opaquevarparam.mod: New test. * gm2/base-lang/pass/simplelist.def: New test. * gm2/base-lang/pass/simplelist.mod: New test. * gm2/base-lang/pass/simplelistiter.def: New test. * gm2/base-lang/pass/simplelistiter.mod: New test. * gm2/base-lang/pass/simpleopaque.def: New test. * gm2/base-lang/pass/simpleopaque.mod: New test. * gm2/base-lang/pass/straddress.def: New test. * gm2/base-lang/pass/straddress.mod: New test. * gm2/base-lang/pass/straddressexport.def: New test. * gm2/base-lang/pass/straddressexport.mod: New test. * gm2/base-lang/pass/unboundedarray.def: New test. * gm2/base-lang/pass/unboundedarray.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2024-06-11i386: PR target/115397: AVX512 ternlog vs. -m32 -fPIC constant pool.Roger Sayle2-1/+19
This patch fixes PR target/115397, a recent regression caused by my ternlog patch that results in an ICE (building numpy) with -m32 -fPIC. The problem is that ix86_broadcast_from_constant, which calls get_pool_constant, doesn't handle the UNSPEC_GOTOFF that's created by calling validize_mem when using -fPIC on i686. The logic here is a bit convoluted (and my future patches will clean some of this up), but the simplest fix is to call ix86_broadcast_from_constant between the calls to force_const_mem and the call to validize_mem. Perhaps a better solution might be to call targetm.delegitimize_address from the middle-end's get_pool_constant, but ultimately the best approach would be to not place things in the constant pool if we don't need to. My plans to move (broadcast) constant handling from expand to split1 should simplify this. 2024-06-11 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR target/115397 * config/i386/i386-expand.cc (ix86_expand_ternlog): Move call to ix86_broadcast_from_constant before call to validize_mem, but after call to force_const_mem. gcc/testsuite/ChangeLog PR target/115397 * gcc.target/i386/pr115397.c: New test case.
2024-06-11RISC-V: Implement .SAT_SUB for unsigned vector intPan Li12-5/+437
As the middle support of .SAT_SUB committed, implement the unsigned vector int of .SAT_SUB for the riscv backend. Consider below example code: void __attribute__((noinline)) \ vec_sat_u_sub_##T##_fmt_1 (T *out, T *op_1, T *op_2, unsigned limit) \ { \ unsigned i; \ for (i = 0; i < limit; i++) \ { \ T x = op_1[i]; \ T y = op_2[i]; \ out[i] = (x - y) & (-(T)(x >= y)); \ } \ } Before this patch: ... vsetvli a5,a3,e64,m1,ta,mu slli a4,a5,3 vle64.v v2,0(a1) vle64.v v1,0(a2) vmsgeu.vv v0,v2,v1 vmv1r.v v3,v4 vsub.vv v3,v2,v1,v0.t vse64.v v3,0(a0) ... After this patch: ... vsetvli a5,a3,e64,m1,ta,ma slli a4,a5,3 vle64.v v1,0(a1) vle64.v v2,0(a2) vssubu.vv v1,v1,v2 vse64.v v1,0(a0) ... The below test suites are passed for this patch. * The rv64gcv fully regression test. gcc/ChangeLog: * config/riscv/autovec.md (ussub<mode>3): Add new pattern impl for the unsigned vector modes. * config/riscv/riscv-protos.h (expand_vec_ussub): Add new func decl to expand .SAT_SUB for vector mode. * config/riscv/riscv-v.cc (emit_vec_saddu): Add new func impl to expand .SAT_SUB for vector mode. (emit_vec_binary_alu): Add new helper func to emit binary alu. (expand_vec_ussub): Leverage above helper func. gcc/testsuite/ChangeLog: * gcc.target/riscv/sat_arith.h: Add helper macros for test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-1.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-2.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-3.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-4.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-run-1.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-run-2.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-run-3.c: New test. * gcc.target/riscv/rvv/autovec/binop/vec_sat_u_sub-run-4.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-06-10[committed] [RISC-V] Drop dead round_32 testJeff Law1-23/+0
This test is no longer useful. It doesn't test what it was originally intended to test and there's really no way to recover it sanely. We agreed in the patchwork meeting last week that if we want to test Zfa that we'll write a new test for that. Similarly if we want to do deeper testing of the non-Zfa sequences in this space that we'd write new tests for those as well (execution tests in particular). So dropping this test. gcc/testsuite * gcc.target/riscv/round_32.c: Delete.
2024-06-11Daily bump.GCC Administrator4-1/+340