Commit Graph

205802 Commits

Author SHA1 Message Date
Alex Coplan
06280a906c c-family: Implement __has_feature and __has_extension [PR60512]
This patch implements clang's __has_feature and __has_extension in GCC.
Currently the patch aims to implement all documented features (and some
undocumented ones) following the documentation at
https://clang.llvm.org/docs/LanguageExtensions.html with the exception
of the legacy features for C++ type traits.  These are omitted, since as
the clang documentation notes, __has_builtin is the correct "modern" way
to query for these (which GCC already implements).

gcc/c-family/ChangeLog:

	PR c++/60512
	* c-common.cc (struct hf_feature_info): New.
	(c_common_register_feature): New.
	(init_has_feature): New.
	(has_feature_p): New.
	* c-common.h (c_common_has_feature): New.
	(c_family_register_lang_features): New.
	(c_common_register_feature): New.
	(has_feature_p): New.
	* c-lex.cc (init_c_lex): Plumb through has_feature callback.
	(c_common_has_builtin): Generalize and move common part ...
	(c_common_lex_availability_macro): ... here.
	(c_common_has_feature): New.
	* c-ppoutput.cc (init_pp_output): Plumb through has_feature.

gcc/c/ChangeLog:

	PR c++/60512
	* c-lang.cc (c_family_register_lang_features): New.
	* c-objc-common.cc (struct c_feature_info): New.
	(c_register_features): New.
	* c-objc-common.h (c_register_features): New.

gcc/cp/ChangeLog:

	PR c++/60512
	* cp-lang.cc (c_family_register_lang_features): New.
	* cp-objcp-common.cc (struct cp_feature_selector): New.
	(cp_feature_selector::has_feature): New.
	(struct cp_feature_info): New.
	(cp_register_features): New.
	* cp-objcp-common.h (cp_register_features): New.

gcc/ChangeLog:

	PR c++/60512
	* doc/cpp.texi: Document __has_{feature,extension}.

gcc/objc/ChangeLog:

	PR c++/60512
	* objc-act.cc (struct objc_feature_info): New.
	(objc_nonfragile_abi_p): New.
	(objc_common_register_features): New.
	* objc-act.h (objc_common_register_features): New.
	* objc-lang.cc (c_family_register_lang_features): New.

gcc/objcp/ChangeLog:

	PR c++/60512
	* objcp-lang.cc (c_family_register_lang_features): New.

libcpp/ChangeLog:

	PR c++/60512
	* include/cpplib.h (struct cpp_callbacks): Add has_feature.
	(enum cpp_builtin_type): Add BT_HAS_{FEATURE,EXTENSION}.
	* init.cc: Add __has_{feature,extension}.
	* macro.cc (_cpp_builtin_macro_text): Handle
	BT_HAS_{FEATURE,EXTENSION}.

gcc/testsuite/ChangeLog:

	PR c++/60512
	* c-c++-common/has-feature-common.c: New test.
	* c-c++-common/has-feature-pedantic.c: New test.
	* g++.dg/ext/has-feature.C: New test.
	* gcc.dg/asan/has-feature-asan.c: New test.
	* gcc.dg/has-feature.c: New test.
	* gcc.dg/ubsan/has-feature-ubsan.c: New test.
	* obj-c++.dg/has-feature.mm: New test.
	* objc.dg/has-feature.m: New test.

Co-Authored-By: Iain Sandoe <iain@sandoe.co.uk>
2023-11-27 10:42:55 +00:00
Richard Biener
d9abaa8d58 tree-optimization/112706 - missed simplification of condition
We lack a match.pd pattern recognizing ptr + o ==/!= ptr + o'.
The following extends handling we have for integral types to
pointers.

	PR tree-optimization/112706
	* match.pd (ptr + o ==/!=/- ptr + o'): New patterns.

	* gcc.dg/tree-ssa/pr112706.c: New testcase.
2023-11-27 10:39:59 +01:00
Stefan Schulze Frielinghaus
8e4db85eca s390: Streamline NNPA builtins with their LLVM counterparts
For the opaque NNP-data type prefer unsigned over signed integer types.

gcc/ChangeLog:

	* config/s390/s390-builtin-types.def: Add/remove types.
	* config/s390/s390-builtins.def
	(s390_vclfnhs,s390_vclfnls,s390_vcrnfs,s390_vcfn,s390_vcnf):
	Replace type V8HI with UV8HI.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/zvector/vec-nnpa-fp16-convert.c: Replace V8HI
	types with UV8HI.
	* gcc.target/s390/zvector/vec-nnpa-fp32-convert-1.c: Dito.
	* gcc.target/s390/zvector/vec_convert_from_fp16.c: Dito.
	* gcc.target/s390/zvector/vec_convert_to_fp16.c: Dito.
	* gcc.target/s390/zvector/vec_extend_to_fp32_hi.c: Dito.
	* gcc.target/s390/zvector/vec_extend_to_fp32_lo.c: Dito.
	* gcc.target/s390/zvector/vec_round_from_fp32.c: Dito.
2023-11-27 10:30:54 +01:00
Stefan Schulze Frielinghaus
a4787a926c s390: Fix builtins floating-point convert to/from fixed
Remove flags for non-existing operands 2 and 3.

gcc/ChangeLog:

	* config/s390/s390-builtins.def
	(s390_vcefb,s390_vcdgb,s390_vcelfb,s390_vcdlgb,s390_vcfeb,s390_vcgdb,
	s390_vclfeb,s390_vclgdb): Remove flags for non-existing operands
	2 and 3.
2023-11-27 10:26:05 +01:00
Stefan Schulze Frielinghaus
74a7bb2c50 s390: Fix constraint for insn *cmphi_ccu
Currently for an unsigned 16-bit comparison between memory and an
immediate where the high bit is set, a clc is emitted.  This is because
the constant is created for mode HI and therefore sign extended.  This
means constraint D does not hold anymore.  Since the mode already
restricts the immediate to 16 bit, it is enough to make use of
constraint n and chop of the high bits in the output template.

gcc/ChangeLog:

	* config/s390/s390.md (*cmphi_ccu): For immediate operand 1 make
	use of constraint n instead of D and chop of high bits in the
	output template.
2023-11-27 10:23:17 +01:00
Jakub Jelinek
221166ad15 mips: Fix up mips*-sde-elf* build [PR112300]
As reported in the PR, mipsisa64r2-sde-elf doesn't build because HEAP_TRAMPOLINES_INIT
macro isn't defined anywhere.
It is normally defined by
 # Figure out if we need to enable heap trampolines by default
 case ${target} in
 *-*-darwin2*)
   # Currently, we do this for macOS 11 and above.
   tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=1"
   ;;
 *)
   tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=0"
   ;;
 esac
