Commit graph

194899 commits

Author SHA1 Message Date
Jakub Jelinek
e9dd050e0c libcpp: Implement C++23 P2290R3 - Delimited escape sequences [PR106645]
The following patch implements the C++23 P2290R3 paper.

2022-08-20  Jakub Jelinek  <jakub@redhat.com>

	PR c++/106645
libcpp/
	* include/cpplib.h (struct cpp_options): Implement
	P2290R3 - Delimited escape sequences.  Add delimite_escape_seqs
	member.
	* init.cc (struct lang_flags): Likewise.
	(lang_defaults): Add delim column.
	(cpp_set_lang): Copy over delimite_escape_seqs.
	* charset.cc (extend_char_range): New function.
	(_cpp_valid_ucn): Use it.  Handle delimited escape sequences.
	(convert_hex): Likewise.
	(convert_oct): Likewise.
	(convert_ucn): Use extend_char_range.
	(convert_escape): Call convert_oct even for \o.
	(_cpp_interpret_identifier): Handle delimited escape sequences.
	* lex.cc (get_bidi_ucn_1): Likewise.  Add end argument, fill it in.
	(get_bidi_ucn): Adjust get_bidi_ucn_1 caller.  Use end argument to
	compute num_bytes.
gcc/testsuite/
	* c-c++-common/cpp/delimited-escape-seq-1.c: New test.
	* c-c++-common/cpp/delimited-escape-seq-2.c: New test.
	* c-c++-common/cpp/delimited-escape-seq-3.c: New test.
	* c-c++-common/Wbidi-chars-24.c: New test.
	* gcc.dg/cpp/delimited-escape-seq-1.c: New test.
	* gcc.dg/cpp/delimited-escape-seq-2.c: New test.
	* g++.dg/cpp/delimited-escape-seq-1.C: New test.
	* g++.dg/cpp/delimited-escape-seq-2.C: New test.
2022-08-20 10:26:55 +02:00
GCC Administrator
613e9e16b8 Daily bump. 2022-08-20 00:16:26 +00:00
Tobias Burnus
713ec97e59 mkoffload: Cleanup temporary omp_requires_file
The file (suffix ".mkoffload.omp_requires") used to save the 'omp requires'
data has to be passed to maybe_unlink for cleanup or -v -save-temps stderr
diagnostic. That was missed before. - For GCN, the same has to be done for
the files with suffix ".mkoffload.dbg.o".

gcc/ChangeLog:

	* config/gcn/mkoffload.cc (main): Add omp_requires_file and dbgobj to
	files_to_cleanup.
	* config/i386/intelmic-mkoffload.cc (prepare_target_image): Add
	omp_requires_file to temp_files.
	* config/nvptx/mkoffload.cc (omp_requires_file): New global static var.
	(main): Remove local omp_requires_file var.
	(tool_cleanup): Handle omp_requires_file.
2022-08-19 16:09:28 +02:00
Aldy Hernandez
338a296dd7 Remove path_range_query constructor that takes an edge.
The path_range_query constructor that takes an edge is really a
convenience function for the loop-ch pass.  It feels wrong to pollute
the API with such a specialized function that could be done with
a small inline function closer to its user.

As an added benefit, we remove one use of reset_path.  The last
remaining one is the forward threader one.

Tested, thread-counted, and benchmarked on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range-path.cc (path_range_query::path_range_query):
	Remove constructor that takes edge.
	* gimple-range-path.h (class path_range_query): Same.
	* tree-ssa-loop-ch.cc (edge_range_query): New.
	(entry_loop_condition_is_static): Call edge_range_query.
2022-08-19 12:29:05 +02:00
Stefan Schulze Frielinghaus
81e20a6eb9 Add further FOR_EACH_ macros
contrib/ChangeLog:

	* clang-format: Add further FOR_EACH_ macros.
2022-08-19 09:33:13 +02:00
Haochen Jiang
86c0d98620 i386: Add ABI test for __bf16 type
gcc/testsuite/ChangeLog:

	* gcc.target/x86_64/abi/bf16/abi-bf16.exp: New test.
	* gcc.target/x86_64/abi/bf16/args.h: Ditto.
	* gcc.target/x86_64/abi/bf16/asm-support.S: Ditto.
	* gcc.target/x86_64/abi/bf16/bf16-check.h: Ditto.
	* gcc.target/x86_64/abi/bf16/bf16-helper.h: Ditto.
	* gcc.target/x86_64/abi/bf16/defines.h: Ditto.
	* gcc.target/x86_64/abi/bf16/m256bf16/abi-bf16-ymm.exp: Ditto.
	* gcc.target/x86_64/abi/bf16/m256bf16/args.h: Ditto.
	* gcc.target/x86_64/abi/bf16/m256bf16/asm-support.S: Ditto.
	* gcc.target/x86_64/abi/bf16/m256bf16/bf16-ymm-check.h: Ditto.
	* gcc.target/x86_64/abi/bf16/m256bf16/test_m256_returning.c: Ditto.
	* gcc.target/x86_64/abi/bf16/m256bf16/test_passing_m256.c: Ditto.
	* gcc.target/x86_64/abi/bf16/m256bf16/test_passing_structs.c: Ditto.
	* gcc.target/x86_64/abi/bf16/m256bf16/test_passing_unions.c: Ditto.
	* gcc.target/x86_64/abi/bf16/m256bf16/test_varargs-m256.c: Ditto.
	* gcc.target/x86_64/abi/bf16/m512bf16/abi-bf16-zmm.exp: Ditto.
	* gcc.target/x86_64/abi/bf16/m512bf16/args.h: Ditto.
	* gcc.target/x86_64/abi/bf16/m512bf16/asm-support.S: Ditto.
	* gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h: Ditto.
	* gcc.target/x86_64/abi/bf16/m512bf16/test_m512_returning.c: Ditto.
	* gcc.target/x86_64/abi/bf16/m512bf16/test_passing_m512.c: Ditto.
	* gcc.target/x86_64/abi/bf16/m512bf16/test_passing_structs.c: Ditto.
	* gcc.target/x86_64/abi/bf16/m512bf16/test_passing_unions.c: Ditto.
	* gcc.target/x86_64/abi/bf16/m512bf16/test_varargs-m512.c: Ditto.
	* gcc.target/x86_64/abi/bf16/macros.h: Ditto.
	* gcc.target/x86_64/abi/bf16/test_3_element_struct_and_unions.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_basic_alignment.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_basic_array_size_and_align.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_basic_returning.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_basic_sizes.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_basic_struct_size_and_align.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_basic_union_size_and_align.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_m128_returning.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_passing_floats.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_passing_m128.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_passing_structs.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_passing_unions.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_struct_returning.c: Ditto.
	* gcc.target/x86_64/abi/bf16/test_varargs-m128.c: Ditto.