in config.gcc, but mips*-sde-elf* is the only target which overwrites
tm_defines shell variable rather than just appending to it (or in one case
prepending), all other targets append something to it, including other
mips* triplets.
I believe (just from looking at config.gcc) that the difference is that
LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4 HEAP_TRAMPOLINES_INIT=0
isn't defined without the patch and is with the patch.

I think defining those first 4 shouldn't cause any harm and defining the
last one is required for it to actually build at all.

2023-11-27  Jakub Jelinek  <jakub@redhat.com>

	PR target/112300
	* config.gcc (mips*-sde-elf*): Append to tm_defines rather than
	overwriting them.
2023-11-27 09:22:20 +01:00
Juzhe-Zhong
e027723448 RISC-V: Remove incorrect function gate gather_scatter_valid_offset_mode_p
Come back to review the codes of gather/scatter, notice gather_scatter_valid_offset_mode_p looks odd.
gather_scatter_valid_offset_mode_p is supposed to block vluxei64/vsuxei64 in RV32 system.
However, it failed to do that since it is passing data_mode instead of index mode:

riscv_vector::gather_scatter_valid_offset_mode_p (<RATIO2:MODE>mode)
It should be RATIO2I instead of RATIO2.
So we have this following iterators which already can block the this situation:

(define_mode_iterator RATIO8I [
  RVVM1QI
  RVVM2HI
  RVVM4SI
  (RVVM8DI "TARGET_VECTOR_ELEN_64 && TARGET_64BIT")
])

We can see TARGET_64BIT to block EEW64 index mode on RV32 system.
So, gather_scatter_valid_offset_mode_p is no longer needed.

After remove it, I find due to incorrect gather_scatter_valid_offset_mode_p.
We failed to vectorize such case in RV32 in the past:

  void __attribute__ ((noinline, noclone))                                     \
  f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src,            \
		 INDEX##BITS *restrict indices, INDEX##BITS *restrict cond)    \
  {                                                                            \
    for (int i = 0; i < 128; ++i)                                              \
      if (cond[i])                                                             \
	dest[i] += src[indices[i]];                                            \
  }
  T (int64_t, 8)
TEST_ALL (TEST_LOOP)

https://godbolt.org/z/T3ara3fM3

Checked compiler explorer, we can see GCC failed to vectorize it but Clang can vectorize it.

So adapt the tests checking vectorization cases from 8 -> 11.

Confirm we have same behavior as Clang now.

Tested on zvl128/zvl256/zvl512/zvl1024 no regression.

Note this is not an optimization patch, it's buggy codes fix patch.

gcc/ChangeLog:

	* config/riscv/autovec.md
	(mask_len_gather_load<RATIO1:mode><RATIO1:mode>):
	Remove gather_scatter_valid_offset_mode_p.
	(mask_len_gather_load<mode><mode>): Ditto.
	(mask_len_scatter_store<RATIO1:mode><RATIO1:mode>): Ditto.
	(mask_len_scatter_store<mode><mode>): Ditto.
	* config/riscv/predicates.md (const_1_or_8_operand): New predicate.
	(vector_gs_scale_operand_64): Remove.
	* config/riscv/riscv-protos.h (gather_scatter_valid_offset_mode_p): Remove.
	* config/riscv/riscv-v.cc (expand_gather_scatter): Refine code.
	(gather_scatter_valid_offset_mode_p): Remove.
	* config/riscv/vector-iterators.md: Fix iterator bugs.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-1.c: Adapt test.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-10.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-11.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-2.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-3.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-4.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-5.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-6.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-7.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_gather_load_32-9.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-1.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-10.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-2.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-3.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-4.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-5.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-6.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-7.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/gather-scatter/mask_scatter_store_32-9.c: Ditto.
2023-11-27 16:10:58 +08:00
Tsukasa OI
006e90e134 RISC-V: Initial RV64E and LP64E support
Along with RV32E, RV64E is ratified.  Though ILP32E and LP64E ABIs are
still draft, it's worth supporting it.

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc
	(riscv_ext_version_table): Set version to ratified 2.0.
	(riscv_subset_list::parse_std_ext): Allow RV64E.
	* config.gcc: Parse base ISA 'rv64e' and ABI 'lp64e'.
	* config/riscv/arch-canonicalize: Parse base ISA 'rv64e'.
	* config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins):
	Define different macro per XLEN.  Add handling for ABI_LP64E.
	* config/riscv/riscv-d.cc (riscv_d_handle_target_float_abi):
	Add handling for ABI_LP64E.
	* config/riscv/riscv-opts.h (enum riscv_abi_type): Add ABI_LP64E.
	* config/riscv/riscv.cc (riscv_option_override): Enhance error
	handling to support RV64E and LP64E.
	(riscv_conditional_register_usage): Change "RV32E" in a comment
	to "RV32E/RV64E".
	* config/riscv/riscv.h
	(UNITS_PER_FP_ARG): Add handling for ABI_LP64E.
	(STACK_BOUNDARY): Ditto.
	(ABI_STACK_BOUNDARY): Ditto.
	(MAX_ARGS_IN_REGISTERS): Ditto.
	(ABI_SPEC): Add support for "lp64e".
	* config/riscv/riscv.opt: Parse -mabi=lp64e as ABI_LP64E.
	* doc/invoke.texi: Add documentation of the LP64E ABI.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/predef-1.c: Test for __riscv_64e.
	* gcc.target/riscv/predef-2.c: Ditto.
	* gcc.target/riscv/predef-3.c: Ditto.
	* gcc.target/riscv/predef-4.c: Ditto.
	* gcc.target/riscv/predef-5.c: Ditto.
	* gcc.target/riscv/predef-6.c: Ditto.
	* gcc.target/riscv/predef-7.c: Ditto.
	* gcc.target/riscv/predef-8.c: Ditto.
	* gcc.target/riscv/predef-9.c: New test for RV64E and LP64E,
	based on predef-7.c.