2022-08-19 11:25:27 +08:00
GCC Administrator
30afe5e763 Daily bump. 2022-08-19 00:16:27 +00:00
Joseph Myers
d7c3000147 preprocessor: Support #warning for standard C2x
ISO C2x standardizes the existing #warning extension.  Arrange
accordingly for it not to be diagnosed with -std=c2x -pedantic, but to
be diagnosed with -Wc11-c2x-compat.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/testsuite/
	* gcc.dg/cpp/c11-warning-1.c, gcc.dg/cpp/c11-warning-2.c,
	gcc.dg/cpp/c11-warning-3.c, gcc.dg/cpp/c11-warning-4.c,
	gcc.dg/cpp/c2x-warning-1.c, gcc.dg/cpp/c2x-warning-2.c,
	gcc.dg/cpp/gnu11-warning-1.c, gcc.dg/cpp/gnu11-warning-2.c,
	gcc.dg/cpp/gnu11-warning-3.c, gcc.dg/cpp/gnu11-warning-4.c,
	gcc.dg/cpp/gnu2x-warning-1.c, gcc.dg/cpp/gnu2x-warning-2.c: New
	tests.

libcpp/
	* include/cpplib.h (struct cpp_options): Add warning_directive.
	* init.cc (struct lang_flags, lang_defaults): Add
	warning_directive.
	* directives.cc (DIRECTIVE_TABLE): Mark #warning as STDC2X not
	EXTENSION.
	(directive_diagnostics): Diagnose #warning with -Wc11-c2x-compat,
	or with -pedantic for a standard not supporting #warning.
2022-08-18 23:01:01 +00:00
Takayuki 'January June' Suwa
8731aa9867 xtensa: Improve indirect sibling call handling
No longer needs the dedicated hard register (A11) for the address of the
call and the split patterns for fixups, due to the introduction of appropriate
register class and constraint.