2023-11-27 07:43:41 +00:00
Jose E. Marchesi
b6db325ac3 bpf: remove bpf-helpers.h
Now that we are finally able to use the kernel provided bpf_helpers.h
file and associated machinery, there is no longer need to distribute
our own version.

This patch removes bpf-helpers.h and deletes most of the associated
tests from the gcc.target/bpf testsuite.  Two tests are adapted and
retained: one testing the kernel_helper attribute, which is still
useful, and the other making sure that proper constant propagation is
performed with -O2, which is necessary to use the helpers defined as
static pointers in the kernel's bpf_helpers.h.

Regtested in target bpf-unknown-none and host x86_64-linux-gnu.

gcc/ChangeLog

	* config/bpf/bpf-helpers.h: Remove.
	* config.gcc: Adapt accordingly.

gcc/testsuite/ChangeLog

	* gcc.target/bpf/helper-bind.c: Do not include bpf-helpers.h.
	* gcc.target/bpf/helper-skb-ancestor-cgroup-id.c: Likewise, and
	renamed from skb-ancestor-cgroup-id.c.
	* gcc.target/bpf/helper-bpf-redirect.c: Remove.
	* gcc.target/bpf/helper-clone-redirect.c: Likewise.
	* gcc.target/bpf/helper-csum-diff.c: Likewise.
	* gcc.target/bpf/helper-csum-update.c: Likewise.
	* gcc.target/bpf/helper-current-task-under-cgroup.c: Likewise.
	* gcc.target/bpf/helper-fib-lookup.c: Likewise.
	* gcc.target/bpf/helper-get-cgroup-classid.c: Likewise.
	* gcc.target/bpf/helper-get-current-cgroup-id.c: Likewise.
	* gcc.target/bpf/helper-get-current-comm.c: Likewise.
	* gcc.target/bpf/helper-get-current-pid-tgid.c: Likewise.
	* gcc.target/bpf/helper-get-current-task.c: Likewise.
	* gcc.target/bpf/helper-get-current-uid-gid.c: Likewise.
	* gcc.target/bpf/helper-get-hash-recalc.c: Likewise.
	* gcc.target/bpf/helper-get-listener-sock.c: Likewise.
	* gcc.target/bpf/helper-get-local-storage.c: Likewise.
	* gcc.target/bpf/helper-get-numa-node-id.c: Likewise.
	* gcc.target/bpf/helper-get-prandom-u32.c: Likewise.
	* gcc.target/bpf/helper-get-route-realm.c: Likewise.
	* gcc.target/bpf/helper-get-smp-processor-id.c: Likewise.
	* gcc.target/bpf/helper-get-socket-cookie.c: Likewise.
	* gcc.target/bpf/helper-get-socket-uid.c: Likewise.
	* gcc.target/bpf/helper-get-stack.c: Likewise.
	* gcc.target/bpf/helper-get-stackid.c: Likewise.
	* gcc.target/bpf/helper-getsockopt.c: Likewise.
	* gcc.target/bpf/helper-ktime-get-ns.c: Likewise.
	* gcc.target/bpf/helper-l3-csum-replace.c: Likewise.
	* gcc.target/bpf/helper-l4-csum-replace.c: Likewise.
	* gcc.target/bpf/helper-lwt-push-encap.c: Likewise.
	* gcc.target/bpf/helper-lwt-seg6-action.c: Likewise.
	* gcc.target/bpf/helper-lwt-seg6-adjust-srh.c: Likewise.
	* gcc.target/bpf/helper-lwt-seg6-store-bytes.c: Likewise.
	* gcc.target/bpf/helper-map-delete-elem.c: Likewise.
	* gcc.target/bpf/helper-map-lookup-elem.c: Likewise.
	* gcc.target/bpf/helper-map-peek-elem.c: Likewise.
	* gcc.target/bpf/helper-map-pop-elem.c: Likewise.
	* gcc.target/bpf/helper-map-push-elem.c: Likewise.
	* gcc.target/bpf/helper-map-update-elem.c: Likewise.
	* gcc.target/bpf/helper-msg-apply-bytes.c: Likewise.
	* gcc.target/bpf/helper-msg-cork-bytes.c: Likewise.
	* gcc.target/bpf/helper-msg-pop-data.c: Likewise.
	* gcc.target/bpf/helper-msg-pull-data.c: Likewise.
	* gcc.target/bpf/helper-msg-push-data.c: Likewise.
	* gcc.target/bpf/helper-msg-redirect-hash.c: Likewise.
	* gcc.target/bpf/helper-msg-redirect-map.c: Likewise.
	* gcc.target/bpf/helper-override-return.c: Likewise.
	* gcc.target/bpf/helper-perf-event-output.c: Likewise.
	* gcc.target/bpf/helper-perf-event-read-value.c: Likewise.
	* gcc.target/bpf/helper-perf-event-read.c: Likewise.
	* gcc.target/bpf/helper-perf-prog-read-value.c: Likewise.
	* gcc.target/bpf/helper-probe-read-str.c: Likewise.
	* gcc.target/bpf/helper-probe-read.c: Likewise.
	* gcc.target/bpf/helper-probe-write-user.c: Likewise.
	* gcc.target/bpf/helper-rc-keydown.c: Likewise.
	* gcc.target/bpf/helper-rc-pointer-rel.c: Likewise.
	* gcc.target/bpf/helper-rc-repeat.c: Likewise.
	* gcc.target/bpf/helper-redirect-map.c: Likewise.
	* gcc.target/bpf/helper-set-hash-invalid.c: Likewise.
	* gcc.target/bpf/helper-set-hash.c: Likewise.
	* gcc.target/bpf/helper-setsockopt.c: Likewise.
	* gcc.target/bpf/helper-sk-fullsock.c: Likewise.
	* gcc.target/bpf/helper-sk-lookup-tcp.c: Likewise.
	* gcc.target/bpf/helper-sk-lookup-upd.c: Likewise.
	* gcc.target/bpf/helper-sk-redirect-hash.c: Likewise.
	* gcc.target/bpf/helper-sk-redirect-map.c: Likewise.
	* gcc.target/bpf/helper-sk-release.c: Likewise.
	* gcc.target/bpf/helper-sk-select-reuseport.c: Likewise.
	* gcc.target/bpf/helper-sk-storage-delete.c: Likewise.
	* gcc.target/bpf/helper-sk-storage-get.c: Likewise.
	* gcc.target/bpf/helper-skb-adjust-room.c: Likewise.
	* gcc.target/bpf/helper-skb-cgroup-id.c: Likewise.
	* gcc.target/bpf/helper-skb-change-head.c: Likewise.
	* gcc.target/bpf/helper-skb-change-proto.c: Likewise.
	* gcc.target/bpf/helper-skb-change-tail.c: Likewise.
	* gcc.target/bpf/helper-skb-change-type.c: Likewise.
	* gcc.target/bpf/helper-skb-ecn-set-ce.c: Likewise.
	* gcc.target/bpf/helper-skb-get-tunnel-key.c: Likewise.
	* gcc.target/bpf/helper-skb-get-tunnel-opt.c: Likewise.
	* gcc.target/bpf/helper-skb-get-xfrm-state.c: Likewise.
	* gcc.target/bpf/helper-skb-load-bytes-relative.c: Likewise.
	* gcc.target/bpf/helper-skb-load-bytes.c: Likewise.
	* gcc.target/bpf/helper-skb-pull-data.c: Likewise.
	* gcc.target/bpf/helper-skb-set-tunnel-key.c: Likewise.
	* gcc.target/bpf/helper-skb-set-tunnel-opt.c: Likewise.
	* gcc.target/bpf/helper-skb-store-bytes.c: Likewise.
	* gcc.target/bpf/helper-skb-under-cgroup.c: Likewise.
	* gcc.target/bpf/helper-skb-vlan-pop.c: Likewise.
	* gcc.target/bpf/helper-skb-vlan-push.c: Likewise.
	* gcc.target/bpf/helper-skc-lookup-tcp.c: Likewise.
	* gcc.target/bpf/helper-sock-hash-update.c: Likewise.
	* gcc.target/bpf/helper-sock-map-update.c: Likewise.
	* gcc.target/bpf/helper-sock-ops-cb-flags-set.c: Likewise.
	* gcc.target/bpf/helper-spin-lock.c: Likewise.
	* gcc.target/bpf/helper-spin-unlock.c: Likewise.
	* gcc.target/bpf/helper-strtol.c: Likewise.
	* gcc.target/bpf/helper-strtoul.c: Likewise.
	* gcc.target/bpf/helper-sysctl-get-current-value.c: Likewise.
	* gcc.target/bpf/helper-sysctl-get-name.c: Likewise.
	* gcc.target/bpf/helper-sysctl-get-new-value.c: Likewise.
	* gcc.target/bpf/helper-sysctl-set-new-value.c: Likewise.
	* gcc.target/bpf/helper-tail-call.c: Likewise.
	* gcc.target/bpf/helper-tcp-check-syncookie.c: Likewise.
	* gcc.target/bpf/helper-tcp-sock.c: Likewise.
	* gcc.target/bpf/helper-trace-printk.c: Likewise.
	* gcc.target/bpf/helper-xdp-adjust-head.c: Likewise.
	* gcc.target/bpf/helper-xdp-adjust-meta.c: Likewise.
	* gcc.target/bpf/helper-xdp-adjust-tail.c: Likewise.
	* gcc.target/bpf/skb-ancestor-cgroup-id.c: Likewise.