(Note: "ISC_REGS" contains a hard register A8 used as a "static chain"
 pointer for nested functions, but no problem;  Pointer to nested function
 actually points to "trampoline", and trampoline itself doesn't receive
 "static chain" pointer to its parent's stack frame from the caller.)

gcc/ChangeLog:

	* config/xtensa/xtensa.h
	(enum reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS):
	Add new register class "ISC_REGS".
	* config/xtensa/constraints.md (c): Add new register constraint.
	* config/xtensa/xtensa.md (define_constants): Remove "A11_REG".
	(sibcall_internal, sibcall_value_internal):
	Change to use the new register constraint, and remove two split
	patterns for fixups that are no longer needed.

gcc/testsuite/ChangeLog:

	* gcc.target/xtensa/sibcalls.c: Add a new test function to ensure
	that registers for arguments (occupy from A2 to A7) and for indirect
	sibcall (should be assigned to A8) neither conflict nor spill out.
2022-08-18 12:59:46 -07:00
Harald Anlauf
ca170ed9f8 Revert "Fortran: fix invalid rank error in ASSOCIATED when rank is remapped [PR77652]"
This reverts commit 0110cfd544.
2022-08-18 21:24:29 +02:00
Maciej W. Rozycki
7f5ec900e5 RISC-V: Standardize formatting of SFB ALU conditional move
Standardize the formatting of SFB ALU conditional move operations from:

	beq a2,zero,1f; mv a0,zero; 1: # movcc

to:

	beq	a2,zero,1f	# movcc
	mv	a0,zero
1:

for consistency with other assembly code produced.  No functional change.

	gcc/
	* config/riscv/riscv.md (*mov<GPR:mode><X:mode>cc): Fix output
	pattern formatting.
2022-08-18 16:50:26 +01:00
Andrea Corallo
5b0d054292 contrib: Fix a typo in contrib/git-fetch-vendor.sh
2022-08-18  Andrea Corallo  <andrea.corallo@arm.com>

	* git-fetch-vendor.sh : Fix typo.
2022-08-18 17:34:58 +02:00
Tim Lange
c83e97317e analyzer: warn on the use of floating-points operands in the size argument [PR106181]
This patch fixes the ICE reported in PR106181 and adds a new warning to
the analyzer complaining about the use of floating-point operands.

Regrtested on Linux x86_64.

2022-08-17  Tim Lange  <mail@tim-lange.me>

gcc/analyzer/ChangeLog:

	PR analyzer/106181
	* analyzer.opt: Add Wanalyzer-imprecise-floating-point-arithmetic.
	* region-model.cc (is_any_cast_p): Formatting.
	(region_model::check_region_size): Ensure precondition.
	(class imprecise_floating_point_arithmetic): New abstract
	diagnostic class for all floating-point related warnings.
	(class float_as_size_arg): Concrete diagnostic class to complain
	about floating-point operands inside the size argument.
	(class contains_floating_point_visitor):
	New visitor to find floating-point operands inside svalues.
	(region_model::check_dynamic_size_for_floats): New function.
	(region_model::set_dynamic_extents):
	Call to check_dynamic_size_for_floats.
	* region-model.h (class region_model):
	Add region_model::check_dynamic_size_for_floats.

gcc/ChangeLog:

	PR analyzer/106181
	* doc/invoke.texi: Add Wanalyzer-imprecise-fp-arithmetic.

gcc/testsuite/ChangeLog:

	PR analyzer/106181
	* gcc.dg/analyzer/allocation-size-1.c: New test.
	* gcc.dg/analyzer/imprecise-floating-point-1.c: New test.
	* gcc.dg/analyzer/pr106181.c: New test.
2022-08-18 16:41:56 +02:00
Aldy Hernandez
011d0a033a Make path_range_query standalone and add reset_path.
These are a bunch of cleanups inspired by Richi's suggestion of making
path_range_query standalone, instead of having to call
compute_ranges() for each path.

I've made the ranger need explicit, and moved the responsibility for
its creation to the caller.

I've also investigated and documented why the forward threader needs its
own compute exit dependencies variant.  I can't wait for it to go away
:-/.

I've also added constructors that take a path and dependencies, and
made compute_ranges() private.  Unfortunately, reinstantiating
path_range_query in the forward threader caused a 14% performance
regression in DOM, because the old threader calls it over and over on
the same path to simplify statements (some of which not even in the
IL, but that's old news).

In the meantime, I've left the ability to reset a path, but this time
appropriately called reset_path().

Tested, benchmarked, and thread counted on x86-64 Linux.

gcc/ChangeLog:

	* gimple-range-path.cc (path_range_query::path_range_query): Add
	various constructors to take a path.
	(path_range_query::~path_range_query): Remove m_alloced_ranger.
	(path_range_query::range_on_path_entry): Adjust for m_ranger being
	a reference.
	(path_range_query::set_path): Rename to...
	(path_range_query::reset_path): ...this and call compute_ranges.
	(path_range_query::ssa_range_in_phi): Adjust for m_ranger
	reference.
	(path_range_query::range_defined_in_block): Same.
	(path_range_query::compute_ranges_in_block): Same.
	(path_range_query::adjust_for_non_null_uses): Same.
	(path_range_query::compute_exit_dependencies): Use m_path instead
	of argument.
	(path_range_query::compute_ranges): Remove path argument.
	(path_range_query::range_of_stmt): Adjust for m_ranger reference.
	(path_range_query::compute_outgoing_relations): Same.
	* gimple-range-path.h (class path_range_query): Add various
	constructors.
	Make compute_ranges and compute_exit_dependencies private.
	Rename set_path to reset_path.
	Make m_ranger a reference.
	Remove m_alloced_ranger.
	* tree-ssa-dom.cc (pass_dominator::execute): Adjust constructor to
	path_range_query.
	* tree-ssa-loop-ch.cc (entry_loop_condition_is_static): Take a
	ranger and instantiate a new path_range_query every time.
	(ch_base::copy_headers): Pass ranger instead of path_range_query.
	* tree-ssa-threadbackward.cc (class back_threader): Remove m_solver.
	(back_threader::~back_threader): Remove m_solver.
	(back_threader::find_taken_edge_switch): Adjust for m_ranger
	reference.
	(back_threader::find_taken_edge_cond): Same.
	(back_threader::dump): Remove m_solver.
	(back_threader::back_threader): Move verify_marked_backedges
	here from the path_range_query constructor.
	* tree-ssa-threadedge.cc (hybrid_jt_simplifier::simplify): Move
	some code from compute_ranges_from_state here.
	(hybrid_jt_simplifier::compute_ranges_from_state): Rename...
	(hybrid_jt_simplifier::compute_exit_dependencies): ...to this.
	* tree-ssa-threadedge.h (class hybrid_jt_simplifier): Rename
	compute_ranges_from_state to compute_exit_dependencies.
	Remove m_path.
2022-08-18 16:38:00 +02:00
Richard Biener
ac68f904fe middle-end/106617 - fix fold_binary_op_with_conditional_arg pattern issue
Now that we have parts of fold_binary_op_with_conditional_arg duplicated
in match.pd and are using ! to take or throw away the result we have to
be careful to not have both implementations play games which each other,
causing quadratic behavior.  In particular the match.pd implementation
requires both arms to simplify while the fold-const.cc is happy with
just one arm simplifying (something we cannot express in match.pd).

The fix is to simply not enable the match.pd pattern for GENERIC.

	PR middle-end/106617
	* match.pd ((a ? b : c) > d -> a ? (b > d) : (c > d)): Fix
	guard, disable on GENERIC to not cause quadratic behavior
	with the fold-const.cc implementation and the use of !

	* gcc.dg/pr106617.c: New testcase.
2022-08-18 16:03:58 +02:00
Andrew Pinski
03119249b9 gcov-dump: properly use INCLUDE_VECTOR
PR gcov-profile/106659

gcc/ChangeLog:

	* gcov-dump.cc (INCLUDE_VECTOR): Include vector.h with
	  INCLUDE_VECTOR.
2022-08-18 14:37:15 +02:00
konglin1
6910cad55f x86: Support vector __bf16 type
gcc/ChangeLog:

	* config/i386/i386-expand.cc (ix86_expand_sse_movcc): Handle vector
	BFmode.
	(ix86_expand_vector_init_duplicate): Support vector BFmode.
	(ix86_expand_vector_init_one_nonzero): Ditto.
	(ix86_expand_vector_init_one_var): Ditto.
	(ix86_expand_vector_init_concat): Ditto.
	(ix86_expand_vector_init_interleave): Ditto.
	(ix86_expand_vector_init_general): Ditto.
	(ix86_expand_vector_init): Ditto.
	(ix86_expand_vector_set_var): Ditto.
	(ix86_expand_vector_set): Ditto.
	(ix86_expand_vector_extract): Ditto.
	* config/i386/i386.cc (classify_argument): Add BF vector modes.
	(function_arg_64): Ditto.
	(ix86_gimplify_va_arg): Ditto.
	(ix86_get_ssemov): Ditto.
	* config/i386/i386.h (VALID_AVX256_REG_MODE): Add BF vector modes.
	(VALID_AVX512F_REG_MODE): Ditto.
	(host_detect_local_cpu): Ditto.
	(VALID_SSE2_REG_MODE): Ditto.
	* config/i386/i386.md: Add BF vector modes.
	(MODE_SIZE): Ditto.
	(ssemodesuffix): Add bf suffix for BF vector modes.
	(ssevecmode): Ditto.
	* config/i386/sse.md (VMOVE): Adjust for BF vector modes.
	(VI12HFBF_AVX512VL): Ditto.
	(V_256_512): Ditto.
	(VF_AVX512HFBF16): Ditto.
	(VF_AVX512BWHFBF16): Ditto.
	(VIHFBF): Ditto.
	(avx512): Ditto.
	(VIHFBF_256): Ditto.
	(VIHFBF_AVX512BW): Ditto.
	(VI2F_256_512):Ditto.
	(V8_128):Ditto.
	(V16_256): Ditto.
	(V32_512): Ditto.
	(sseinsnmode): Ditto.
	(sseconstm1): Ditto.
	(sseintmodesuffix): New mode_attr.
	(avx512fmaskmode): Ditto.
	(avx512fmaskmodelower): Ditto.
	(ssedoublevecmode): Ditto.
	(ssehalfvecmode): Ditto.
	(ssehalfvecmodelower): Ditto.
	(ssescalarmode): Add vector BFmode mapping.
	(ssescalarmodelower): Ditto.
	(ssexmmmode): Ditto.
	(ternlogsuffix): Ditto.
	(ssescalarsize): Ditto.
	(sseintprefix): Ditto.
	(i128): Ditto.
	(xtg_mode): Ditto.
	(bcstscalarsuff): Ditto.
	(<avx512>_blendm<mode>): New define_insn for BFmode.
	(<avx512>_store<mode>_mask): Ditto.
	(vcond_mask_<mode><avx512fmaskmodelower>): Ditto.
	(vec_set<mode>_0): New define_insn for BF vector set.
	(V8BFH_128): New mode_iterator for BFmode.
	(avx512fp16_mov<mode>): Ditto.
	(vec_set<mode>): New define_insn for BF vector set.
	(@vec_extract_hi_<mode>): Ditto.
	(@vec_extract_lo_<mode>): Ditto.
	(vec_set_hi_<mode>): Ditto.
	(vec_set_lo_<mode>): Ditto.
	(*vec_extract<mode>_0): New define_insn_and_split for BF
	vector extract.
	(*vec_extract<mode>): New define_insn.
	(VEC_EXTRACT_MODE): Add BF vector modes.
	(PINSR_MODE): Add V8BF.
	(sse2p4_1): Ditto.
	(pinsr_evex_isa): Ditto.
	(<sse2p4_1>_pinsr<ssemodesuffix>): Adjust to support
	insert for V8BFmode.
	(pbroadcast_evex_isa): Add BF vector modes.
	(AVX2_VEC_DUP_MODE): Ditto.
	(VEC_INIT_MODE): Ditto.
	(VEC_INIT_HALF_MODE): Ditto.
	(avx2_pbroadcast<mode>): Adjust to support BF vector mode
	broadcast.
	(avx2_pbroadcast<mode>_1): Ditto.
	(<avx512>_vec_dup<mode>_1): Ditto.
	(<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>):
	Ditto.

gcc/testsuite/ChangeLog:

	* g++.target/i386/vect-bfloat16-1.C: New test.
	* gcc.target/i386/vect-bfloat16-1.c: New test.
	* gcc.target/i386/vect-bfloat16-2a.c: New test.
	* gcc.target/i386/vect-bfloat16-2b.c: New test.
	* gcc.target/i386/vect-bfloat16-typecheck_1.c: New test.
	* gcc.target/i386/vect-bfloat16-typecheck_2.c: New test.
2022-08-18 19:38:05 +08:00
Martin Liska
2e80388983 build: regenerate gcc/configure
After the change 71f068a9b3, gcc/configure
needs to re-generated.

gcc/ChangeLog:

	* configure: Regenerate.
2022-08-18 12:39:41 +02:00
Sergei Trofimovich
9d2d38a468 Makefile.def: drop remnants of unused libelf
Use of libelf was removed from gcc in r0-104274-g48215350c24d52 ("re PR
lto/46273 (Failed to bootstrap)") around 2010, before gcc-4.6.0.

This change removes unused references to libelf from top-level configure
and Makefile.

/
	* Makefile.def: Drop libelf module and gcc-configure dependency
	on it.
	* Makefile.in: Regenerate with 'autogen Makefile.def'.
	* Makefile.tpl (HOST_EXPORTS): Drop unused LIBELFLIBS and
	LIBELFINC.
	* configure: Regenrate.
	* configure.ac (host_libs): Drop unused libelf.
2022-08-18 09:37:09 +01:00
Sergei Trofimovich
5dbc94bf13 Add libgo dependency on libbacktrace.
Noticed missing dependency when regenerated Makefile.in for unrelated
change with 'autogen Makefile.def'.

The change was lost in r12-6861-gaeac414923aa1e ("Revert "Fix PR 67102:
Add libstdc++ dependancy to libffi" [PR67102]").

/
	* Makefile.in: Regenerate.
2022-08-18 09:37:04 +01:00
Haochen Gui
defa08a336 rs6000: Add expand pattern for multiply-add (PR103109)
gcc/
	PR target/103109
	* config/rs6000/rs6000.md (<u>maddditi4): New pattern for multiply-add.
	(<u>madddi4_highpart): New.
	(<u>madddi4_highpart_le): New.

gcc/testsuite/
	PR target/103109
	* gcc.target/powerpc/pr103109.h: New.
	* gcc.target/powerpc/pr103109-1.c: New.
	* gcc.target/powerpc/pr103109-2.c: New.
2022-08-18 16:33:21 +08:00
Aldy Hernandez
4645ce0d00 Use gimple_range_ssa_names in path_range_query.
gcc/ChangeLog:

	* gimple-range-path.cc
	(path_range_query::compute_exit_dependencies): Use
	gimple_range_ssa_names.
2022-08-18 09:25:35 +02:00
zhongjuzhe
3496ca4e65 RISC-V: Add runtime invariant support
RISC-V 'V' Extension support scalable vector like ARM SVE.
To support RVV, we need to introduce runtime invariant.

- For zve32*, the runtime invariant uses 32-bit chunk.
- For zve64*, the runtime invariant uses 64-bit chunk.

[1] https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#sec-vector-extensions

This patch is preparing patch for RVV support.
Because we didn't introduce vector machine_mode yet, it safe to just change HOST_WIDE_INT into poly_int.
Also it safe to use "to_constant()" function for scalar operation.
This patch has been tested by full dejagnu regression.

gcc/ChangeLog:

	* config/riscv/predicates.md: Adjust runtime invariant.
	* config/riscv/riscv-modes.def (MAX_BITSIZE_MODE_ANY_MODE): New.
	(NUM_POLY_INT_COEFFS): New.
	* config/riscv/riscv-protos.h (riscv_initial_elimination_offset):Adjust
	runtime invariant.
	* config/riscv/riscv-sr.cc (riscv_remove_unneeded_save_restore_calls):
	Adjust runtime invariant.
	* config/riscv/riscv.cc (struct riscv_frame_info): Adjust runtime
	invariant.
	(enum riscv_microarchitecture_type): Ditto.
	(riscv_valid_offset_p): Ditto.
	(riscv_valid_lo_sum_p): Ditto.
	(riscv_address_insns): Ditto.
	(riscv_load_store_insns): Ditto.
	(riscv_legitimize_move): Ditto.
	(riscv_binary_cost): Ditto.
	(riscv_rtx_costs): Ditto.
	(riscv_output_move): Ditto.
	(riscv_extend_comparands): Ditto.
	(riscv_flatten_aggregate_field): Ditto.
	(riscv_get_arg_info): Ditto.
	(riscv_pass_by_reference): Ditto.
	(riscv_elf_select_rtx_section): Ditto.
	(riscv_stack_align): Ditto.
	(riscv_compute_frame_info): Ditto.
	(riscv_initial_elimination_offset): Ditto.
	(riscv_set_return_address): Ditto.
	(riscv_for_each_saved_reg): Ditto.
	(riscv_first_stack_step): Ditto.
	(riscv_expand_prologue): Ditto.
	(riscv_expand_epilogue): Ditto.
	(riscv_can_use_return_insn): Ditto.
	(riscv_secondary_memory_needed): Ditto.
	(riscv_hard_regno_nregs): Ditto.
	(riscv_convert_vector_bits): New.
	(riscv_option_override): Adjust runtime invariant.
	(riscv_promote_function_mode): Ditto.
	* config/riscv/riscv.h (POLY_SMALL_OPERAND_P): New.
	(BITS_PER_RISCV_VECTOR): New.
	(BYTES_PER_RISCV_VECTOR): New.
	* config/riscv/riscv.md: Adjust runtime invariant.
2022-08-18 12:10:57 +08:00
Lulu Cheng
b7d62c551f LoongArch: Get __tls_get_addr address through got table when disable plt.
Fix bug, ICE with tls gd/ld var with -fno-plt.

gcc/ChangeLog:

	* config/loongarch/loongarch.cc (loongarch_call_tls_get_addr):
	Get __tls_get_addr address through got table when disable plt.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/tls-gd-noplt.c: New test.
2022-08-18 10:02:00 +08:00
Takayuki 'January June' Suwa
dca74793cd xtensa: Optimize stack pointer updates in function pro/epilogue under certain conditions
This patch enforces the use of "addmi" machine instruction instead of
addition/subtraction with two source registers for adjusting the stack
pointer, if the adjustment fits into a signed 16-bit and is also a multiple
of 256.

    /* example */
    void test(void) {
      char buffer[4096];
      __asm__(""::"m"(buffer));
    }

    ;; before
    test:
	movi.n	a9, 1
	slli	a9, a9, 12
	sub	sp, sp, a9
	movi.n	a9, 1
	slli	a9, a9, 12
	add.n	sp, sp, a9
	addi	sp, sp, 0
	ret.n

    ;; after
    test:
	addmi	sp, sp, -0x1000
	addmi	sp, sp, 0x1000
	ret.n

gcc/ChangeLog:

	* config/xtensa/xtensa.cc (xtensa_expand_prologue):
	Use an "addmi" machine instruction for updating the stack pointer
	rather than addition/subtraction via hard register A9, if the amount
	of change satisfies the literal value conditions of that instruction
	when the CALL0 ABI is used.
	(xtensa_expand_epilogue): Ditto.
	And also inhibit the stack pointer addition of constant zero.
2022-08-17 17:45:48 -07:00
GCC Administrator
0342f034ad Daily bump. 2022-08-18 00:16:43 +00:00
Maciej W. Rozycki
c352361b5e RISC-V/testsuite: Restrict remaining fmin'/fmax' tests to hard float
Complement commit 7915f65513 ("RISC-V/testsuite: constraint some of
tests to hard_float") and also restrict the remaining `fmin'/`fmax'
tests to hard-float test configurations.

	gcc/testsuite/
	* gcc.target/riscv/fmax-snan.c: Add `dg-require-effective-target
	hard_float'.
	* gcc.target/riscv/fmaxf-snan.c: Likewise.
	* gcc.target/riscv/fmin-snan.c: Likewise.
	* gcc.target/riscv/fminf-snan.c: Likewise.
2022-08-17 23:22:18 +01:00
Roger Sayle
5cccc24c06 [Committed] PR target/106640: Fix use of XINT in TImode compute_convert_gain.
Thanks to Zdenek Sojka for reporting PR target/106640 where an RTL checking
build reveals a thinko in my recent patch to support TImode shifts/rotates
in STV.  My "senior moment" was to inappropriately use XINT where I should
be using INTVAL of XEXP.

2022-08-17  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	PR target/106640
	* config/i386/i386-features.cc
	(timde_scalar_chain::compute_convert_gain): Replace incorrect use
	of XINT with INTVAL (XEXP (src, 1)).
2022-08-17 22:23:33 +01:00
Marek Polacek
177e93e952 c++: Add new std::move test [PR67906]
As discussed in 67906, let's make sure we don't warn about a std::move
when initializing when there's a T(const T&&) ctor.

	PR c++/67906

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/Wredundant-move11.C: New test.
2022-08-17 15:45:14 -04:00
Aldy Hernandez
5adfb6540d Reset root oracle from path_oracle::reset_path.
When we cross a backedge in the path solver, we reset the path
relations and nuke the root oracle.  However, we forget to reset it
for the next path.  This is causing us to miss threads because
subsequent paths will have no root oracle to use.

With this patch we get 201 more threads in the threadfull passes in my
.ii files and 118 more overall (DOM gets less because threadfull runs
before).

Normally, I'd recommend this for the GCC 12 branch, but considering
how sensitive other passes are to jump threading, and that there is no
PR associated with this, perhaps we should leave this out.  Up to the
release maintainers of course.

gcc/ChangeLog:

	* gimple-range-path.cc
	(path_range_query::compute_ranges_in_block): Remove
	set_root_oracle call.
	(path_range_query::compute_ranges): Pass ranger oracle to
	reset_path.
	* value-relation.cc (path_oracle::reset_path): Set root oracle.
	* value-relation.h (path_oracle::reset_path): Add root oracle
	argument.
2022-08-17 20:14:02 +02:00
Marek Polacek
6c136d53e8 c++: Extend -Wredundant-move for const-qual objects [PR90428]
In this PR, Jon suggested extending the -Wredundant-move warning
to warn when the user is moving a const object as in:

  struct T { };

  T f(const T& t)
  {
    return std::move(t);
  }

where the std::move is redundant, because T does not have
a T(const T&&) constructor (which is very unlikely).  Even with
the std::move, T(T&&) would not be used because it would mean
losing the const.  Instead, T(const T&) will be called.

I had to restructure the function a bit, but it's better now.  This patch
depends on my other recent patches to maybe_warn_pessimizing_move.

	PR c++/90428

gcc/cp/ChangeLog:

	* typeck.cc (can_do_rvo_p): Rename to ...
	(can_elide_copy_prvalue_p): ... this.
	(maybe_warn_pessimizing_move): Extend the
	-Wredundant-move warning to warn about std::move on a
	const-qualified object.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/Wredundant-move1.C: Adjust dg-warning.
	* g++.dg/cpp0x/Wredundant-move9.C: Likewise.
	* g++.dg/cpp0x/Wredundant-move10.C: New test.
2022-08-17 13:36:52 -04:00
Marek Polacek
6602a2b2de c++: Tweak for -Wpessimizing-move in templates [PR89780]
In my previous patches I've been extending our std::move warnings,
but this tweak actually dials it down a little bit.  As reported in
bug 89780, it's questionable to warn about expressions in templates
that were type-dependent, but aren't anymore because we're instantiating
the template.  As in,

  template <typename T>
  Dest withMove() {
    T x;
    return std::move(x);
  }

  template Dest withMove<Dest>(); // #1
  template Dest withMove<Source>(); // #2

Saying that the std::move is pessimizing for #1 is not incorrect, but
it's not useful, because removing the std::move would then pessimize #2.
So the user can't really win.  At the same time, disabling the warning
just because we're in a template would be going too far, I still want to
warn for

  template <typename>
  Dest withMove() {
    Dest x;
    return std::move(x);
  }

because the std::move therein will be pessimizing for any instantiation.

So I'm using the suppress_warning machinery to that effect.
Problem: I had to add a new group to nowarn_spec_t, otherwise
suppressing the -Wpessimizing-move warning would disable a whole bunch
of other warnings, which we really don't want.

	PR c++/89780

gcc/cp/ChangeLog:

	* pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Maybe suppress
	-Wpessimizing-move.
	* typeck.cc (maybe_warn_pessimizing_move): Don't issue warnings
	if they are suppressed.
	(check_return_expr): Disable -Wpessimizing-move when returning
	a dependent expression.

gcc/ChangeLog:

	* diagnostic-spec.cc (nowarn_spec_t::nowarn_spec_t): Handle
	OPT_Wpessimizing_move and OPT_Wredundant_move.
	* diagnostic-spec.h (nowarn_spec_t): Add NW_REDUNDANT enumerator.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/Wpessimizing-move3.C: Remove dg-warning.
	* g++.dg/cpp0x/Wredundant-move2.C: Likewise.
2022-08-17 12:39:44 -04:00
Marek Polacek
8d22c7cb8b c++: Extend -Wpessimizing-move to other contexts
In my recent patch which enhanced -Wpessimizing-move so that it warns
about class prvalues too I said that I'd like to extend it so that it
warns in more contexts where a std::move can prevent copy elision, such
as:

  T t = std::move(T());
  T t(std::move(T()));
  T t{std::move(T())};
  T t = {std::move(T())};
  void foo (T);
  foo (std::move(T()));

This patch does that by adding two maybe_warn_pessimizing_move calls.
These must happen before we've converted the initializers otherwise the
std::move will be buried in a TARGET_EXPR.

	PR c++/106276

gcc/cp/ChangeLog:

	* call.cc (build_over_call): Call maybe_warn_pessimizing_move.
	* cp-tree.h (maybe_warn_pessimizing_move): Declare.
	* decl.cc (build_aggr_init_full_exprs): Call
	maybe_warn_pessimizing_move.
	* typeck.cc (maybe_warn_pessimizing_move): Handle TREE_LIST and
	CONSTRUCTOR.  Add a bool parameter and use it.  Adjust a diagnostic
	message.
	(check_return_expr): Adjust the call to maybe_warn_pessimizing_move.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/Wpessimizing-move7.C: Add dg-warning.
	* g++.dg/cpp0x/Wpessimizing-move8.C: New test.
2022-08-17 12:35:45 -04:00
Jakub Jelinek
745be54bd6 fortran: Add -static-libquadmath support [PR46539]
The following patch is a revival of the
https://gcc.gnu.org/legacy-ml/gcc-patches/2014-10/msg00771.html
patch.  While trunk configured against recent glibc and with linker
--as-needed support doesn't really need to link against -lquadmath
anymore, there are still other targets where libquadmath is still in
use.
As has been discussed, making -static-libgfortran imply statically
linking both libgfortran and libquadmath is undesirable because of
the significant licensing differences between the 2 libraries.
Compared to the 2014 patch, this one doesn't handle -lquadmath
addition in the driver, which to me looks incorrect, libgfortran
configure determines where in libgfortran.spec -lquadmath should
be present if at all and with what it should be wrapped, but
analyzes gfortran -### -static-libgfortran stderr and based on
that figures out what gcc/configure.ac determined.

2022-08-17  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
	    Jakub Jelinek  <jakub@redhat.com>

	PR fortran/46539
gcc/
	* common.opt (static-libquadmath): New option.
	* gcc.cc (driver_handle_option): Always accept -static-libquadmath.
	* config/darwin.h (LINK_SPEC): Handle -static-libquadmath.
gcc/fortran/
	* lang.opt (static-libquadmath): New option.
	* invoke.texi (-static-libquadmath): Document it.
	* options.cc (gfc_handle_option): Error out if -static-libquadmath
	is passed but we do not support it.
libgfortran/
	* acinclude.m4 (LIBQUADSPEC): From $FC -static-libgfortran -###
	output determine -Bstatic/-Bdynamic, -bstatic/-bdynamic,
	-aarchive_shared/-adefault linker support or Darwin remapping
	of -lgfortran to libgfortran.a%s and use that around or instead
	of -lquadmath in LIBQUADSPEC.
	* configure: Regenerated.

Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
2022-08-17 17:03:30 +02:00
Tobias Burnus
1513512ec7 Fortran: OpenMP fix declare simd inside modules and absent linear step [PR106566]
gcc/fortran/ChangeLog:

	PR fortran/106566
	* openmp.cc (gfc_match_omp_clauses): Fix setting linear-step value
	to 1 when not specified.
	(gfc_match_omp_declare_simd): Accept module procedures.

gcc/testsuite/ChangeLog:

	PR fortran/106566
	* gfortran.dg/gomp/declare-simd-4.f90: New test.
	* gfortran.dg/gomp/declare-simd-5.f90: New test.
	* gfortran.dg/gomp/declare-simd-6.f90: New test.
2022-08-17 16:19:58 +02:00
Tobias Burnus
027b281f1e OpenMP requires: Fix diagnostic filename corner case
The issue occurs when there is, e.g., main._omp_fn.0 in two files with
different OpenMP requires clauses.  The function entries in the offload
table ends up having the same decl tree and, hence, the diagnostic showed
the same filename for both.  Solution: Use the .o filename in this case.

Note that the issue does not occur with same-named 'static' functions and
without the fatal error from the requires diagnostic, there would be
later a linker error due to having two 'main'.

gcc/
	* lto-cgraph.cc (input_offload_tables): Improve requires diagnostic
	when filenames come out identically.
2022-08-17 15:52:23 +02:00
Tobias Burnus
d9c9424d2c OpenMP: Fix var replacement with 'simd' and linear-step vars [PR106548]
gcc/ChangeLog:

	PR middle-end/106548
	* omp-low.cc (lower_rec_input_clauses): Use build_outer_var_ref
	for 'simd' linear-step values that are variable.

libgomp/ChangeLog:

	PR middle-end/106548
	* testsuite/libgomp.c/linear-2.c: New test.
2022-08-17 15:45:56 +02:00
Tobias Burnus
6b4e49fdfc libgomp/splay-tree.h: Fix splay_tree_prefix handling
When splay_tree_prefix is defined, the .h file
defines splay_* macros to add the prefix. However,
before those were only unset when additionally
splay_tree_c was defined.
Additionally, for consistency undefine splay_tree_c
also when no splay_tree_prefix is defined - there
is no interdependence either.

libgomp/ChangeLog:

	* splay-tree.h: Fix splay_* macro unsetting if
	splay_tree_prefix is defined.
2022-08-17 15:36:41 +02:00
Tobias Burnus
92a5de3df2 OpenMP/C++: Allow classes with static members to be mappable [PR104493]
As this is the last lang-specific user of the omp_mappable_type hook,
the hook is removed, keeping only a generic omp_mappable_type for
incomplete types (or error_node).

	PR c++/104493

gcc/c/ChangeLog:

	* c-decl.cc (c_decl_attributes, finish_decl): Call omp_mappable_type
	instead of removed langhook.
	* c-typeck.cc (c_finish_omp_clauses): Likewise.

gcc/cp/ChangeLog:

	* cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Remove.
	* cp-tree.h (cp_omp_mappable_type, cp_omp_emit_unmappable_type_notes):
	Remove.
	* decl2.cc (cp_omp_mappable_type_1, cp_omp_mappable_type,
	cp_omp_emit_unmappable_type_notes): Remove.
	(cplus_decl_attributes): Call omp_mappable_type instead of
	removed langhook.
	* decl.cc (cp_finish_decl): Likewise; call cxx_incomplete_type_inform
	in lieu of cp_omp_emit_unmappable_type_notes.
	* semantics.cc (finish_omp_clauses): Likewise.

gcc/ChangeLog:

	* gimplify.cc (omp_notice_variable): Call omp_mappable_type
	instead of removed langhook.
	* omp-general.h (omp_mappable_type): New prototype.
	* omp-general.cc (omp_mappable_type):  New; moved from ...
	* langhooks.cc (lhd_omp_mappable_type): ... here.
	* langhooks-def.h (lhd_omp_mappable_type,
	LANG_HOOKS_OMP_MAPPABLE_TYPE): Remove.
	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Remote the latter.
	* langhooks.h (struct lang_hooks_for_types): Remove
	omp_mappable_type.

gcc/testsuite/ChangeLog:

	* g++.dg/gomp/unmappable-1.C: Remove dg-error; remove dg-note no
	longer shown as TYPE_MAIN_DECL is NULL.
	* c-c++-common/gomp/map-incomplete-type.c: New test.

Co-authored-by: Chung-Lin Tang <cltang@codesourcery.com>
2022-08-17 14:31:53 +02:00
Christophe Lyon
06bca6950b arm: Define with_float to hard when target name ends with hf
On arm, the --with-float= configure option is used to define include
files search path (among other things).  However, when targeting
arm-linux-gnueabihf, one would expect to automatically default to the
hard-float ABI, but this is not the case. As a consequence, GCC
bootstrap fails on an arm-linux-gnueabihf target if --with-float=hard
is not used.

This patch checks if the target name ends with 'hf' and defines
with_float to hard if not already defined.  This is achieved in
gcc/config.gcc, just before selecting the default CPU depending on the
$with_float value.

2022-08-17  Christophe Lyon  <christophe.lyon@arm.com>

	gcc/
	* config.gcc (arm): Define with_float to hard if target name ends
	with 'hf'.
2022-08-17 13:49:12 +02:00
Richard Biener
bac07a1da2 Refactor back_threader_profitability
The following refactors profitable_path_p in the backward threader,
splitting out parts that can be computed once the exit block is known,
parts that contiguously update and that can be checked allowing
for the path to be later identified as FSM with larger limits,
possibly_profitable_path_p, and final checks done when the whole
path is known, profitable_path_p.

I've removed the back_threader_profitability instance from the
back_threader class and instead instantiate it once per path
discovery.  I've kept the size compute non-incremental to simplify
the patch and not worry about unwinding.

There's key changes to previous behavior - namely we apply
the param_max_jump_thread_duplication_stmts early only when
we know the path cannot become an FSM one (multiway + thread through
latch) but make sure to elide the path query when we we didn't
yet discover that but are over this limit.  Similarly the
speed limit is now used even when we did not yet discover a
hot BB on the path.  Basically the idea is to only stop path
discovery when we know the path will never become profitable
but avoid the expensive path range query when we know it's
currently not.

I've done a few cleanups, merging functions, on the way.

	* tree-ssa-threadbackward.cc
	(back_threader_profitability): Split profitable_path_p
	into possibly_profitable_path_p and itself, keep state
	as new members.
	(back_threader::m_profit): Remove.
	(back_threader::find_paths): Likewise.
	(back_threader::maybe_register_path): Take profitability
	instance as parameter.
	(back_threader::find_paths_to_names): Likewise.  Use
	possibly_profitable_path_p and avoid the path range query
	when the path is currently too large.
	(back_threader::find_paths): Fold into ...
	(back_threader::maybe_thread_block): ... this.
	(get_gimple_control_stmt): Remove.
	(back_threader_profitability::possibly_profitable_path_p):
	Split out from profitable_path_p, do early profitability
	checks.
	(back_threader_profitability::profitable_path_p): Do final
	profitability path after the taken edge has been determined.
2022-08-17 10:40:43 +02:00
Keef Aragon
5bc2042df4 Fix bug in emergency cxa pool free
This probably has never actually affected anyone in practice. The normal
ABI implementation just uses malloc and only falls back to the pool on
malloc failure. But if that happens a bunch of times the freelist gets out
of order which violates some of the invariants of the freelist (as well as
the comments that follow the bug). The bug is just a comparison reversal
when traversing the freelist in the case where the pointer being returned
to the pool is after the existing freelist.

libstdc++-v3/
	* libsupc++/eh_alloc.cc (pool::free): Inverse comparison.
2022-08-17 10:40:01 +02:00
Xi Ruoyao
3cab897a67
LoongArch: Provide fmin/fmax RTL pattern
We already had smin/smax RTL pattern using fmin/fmax instruction.  But
for smin/smax, it's unspecified what will happen if either operand is
NaN.  So we would generate calls to libc fmin/fmax functions with
-fno-finite-math-only (the default for all optimization levels expect
-Ofast).

But, LoongArch fmin/fmax instruction is IEEE-754-2008 conformant so we
can also use the instruction for fmin/fmax pattern and avoid the library
function call.

gcc/ChangeLog:

	* config/loongarch/loongarch.md (fmax<mode>3): New RTL pattern.
	(fmin<mode>3): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/fmax-fmin.c: New test.
2022-08-17 16:08:05 +08:00
Andrew MacLeod
80f78716c2 Abstract interesting ssa-names from GORI.
Provide a routine to pick out the ssa-names from interesting statements.

	* gimple-range-fold.cc (gimple_range_ssa_names): New.
	* gimple-range-fold.h (gimple_range_ssa_names): New prototype.
	* gimple-range-gori.cc (range_def_chain::get_def_chain): Move
	  code to new routine.
2022-08-16 21:09:00 -04:00
GCC Administrator
47a61e6514 Daily bump. 2022-08-17 00:17:17 +00:00
Jason Merrill
bf13a13c65 c++: remove some xfails
These tests are now passing.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/Wstringop-overflow-4.C: Only xfail for C++98.
	* g++.target/i386/bfloat_cpp_typecheck.C: Remove xfail.
2022-08-16 15:19:46 -04:00
Tom Honermann
60468d6cd4 c++: Fix pragma suppression of -Wc++20-compat diagnostics [PR106423]
Gcc's '#pragma GCC diagnostic' directives are processed in "early mode"
(see handle_pragma_diagnostic_early) for the C++ frontend and, as such,
require that the target diagnostic option be enabled for the preprocessor
(see c_option_is_from_cpp_diagnostics).  This change modifies the
-Wc++20-compat option definition to register it as a preprocessor option
so that its associated diagnostics can be suppressed.  The changes also
implicitly disable the option in C++20 and later modes.  These changes
are consistent with the definition of the -Wc++11-compat option.

This support is motivated by the need to suppress the following diagnostic
otherwise issued in C++17 and earlier modes due to the char8_t typedef
present in the uchar.h header file in glibc 2.36.
  warning: identifier ‘char8_t’ is a keyword in C++20 [-Wc++20-compat]

Tests are added to validate suppression of both -Wc++11-compat and
-Wc++20-compat related diagnostics (fixes were only needed for the C++20
case).

	PR c++/106423

gcc/c-family/ChangeLog:
	* c-opts.cc (c_common_post_options): Disable -Wc++20-compat
	diagnostics in C++20 and later.
	* c.opt (Wc++20-compat): Enable hooks for the preprocessor.

gcc/cp/ChangeLog:
	* parser.cc (cp_lexer_saving_tokens): Add comment regarding
	diagnostic requirements.

gcc/testsuite/ChangeLog:
	* g++.dg/cpp0x/keywords2.C: New test.
	* g++.dg/cpp2a/keywords2.C: New test.

libcpp/ChangeLog:
	* include/cpplib.h (cpp_warning_reason): Add CPP_W_CXX20_COMPAT.
	* init.cc (cpp_create_reader): Add cpp_warn_cxx20_compat.
2022-08-16 15:15:38 -04:00
Martin Liska
9580ab573d docs: remove link to www.bullfreeware.com from install
As mentioned at https://gcc.gnu.org/PR106637#c2, the discontinued
providing binaries.

	PR target/106637

gcc/ChangeLog:

	* doc/install.texi: Remove link to www.bullfreeware.com
2022-08-16 18:15:55 +02:00
Kito Cheng
bd159a7660 RISC-V: Support zfh and zfhmin extension
Zfh and Zfhmin are extensions for IEEE half precision, both are ratified
in Jan. 2022[1]:

- Zfh has full set of operation like F or D for single or double precision.
- Zfhmin has only provide minimal support for half precision operation,
  like conversion, load, store and move instructions.

[1] b35a54079e

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc (riscv_implied_info): Add
	zfh and zfhmin.
	(riscv_ext_version_table): Ditto.
	(riscv_ext_flag_table): Ditto.
	* config/riscv/riscv-opts.h (MASK_ZFHMIN): New.
	(MASK_ZFH): Ditto.
	(TARGET_ZFHMIN): Ditto.
	(TARGET_ZFH): Ditto.
	* config/riscv/riscv.cc (riscv_output_move): Handle HFmode move
	for zfh and zfhmin.
	(riscv_emit_float_compare): Handle HFmode.
	* config/riscv/riscv.md (ANYF): Add HF.
	(SOFTF): Add HF.
	(load): Ditto.
	(store): Ditto.
	(truncsfhf2): New.
	(truncdfhf2): Ditto.
	(extendhfsf2): Ditto.
	(extendhfdf2): Ditto.
	(*movhf_hardfloat): Ditto.
	(*movhf_softfloat): Make sure not ZFHMIN.
	* config/riscv/riscv.opt (riscv_zf_subext): New.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/_Float16-zfh-1.c: New.
	* gcc.target/riscv/_Float16-zfh-2.c: Ditto.
	* gcc.target/riscv/_Float16-zfh-3.c: Ditto.
	* gcc.target/riscv/_Float16-zfhmin-1.c: Ditto.
	* gcc.target/riscv/_Float16-zfhmin-2.c: Ditto.
	* gcc.target/riscv/_Float16-zfhmin-3.c: Ditto.
	* gcc.target/riscv/arch-16.c: Ditto.
	* gcc.target/riscv/arch-17.c: Ditto.
	* gcc.target/riscv/predef-21.c: Ditto.
	* gcc.target/riscv/predef-22.c: Ditto.
2022-08-16 23:34:51 +08:00
Kito Cheng
27d68a6078 RISC-V: Support _Float16 type.
RISC-V decide use _Float16 as primary IEEE half precision type, and this
already become part of psABI, this patch has added folloing support for
_Float16:

- Soft-float support for _Float16.
- Make sure _Float16 available on C++ mode.
- Name mangling for _Float16 on C++ mode.

gcc/ChangeLog

	* config/riscv/riscv-builtins.cc: include stringpool.h
	(riscv_float16_type_node): New.
	(riscv_init_builtin_types): Ditto.
	(riscv_init_builtins): Call riscv_init_builtin_types.
	* config/riscv/riscv-modes.def (HF): New.
	* config/riscv/riscv.cc (riscv_output_move): Handle HFmode.
	(riscv_mangle_type): New.
	(riscv_scalar_mode_supported_p): Ditto.
	(riscv_libgcc_floating_mode_supported_p): Ditto.
	(riscv_excess_precision): Ditto.
	(riscv_floatn_mode): Ditto.
	(riscv_init_libfuncs): Ditto.
	(TARGET_MANGLE_TYPE): Ditto.
	(TARGET_SCALAR_MODE_SUPPORTED_P): Ditto.
	(TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): Ditto.
	(TARGET_INIT_LIBFUNCS): Ditto.
	(TARGET_C_EXCESS_PRECISION): Ditto.
	(TARGET_FLOATN_MODE): Ditto.
	* config/riscv/riscv.md (mode): Add HF.
	(softload): Add HF.
	(softstore): Ditto.
	(fmt): Ditto.
	(UNITMODE): Ditto.
	(movhf): New.
	(*movhf_softfloat): New.

libgcc/ChangeLog:

	* config/riscv/sfp-machine.h (_FP_NANFRAC_H): New.
	(_FP_NANFRAC_H): Ditto.
	(_FP_NANSIGN_H): Ditto.
	* config/riscv/t-softfp32 (softfp_extensions): Add HF related
	routines.
	(softfp_truncations): Ditto.
	(softfp_extras): Ditto.
	* config/riscv/t-softfp64 (softfp_extras): Add HF related routines.

gcc/testsuite/ChangeLog:

	* g++.target/riscv/_Float16.C: New.
	* gcc.target/riscv/_Float16-soft-1.c: Ditto.
	* gcc.target/riscv/_Float16-soft-2.c: Ditto.
	* gcc.target/riscv/_Float16-soft-3.c: Ditto.
	* gcc.target/riscv/_Float16-soft-4.c: Ditto.
	* gcc.target/riscv/_Float16.c: Ditto.
2022-08-16 23:34:20 +08:00