2023-11-27 07:24:27 +01:00
Guo Jie
8b9d0e8cf4 LoongArch: Fix runtime error in a gcc build with --with-build-config=bootstrap-ubsan
gcc/ChangeLog:

	* config/loongarch/loongarch.cc (loongarch_split_plus_constant):
	avoid left shift of negative value -0x8000.
2023-11-27 10:47:48 +08:00
Guo Jie
96577dfae9 LoongArch: Optimize the loading of immediate numbers with the same high and low 32-bit values
For the following immediate load operation in gcc/testsuite/gcc.target/loongarch/imm-load1.c:

	long long r = 0x0101010101010101;

Before this patch:

	lu12i.w	    $r15,16842752>>12
	ori	    $r15,$r15,257
	lu32i.d	    $r15,0x1010100000000>>32
	lu52i.d	    $r15,$r15,0x100000000000000>>52

After this patch:

	lu12i.w     $r15,16842752>>12
	ori         $r15,$r15,257
	bstrins.d   $r15,$r15,63,32

gcc/ChangeLog:

	* config/loongarch/loongarch.cc
	(enum loongarch_load_imm_method): Add new method.
	(loongarch_build_integer): Add relevant implementations for
	new method.
	(loongarch_move_integer): Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/imm-load1.c: Change old check.
2023-11-27 10:47:36 +08:00
GCC Administrator
df8dfd7837 Daily bump. 2023-11-27 00:16:44 +00:00
Hans-Peter Nilsson
beb4328eaf testsuite/gcc.dg/uninit-pred-9_b.c:20: Fix XPASS for various targets
The xfail for "*-*-*" here, set in r14-4089-gd45ddc2c04e471
"tree-optimization/111294 - backwards threader PHI costing"
was somewhat too general and made this test XPASS for a
number of targets.  The common factor for those targets is
that they either explicitly or by default define
LOGICAL_OP_NON_SHORT_CIRCUIT as 0 (see fold-const.cc).

Instead of changing *-*-* to a seemingly random set of
xfailed targets or inventing a new testsuite
effective-target predicate for logical-op-short-circuited
targets or the opposite, let's just force a setting that
removes the need for the xfail for all targets, by
overriding with --param=logical-op-non-short-circuit=0.

	* gcc.dg/uninit-pred-9_b.c: Remove xfail for line 20.  Pass
	--param=logical-op-non-short-circuit=0.  Comment why.
2023-11-27 00:29:01 +01:00
Hans-Peter Nilsson
b2f42d0cdf testsuite/gcc.dg/uninit-pred-9_b.c:23: Un-xfail for MMIX
In a recent all-target test-round investigating XPASSes for
this file, I noticed this line XPASSing for MMIX.  From the
commit history it's obvious it was left out from related
target-xfail tweaks, now the last target xfailing a bogus
warning for this line.

	* gcc.dg/uninit-pred-9_b.c: Remove xfail for MMIX from line 23.
2023-11-27 00:28:40 +01:00
Harald Anlauf
c9d029ba2c Fortran: avoid obsolescence warning for COMMON with submodule [PR111880]
gcc/fortran/ChangeLog:

	PR fortran/111880
	* resolve.cc (resolve_common_vars): Do not call gfc_add_in_common
	for symbols that are USE associated or used in a submodule.

gcc/testsuite/ChangeLog:

	PR fortran/111880
	* gfortran.dg/pr111880.f90: New test.
2023-11-26 20:10:20 +01:00
Alexander Monakov
22f42cdcb0 sort.cc: fix mentions of sorting networks in comments
Avoid using 'network sort' (a misnomer) in sort.cc, the correct term is
'sorting networks'.

gcc/ChangeLog:

	* sort.cc: Use 'sorting networks' in comments.
2023-11-26 19:37:15 +03:00
John David Anglin
96c666e24f Skip analyzer strndup test on hppa*-*-hpux*
2023-11-26  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

	* gcc.dg/analyzer/strndup-1.c: Skip on hppa*-*-hpux*.
2023-11-26 16:29:16 +00:00
John David Anglin
f763044f38 Skip analyzer socket tests on hppa*-*-hpux*
2023-11-26  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

	* gcc.dg/analyzer/fd-glibc-datagram-client.c: Skip on hppa*-*-hpux*.
	* gcc.dg/analyzer/fd-glibc-datagram-socket.c: Likewise.
2023-11-26 16:21:45 +00:00
John David Anglin
517d5aec99 hppa: Fix pr104869.C on hpux
2023-11-26  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

	* g++.dg/pr104869.C: Add attribute visibility default to
	main prototype.
2023-11-26 16:11:29 +00:00
John David Anglin
e197ff8a2e hppa: Really fix g++.dg/modules/bad-mapper-1.C on hpux
2023-11-23  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

	* g++.dg/modules/bad-mapper-1.C: Add hppa*-*-hpux* to dg-error
	"this-will-not-work" targets.
2023-11-26 16:01:13 +00:00
Francois-Xavier Coudert
e40a13eaca testsuite, i386: fix -fhardened test
The new test at gcc.target/i386/cf_check-6.c fails on darwin with:
  Excess errors:
  cc1: warning: '-fhardened' not supported for this target

gcc/testsuite/ChangeLog:

	* gcc.target/i386/cf_check-6.c: Only run on Linux.
2023-11-26 11:55:05 +01:00
Francois-Xavier Coudert
c54ee4fc16 testsuite, i386: fix split-stack test
The new test at gcc.target/i386/pr112686.c fails on darwin with:

Excess errors:
cc1: error: '-fsplit-stack' currently only supported on GNU/Linux
cc1: error: '-fsplit-stack' is not supported by this compiler configuration

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr112686.c: Add a requirement for split_stack.
2023-11-26 11:48:33 +01:00
Juzhe-Zhong
ec84a1e7a1 RISC-V: Disable AVL propagation of slidedown instructions
Re-check again RVV ISA, I find that we can't allow AVL propagation not only
for vrgather, but also slidedown instructions.

Committed.

	PR target/112599

gcc/ChangeLog:

	* config/riscv/riscv-avlprop.cc (avl_can_be_propagated_p): Add slidedown.
	(vlmax_ta_p): Ditto.
	(pass_avlprop::get_vlmax_ta_preferred_avl): Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/base/vf_avl-1.c: Adapt test.
	* gcc.target/riscv/rvv/autovec/pr112599-3.c: New test.
2023-11-26 17:15:26 +08:00
Andrew Pinski
bd7f16b43e Fix gcc.dg/vla-1.c
r14-5628-g53ba8d669550d3 added noipa to f1 but `-fno-ipa-vrp` should have been used
instead. The testcase is testing about the clone of f1 so turning off
IPA VRP is the correct approach here rather than turning off of IPA on the function.

gcc/testsuite/ChangeLog:

	PR testsuite/112691
	* gcc.dg/vla-1.c: Add -fno-ipa-vrp.
	Remove noipa from f1.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2023-11-25 20:28:14 -08:00
Andrew Pinski
a9693bff39 Fix gcc.target/aarch64/simd/vmulxd_{f64,f32}_2.c after after IPA-VRP improvement for return values
Just like the patch against gcc.target/aarch64/movk.c, the issue here
is the two functions, foo32 and foo64 needed to mark as noipa so that
IPA-VRP cannot propagate the return value.

gcc/testsuite/ChangeLog:

	PR testsuite/112688
	* gcc.target/aarch64/simd/vmulx.x (foo32): Mark as noipa rather
	than noinline.
	(foo4): Likewise.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2023-11-25 19:00:58 -08:00
Andrew Pinski
6e15e4e1ab Fix contracts-tmpl-spec2.C on targets where plain char is unsigned by default
Since contracts-tmpl-spec2.C is just testing contracts, I thought it would be better
to just add `-fsigned-char` to the options rather than change the testcase to support
both cases.

Committed after testing on aarch64-linux-gnu.

gcc/testsuite/ChangeLog:

	PR testsuite/108321
	* g++.dg/contracts/contracts-tmpl-spec2.C: Add -fsigned-char
	to options.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2023-11-25 19:00:42 -08:00
Juzhe-Zhong
4e88c4809a RISC-V: Fix typo
Fix typo. Committed.

gcc/ChangeLog:

	* config/riscv/riscv-avlprop.cc (alv_can_be_propagated_p): Fix typo.
	(avl_can_be_propagated_p): Ditto.
	(vlmax_ta_p): Ditto.
2023-11-26 09:48:19 +08:00
GCC Administrator
b28229b35a Daily bump. 2023-11-26 00:18:04 +00:00
Andrew Pinski
8d559a9b85 Fix gcc.target/aarch64/movk.c testcase after IPA-VRP improvement for return values
The problem here is dummy_number_generator returns a constant which IPA VRP is now able
propagate that so we need to mark the funciton as noipa to stop that.

gcc/testsuite/ChangeLog:

	PR testsuite/112688
	* gcc.target/aarch64/movk.c: Add noipa on dummy_number_generator
	and remove -fno-inline option.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2023-11-25 13:34:17 -08:00
Gerald Pfeifer
9c26c91b94 doc: Complete and sort the list of front ends
gcc:

	PR other/69374
	* doc/install.texi (Downloading the source): Sort the list of
	front ends and add D, Go, and Modula-2.
2023-11-25 14:10:25 +01:00
Gerald Pfeifer
f7df9d7aca doc: Remove obsolete notes on GCC 4.x on FreeBSD
FreeBSD 6 and 7 have been end of life for years as have been GCC 4.x
releases, so no point in detailing specifics of changes around those.

gcc:

	PR target/69374
	* doc/install.texi (Specific) <*-*-freebsd*>: Remove older
	contents referencing GCC 4.x.
2023-11-25 13:31:22 +01:00
Gerald Pfeifer
65272aebc0 doc: Update ISO C++ reference
gcc:

	* doc/standards.texi (Standards): Update ISO C++ reference.
2023-11-25 12:13:50 +01:00
Jakub Jelinek
9866c98e10 i386: Fix up *jcc_bt*_mask{,_1} [PR111408]
The following testcase is miscompiled in GCC 14 because the
*jcc_bt<mode>_mask and *jcc_bt<SWI48:mode>_mask_1 patterns have just
one argument in (match_operator 0 "bt_comparison_operator" [...])
but as bt_comparison_operator is eq,ne, we need two.
The md readers don't warn about it, after all, some checks can
be done in the predicate rather than specified explicitly, and the
behavior is that anything is accepted as the second argument.

I went through all other i386.md match_operator uses and all others
looked right (extract_operator using 3 operands, all others 2).

I think we'll want to fix this at different spots in older releases
because I think the bug was introduced already in 2008, though most
likely just latent.

2023-11-25  Jakub Jelinek  <jakub@redhat.com>

	PR target/111408
	* config/i386/i386.md (*jcc_bt<mode>_mask,
	*jcc_bt<SWI48:mode>_mask_1): Add (const_int 0) as expected
	second operand of bt_comparison_operator.

	* gcc.c-torture/execute/pr111408.c: New test.
2023-11-25 10:31:55 +01:00
Jakub Jelinek
a6a43a3b76 aarch64: Fix up aarch64_simd_stp<mode> [PR109977]
The aarch64_simd_stp<mode> pattern uses w constraint in one alternative and
r in another, but for the latter incorrectly uses <vw> iterator in %<vw>1 which
expands to %d1 for V2DF and %s1 for V2SF and V4SF (this one not relevant to
the pattern) and %w1 for others, so it ICEs if the alternative is selected
during final.  Compared to this, <vwcore> macro has the same values for all
modes but uses w for V2DF and V2SF.

2023-11-24  Andrew Pinski  <pinskia@gmail.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR target/109977
	* config/aarch64/aarch64-simd.md (aarch64_simd_stp<mode>): Use <vwcore>
	rather than %<vw> for alternative with r constraint on input operand.

	* gcc.dg/pr109977.c: New test.
2023-11-25 10:30:39 +01:00
Nathaniel Shead
1f70291b93 c++: more checks for exporting names with using-declarations
Currently only functions are directly checked for validity when
exporting via a using-declaration.  This patch also checks exporting
non-external names of variables, types, and enumerators.  This also
prevents ICEs with `export using enum` for internal-linkage enums.

While we're at it this patch also improves the error messages for these
cases to provide more context about what went wrong.

gcc/cp/ChangeLog:

	* name-lookup.cc (check_can_export_using_decl): New.
	(do_nonmember_using_decl): Use above to check if names can be
	exported.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/using-10.C: New test.
	* g++.dg/modules/using-enum-2.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2023-11-25 12:44:17 +11:00
Nathaniel Shead
9dd8be6fc2 c++: Allow exporting a typedef redeclaration [PR102341]
A typedef doesn't create a new entity, and thus should be allowed to be
exported even if it has been previously declared un-exported. See the
example in [module.interface] p6:

  export module M;
  struct S { int n; };
  typedef S S;
  export typedef S S;             // OK, does not redeclare an entity

	PR c++/102341

gcc/cp/ChangeLog:

	* decl.cc (duplicate_decls): Allow exporting a redeclaration of
	a typedef.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/export-1.C: Adjust test.
	* g++.dg/modules/export-2_a.C: New test.
	* g++.dg/modules/export-2_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2023-11-25 12:44:17 +11:00
GCC Administrator
77cf1dba78 Daily bump. 2023-11-25 00:17:46 +00:00
Lewis Hyatt
5d4abd9219 preprocessor: Reinitialize frontend parser after loading a PCH [PR112319]
Since r14-2893, the frontend parser object needs to exist when running in
preprocess-only mode, because pragma_lex() is now called in that mode and
needs to make use of it. This is handled by calling c_init_preprocess() at
startup. If -fpch-preprocess is in effect (commonly, because of
-save-temps), a PCH file may be loaded during preprocessing, in which
case the parser will be destroyed, causing the issue noted in the
PR. Resolve it by reinitializing the frontend parser after loading the PCH.

gcc/c-family/ChangeLog:

	PR pch/112319
	* c-ppoutput.cc (cb_read_pch): Reinitialize the frontend parser
	after loading a PCH.

gcc/testsuite/ChangeLog:

	PR pch/112319
	* g++.dg/pch/pr112319.C: New test.
	* g++.dg/pch/pr112319.Hs: New test.
	* gcc.dg/pch/pr112319.c: New test.
	* gcc.dg/pch/pr112319.hs: New test.
2023-11-24 15:30:40 -05:00
Tobias Burnus
6eb1507107 c-family/c.opt (-Wopenmp): Add missing tailing '.'
gcc/c-family/ChangeLog:

	* c.opt (-Wopenmp): Add missing tailing '.'.
2023-11-24 19:52:54 +01:00
Tobias Burnus
1be097841f install.texi: Update GCN entry - @uref and LLVM version remark
gcc/ChangeLog:

	* doc/install.texi (amdgcn-*-amdhsa): Fix URL to ROCm;
	change 'in the future' to 'in LLVM 18'.
2023-11-24 19:45:43 +01:00
John David Anglin
23dc62599a hppa: Use INT14_OK_STRICT in a couple of places in pa_emit_move_sequence
64-bit Linux target has relocation issue and can't use 14-bit offsets.

2023-11-22  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

	* config/pa/pa.cc (pa_emit_move_sequence): Use INT14_OK_STRICT
	in a couple of places.
2023-11-24 17:25:47 +00:00
Jan Hubicka
c2dcfb6ba6 Use memcpy instead of memmove in __relocate_a_1
__relocate_a_1 is used to copy data after vector reizing.  This can be done by memcpy
rather than memmove.

libstdc++-v3/ChangeLog:

	PR middle-end/109849
	* include/bits/stl_uninitialized.h (__relocate_a_1): Use memcpy instead
	of memmove.
2023-11-24 17:59:44 +01:00
Martin Jambor
aae723d360 sra: SRA of non-escaped aggregates passed by reference to calls
PR109849 shows that a loop that heavily pushes and pops from a stack
implemented by a C++ std::vec results in slow code, mainly because the
vector structure is not split by SRA and so we end up in many loads
and stores into it.  This is because it is passed by reference
to (re)allocation methods and so needs to live in memory, even though
it does not escape from them and so we could SRA it if we
re-constructed it before the call and then separated it to distinct
replacements afterwards.

This patch does exactly that, first relaxing the selection of
candidates to also include those which are addressable but do not
escape and then adding code to deal with the calls.  The
micro-benchmark that is also the (scan-dump) testcase in this patch
runs twice as fast with it than with current trunk.  Honza measured
its effect on the libjxl benchmark and it almost closes the
performance gap between Clang and GCC while not requiring excessive
inlining and thus code growth.

The patch disallows creation of replacements for such aggregates which
are also accessed with a precision smaller than their size because I
have observed that this led to excessive zero-extending of data
leading to slow-downs of perlbench (on some CPUs).  Apart from this
case I have not noticed any regressions, at least not so far.

Gimple call argument flags can tell if an argument is unused (and then
we do not need to generate any statements for it) or if it is not
written to and then we do not need to generate statements loading
replacements from the original aggregate after the call statement.
Unfortunately, we cannot symmetrically use flags that an aggregate is
not read because to avoid re-constructing the aggregate before the
call because flags don't tell which what parts of aggregates were not
written to, so we load all replacements, and so all need to have the
correct value before the call.

This version of the patch also takes care to avoid attempts to modify
abnormal edges, something which was missing in the previosu version.

gcc/ChangeLog:

2023-11-23  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/109849
	* tree-sra.cc (passed_by_ref_in_call): New.
	(sra_initialize): Allocate passed_by_ref_in_call.
	(sra_deinitialize): Free passed_by_ref_in_call.
	(create_access): Add decl pool candidates only if they are not
	already	candidates.
	(build_access_from_expr_1): Bail out on ADDR_EXPRs.
	(build_access_from_call_arg): New function.
	(asm_visit_addr): Rename to scan_visit_addr, change the
	disqualification dump message.
	(scan_function): Check taken addresses for all non-call statements,
	including phi nodes.  Process all call arguments, including the static
	chain, build_access_from_call_arg.
	(maybe_add_sra_candidate): Relax need_to_live_in_memory check to allow
	non-escaped local variables.
	(sort_and_splice_var_accesses): Disallow smaller-than-precision
	replacements for aggregates passed by reference to functions.
	(sra_modify_expr): Use a separate stmt iterator for adding satements
	before the processed statement and after it.
	(enum out_edge_check): New type.
	(abnormal_edge_after_stmt_p): New function.
	(sra_modify_call_arg): New function.
	(sra_modify_assign): Adjust calls to sra_modify_expr.
	(sra_modify_function_body): Likewise, use sra_modify_call_arg to
	process call arguments, including the static chain.

gcc/testsuite/ChangeLog:

2023-11-23  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/109849
	* g++.dg/tree-ssa/pr109849.C: New test.
	* g++.dg/tree-ssa/sra-eh-1.C: Likewise.
	* gcc.dg/tree-ssa/pr109849.c: Likewise.
	* gcc.dg/tree-ssa/sra-longjmp-1.c: Likewise.
	* gfortran.dg/pr43984.f90: Added -fno-tree-sra to dg-options.
2023-11-24 17:32:40 +01:00
Uros Bizjak
404ea4c138 i386: Fix ICE with -fsplit-stack -mcmodel=large [PR112686]
For -mcmodel=large, we have to load function address to a register.

	PR target/112686

gcc/ChangeLog:

	* config/i386/i386.cc (ix86_expand_split_stack_prologue): Load
	function address to a register for ix86_cmodel == CM_LARGE.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr112686.c: New test.
2023-11-24 16:11:27 +01:00
Tobias Burnus
449b6b817e OpenMP: Add -Wopenmp and use it
The new warning has two purposes: First, it makes clearer to the
user that it is about OpenMP and, secondly and more importantly,
it permits to use -Wno-openmp.

The newly added -Wopenmp is enabled by default and replaces the
'0' (always warning) in several OpenMP-related warning calls.
For code shared with OpenACC, it only uses OPT_Wopenmp for
'flag_openmp | flag_openmp_simd'.

gcc/c-family/ChangeLog:

	* c.opt (Wopenmp): Add, enable by default.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_clause_num_threads,
	c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize,
	c_parser_omp_clause_priority, c_parser_omp_clause_schedule,
	c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit,
	c_parser_omp_clause_dist_schedule, c_parser_omp_depobj,
	c_parser_omp_scan_loop_body, c_parser_omp_assumption_clauses):
	Add OPT_Wopenmp to warning_at.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_omp_clause_dist_schedule,
	cp_parser_omp_scan_loop_body, cp_parser_omp_assumption_clauses,
	cp_parser_omp_depobj): Add OPT_Wopenmp to warning_at.
	* semantics.cc (finish_omp_clauses): Likewise.

gcc/ChangeLog:

	* doc/invoke.texi (-Wopenmp): Add.
	* gimplify.cc (gimplify_omp_for): Add OPT_Wopenmp to warning_at.
	* omp-expand.cc (expand_omp_ordered_sink): Likewise.
	* omp-general.cc (omp_check_context_selector): Likewise.
	* omp-low.cc (scan_omp_for, check_omp_nesting_restrictions,
	lower_omp_ordered_clauses): Likewise.
	* omp-simd-clone.cc (simd_clone_clauses_extract): Likewise.

gcc/fortran/ChangeLog:

	* lang.opt (Wopenmp): Add, enabled by dafault and documented in C.
	* openmp.cc (gfc_match_omp_declare_target, resolve_positive_int_expr,
	resolve_nonnegative_int_expr, resolve_omp_clauses,
	gfc_resolve_omp_do_blocks): Use OPT_Wopenmp with gfc_warning{,_now}.
2023-11-24 15:31:08 +01:00
Richard Earnshaw
439779bace arm: libgcc: provide implementations of __sync_synchronize
Prior to Armv6 there was no architected method to synchronize data
across processors.  Armv6 saw the first introduction of
multi-processor support, using a CP15 operation; but this was
deprecated in Armv7 and is not supported on m-profile devices of any
form.  Armv7 (and armv6-m) and later support data synchronization via
the DMB instruction.

This all leads to difficulties when linking programs as the user
generally needs to know which synchronization method is needed, but
there seems no easy way around this, when there are no OS-related
primitives available.

I've addressed this by adding multiple variants of __sync_synchronize
to libgcc, one for each of the above use cases.  I've named these
__sync_synchronize_none, __sync_synchronize_cp15dmb and
__sync_synchronize_dmb.  I've also added three specs files that can be
used to direct the linker to pick the appropriate implementation.
Using specs fragments for this is preferable to directing the user to
directly use --defsym as the latter has to be placed at the correct
position on the command line to be effective and the spec rule ensures
this automatically.

I've also added a default implementation of __sync_synchronize.  The
default implementation will use DMB if that is available in the target
ISA, or fall back to a nul-implementation if it isn't.  In the latter
case it will cause the linker (GNU LD) to emit a warning that
specifies how to pick a specific implementation.  I've chosen not to
permit this default to use the CP15 solution as that has been
deprecated.

libgcc:

	* config.host (arm*-*-eabi* | arm*-*-rtems*):
	Add arm/t-sync to the makefile rules.
	* config/arm/lib1funcs.S (__sync_synchronize_none)
	(__sync_synchronize_cp15dmb, __sync_synchronize_dmb)
	(__sync_synchronize): New functions.
	* config/arm/t-sync: New file.
	* config/arm/sync-none.specs: Likewise.
	* config/arm/sync-dmb.specs: Likewise.
	* config/arm/sync-cp15dmb.specs: Likewise.
2023-11-24 14:15:26 +00:00
Tobias Burnus
1802f64e67 OpenMP: Accept argument to depobj's destroy clause
Since OpenMP 5.2, the destroy clause takes an depend argument as argument;
for the depobj directive, it the new argument is optional but, if present,
it must be identical to the directive's argument.

gcc/c/ChangeLog:

	* c-parser.cc (c_parser_omp_depobj): Accept optionally an argument
	to the destroy clause.

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_omp_depobj): Accept optionally an argument
	to the destroy clause.

gcc/fortran/ChangeLog:

	* openmp.cc (gfc_match_omp_depobj): Accept optionally an argument
	to the destroy clause.

libgomp/ChangeLog:

	* libgomp.texi (5.2 Impl. Status): An argument to the destroy clause
	is now supported.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/depobj-3.c: New test.
	* gfortran.dg/gomp/depobj-3.f90: New test.
2023-11-24 15:10:49 +01:00
Nathaniel Shead
726723c476 c++: Allow exporting const-qualified namespace-scope variables [PR99232]
By [basic.link] p3.2.1, a non-template non-volatile const-qualified
variable is not necessarily internal linkage in a module declaration,
and rather may have module linkage (or external linkage if it is
exported, see p4.8).

	PR c++/99232

gcc/cp/ChangeLog:

	* decl.cc (grokvardecl): Don't mark variables attached to
	modules as internal.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/pr99232_a.C: New test.
	* g++.dg/modules/pr99232_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
2023-11-25 00:55:15 +11:00
Juzhe-Zhong
aea337cf74 RISC-V: Fix inconsistency among all vectorization hooks
This patches 200+ ICEs exposed by testing with rv64gc_zve64d.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112694

The rootcause is we disallow poly (1,1) size vectorization in preferred_simd_mode.
with this following code:
-      if (TARGET_MIN_VLEN < 128 && TARGET_MAX_LMUL < RVV_M2)
-       return word_mode;

However, we allow poly (1,1) size in hook:
TARGET_VECTORIZE_RELATED_MODE
TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES

And also enables it in all vectorization patterns.

I was adding this into preferred_simd_mode because poly (1,1) size mode will cause
ICE in can_duplicate_and_interleave_p.

So, the alternative approach we need to block poly (1,1) size in both TARGET_VECTORIZE_RELATED_MODE
and TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES hooks and all vectorization patterns.
which is ugly approach and too much codes change.

Now, after investivation, I find it's nice that loop vectorizer can automatically block poly (1,1)
size vector in interleave vectorization with this commit:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=730909fa858bd691095bc23655077aa13b7941a9

So, we don't need to worry about ICE in interleave vectorization and allow poly (1,1) size vector
in vectorization which fixes 200+ ICEs in zve64d march.

	PR target/112694

gcc/ChangeLog:

	* config/riscv/riscv-v.cc (preferred_simd_mode): Allow poly_int (1,1) vectors.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/pr112694-1.c: New test.
2023-11-24 21:28:02 +08:00
Alexander Monakov
f9a10e9149 gcc: configure: drop Valgrind 3.1 compatibility
Our system.h and configure.ac try to accommodate valgrind-3.1, but it is
more than 15 years old at this point. As Valgrind-based checking is a
developer-oriented feature, drop the compatibility stuff and streamline
the detection.

gcc/ChangeLog:

	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Delete manual checks for old Valgrind headers.
	* system.h (VALGRIND_MAKE_MEM_NOACCESS): Delete.
	(VALGRIND_MAKE_MEM_DEFINED): Delete.
	(VALGRIND_MAKE_MEM_UNDEFINED): Delete.
	(VALGRIND_MALLOCLIKE_BLOCK): Delete.
	(VALGRIND_FREELIKE_BLOCK): Delete.
2023-11-24 16:17:45 +03:00