Commit graph

189195 commits

Author SHA1 Message Date
Etienne Servais
ed00b051d9 [Ada] Change format of the ?? warning insertion sequence
gcc/ada/

	* errout.adb (Skip_Msg_Insertion_Warning): Adapt and format as
	Erroutc.Prescan_Message.Parse_Message_Class.
	(Warn_Insertion): Adapt to new format.
	* errout.ads: Update documentation.
	* erroutc.adb (Get_Warning_Tag): Adapt to new format.
	(Prescan_Message): Introduce Parse_Message_Class function.
	(Validate_Specific_Warnings): Update ?W? to ?.w?.
	* erroutc.ads: Update type and documentation.
	* checks.adb (Validity_Check_Range): Update ?X? to ?.x?.
	* exp_ch11.adb (Possible_Local_Raise): Update ?X? to ?.x?.
	(Warn_If_No_Local_Raise): Likewise.
	(Warn_If_No_Propagation): Likewise.
	(Warn_No_Exception_Propagation_Active): Likewise.
	* exp_ch4.adb (Expand_N_Allocator): Attach warning message to
	-gnatw_a.
	* exp_prag.adb (Expand_Pragma_Check): Update ?A? to ?.a?.
	* exp_util.adb (Activate_Atomic_Synchronization): Update ?N? to
	?.n?.
	(Add_Invariant_Check): Update ?L? to ?.l?.
	* freeze.adb (Check_Suspicious_Modulus): Update ?M? to ?.m?.
	(Freeze_Entity): Update ?T? to ?.t?, ?Z? to ?.z?.
	* par-util.adb (Warn_If_Standard_Redefinition): Update ?K? to
	?.k?.
	* sem_attr.adb (Min_Max): Update ?U? to ?.u?.
	* sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Update ?V?
	to ?.v?.
	(Adjust_Record_For_Reverse_Bit_Order_Ada_95): Update ?V? to ?.v?.
	(Component_Size_Case): Update ?S? to ?.s?.
	(Analyze_Record_Representation_Clause): Update ?S? to ?.s? and
	?C? to ?.c?.
	(Add_Call): Update ?L? to ?.l?.
	(Component_Order_Check): Attach warning message to -gnatw_r.
	(Check_Component_List): Update ?H? to ?.h?.
	(Set_Biased): Update ?B? to ?.b?.
	* sem_ch3.adb (Modular_Type_Declaration): Update ?M? to ?.m?.
	* sem_ch4.adb (Analyze_Mod): Update ?M? to ?.m?.
	(Analyze_Quantified_Expression): Update ?T? to ?.t?.
	* sem_ch6.adb (Check_Conformance): Attach warning message to
	-gnatw_p.
	(List_Inherited_Pre_Post_Aspects): Update ?L? to ?.l?.
	* sem_ch7.adb (Unit_Requires_Body_Info): Update ?Y? to ?.y?.
	* sem_ch8.adb (Analyze_Object_Renaming): Update ?R? to ?.r?.
	* sem_prag.adb (Validate_Compile_Time_Warning_Or_Error): Attach
	warning message to -gnatw_c.
	* sem_res.adb (Check_Argument_Order): Update ?P? to ?.p?.
	(Resolve_Comparison_Op): Update ?U? to ?.u?.
	(Resolve_Range): Update ?U? to ?.u?.
	(Resolve_Short_Circuit): Update ?A? to ?.a?.
	(Resolve_Unary_Op): Update ?M? to ?.m?.
	* sem_util.adb (Check_Result_And_Post_State): Update ?T? to ?.t?.
	* sem_warn.adb (Output_Unused_Warnings_Off_Warnings): Update ?W?
	to ?.w?.
	* warnsw.ads: Update documentation for -gnatw_c.
2021-10-25 15:07:22 +00:00
Bob Duff
83e6be717c [Ada] Fix a comment
gcc/ada/

	* inline.adb (Establish_Actual_Mapping_For_Inlined_Call): Fix
	comment.
2021-10-25 15:07:21 +00:00
Bob Duff
034c311752 [Ada] Fix bugs in Base_Type_Only (etc.) fields
gcc/ada/

	* gen_il-gen.adb (Put_Seinfo): Generate type
	Seinfo.Type_Only_Enum based on type
	Gen_IL.Internals.Type_Only_Enum. Automatically generating a copy
	of the type will help keep them in sync.  (Note that there are
	no Ada compiler packages imported into Gen_IL.)  Add a Type_Only
	field to Field_Descriptor, so this information is available in
	the Ada compiler (as opposed to just in the Gen_IL "compiler").
	(One_Comp): Add initialization of the Type_Only field of
	Field_Descriptor.
	* gen_il-internals.ads (Image): Image function for
	Type_Only_Enum.
	* atree.ads (Node_To_Fetch_From): New function to compute which
	node to fetch from, based on the Type_Only aspect.
	* atree.adb (Get_Field_Value): Call Node_To_Fetch_From.
	* treepr.adb (Print_Entity_Field): Call Node_To_Fetch_From.
	(Print_Node_Field): Assert.
	* sinfo-utils.adb (Walk_Sinfo_Fields,
	Walk_Sinfo_Fields_Pairwise): Asserts.
2021-10-25 15:07:21 +00:00
Piotr Trojanek
234815d4c3 [Ada] Simplify iteration of record components when expanding equality
gcc/ada/

	* exp_ch4.adb (Expand_Composite_Equality): Fix style.
	(Element_To_Compare): Simplify loop.
	(Expand_Record_Equality): Adapt calls to Element_To_Compare.
2021-10-25 15:07:21 +00:00
Steve Baird
1ddc39479b [Ada] Relax INOX restrictions when casing on composite value.
gcc/ada/

	* sem_case.adb (Composite_Case_Ops.Box_Value_Required): A new
	function which takes a component type and returns a Boolean.
	Returns True for the cases which were formerly forbidden as
	components (these checks were formerly performed in the
	now-deleted procedure
	Check_Composite_Case_Selector.Check_Component_Subtype).
	(Composite_Case_Ops.Normalized_Case_Expr_Type): Hoist this
	function out of the Array_Case_Ops package because it has been
	generalized to also do the analogous thing in the case of a
	discriminated type.
	(Composite_Case_Ops.Scalar_Part_Count): Return 0 if
	Box_Value_Required returns True for the given type/subtype.
	(Composite_Case_Ops.Choice_Analysis.Choice_Analysis.Component_Bounds_Info.
	Traverse_Discrete_Parts): Return without doing anything if
	Box_Value_Required returns True for the given type/subtype.
	(Composite_Case_Ops.Choice_Analysis.Parse_Choice.Traverse_Choice):
	If Box_Value_Required yields True for a given component type,
	then check that the value of that component in a choice
	expression is indeed a box (in which case the component is
	ignored).
	* doc/gnat_rm/implementation_defined_pragmas.rst: Update
	documentation.
	* gnat_rm.texi: Regenerate.
2021-10-25 15:07:21 +00:00
Piotr Trojanek
8bada6e975 [Ada] Update the inactive GMP variant of Big_Integers
gcc/ada/

	* libgnat/a-nbnbin__gmp.adb (From_String): Fix predicate
	mismatch between subprogram declaration and body.
2021-10-25 15:07:21 +00:00
Bob Duff
93c63f32a2 [Ada] Make Declaration_Node return nondeclarations in fewer cases
gcc/ada/

	* einfo-utils.adb (Declaration_Node): Avoid returning the
	following node kinds: N_Assignment_Statement, N_Integer_Literal,
	N_Procedure_Call_Statement, N_Subtype_Indication, and
	N_Type_Conversion.  Assert that the result is in N_Is_Decl or
	empty.
	* gen_il-gen-gen_nodes.adb (N_Is_Decl): Modify to match the
	things that Declaration_Node can return.
2021-10-25 15:07:21 +00:00
Piotr Trojanek
a3a6a0a50a [Ada] Global contracts on expression functions in Ada.Strings.Superbounded
gcc/ada/

	* libgnat/a-strsup.ads (Super_Length, Super_Element,
	Super_Slice): Add Global contracts.
2021-10-25 15:07:20 +00:00
Piotr Trojanek
9e67eed1ef [Ada] Simplify detection of a parent interface equality
gcc/ada/

	* exp_ch3.adb (Predefined_Primitive_Bodies): Simplify detection
	of existing equality operator.
2021-10-25 15:07:20 +00:00
Piotr Trojanek
6888031123 [Ada] Remove redundant guard in expansion of dispatching calls
gcc/ada/

	* exp_ch3.adb (Predefined_Primitive_Bodies): Remove redundant
	conditions related to interface types.
2021-10-25 15:07:20 +00:00
Piotr Trojanek
1be75e7451 [Ada] Do not expect execv to return 0
gcc/ada/

	* adaint.c (__gnat_portable_spawn): Do not expect execv to
	return 0.
	(__gnat_portable_no_block_spawn): Likewise.
2021-10-25 15:07:20 +00:00
Ghjuvan Lacambre
c9d2cc2ac8 [Ada] Initialize variable to Empty
gcc/ada/

	* sem_ch8.adb (Analyze_Subprogram_Renaming): Set New_S to Empty.
2021-10-25 15:07:20 +00:00
Piotr Trojanek
98f939e9c9 [Ada] Reference in Unbounded_String is almost never null
gcc/ada/

	* libgnat/a-strunb.ads (Unbounded_String): Reference is never
	null.
	* libgnat/a-strunb.adb (Finalize): Copy reference while it needs
	to be deallocated.
2021-10-25 15:07:20 +00:00
Piotr Trojanek
f977a79272 [Ada] Don't expect enumeration literals to be renamings
gcc/ada/

	* lib-xref.adb (Get_Through_Renamings): Exit loop when an
	enumeration literal is found.
2021-10-25 15:07:20 +00:00
Arnaud Charlet
c652a33260 [Ada] Shutdown codepeer message
gcc/ada/

	* libgnat/s-widthu.adb: Add pragma Annotate.
2021-10-25 15:07:20 +00:00
Javier Miranda
67397bb988 [Ada] Ada 2022: Class-wide types and formal abstract subprograms
gcc/ada/

	* sem_ch8.adb (Build_Class_Wide_Wrapper): Previous version split
	in two subprograms to factorize its functionality:
	Find_Suitable_Candidate, and Build_Class_Wide_Wrapper. These
	routines are also placed in the new subprogram
	Handle_Instance_With_Class_Wide_Type.
	(Handle_Instance_With_Class_Wide_Type): New subprogram that
	encapsulates all the code that handles instantiations with
	class-wide types.
	(Analyze_Subprogram_Renaming): Adjust code to invoke the new
	nested subprogram Handle_Instance_With_Class_Wide_Type; adjust
	documentation.
2021-10-25 15:07:19 +00:00
Bob Duff
19e7eae5b9 [Ada] Renamed_Or_Alias cleanup
gcc/ada/

	* einfo-utils.ads, einfo-utils.adb (Alias, Set_Alias,
	Renamed_Entity, Set_Renamed_Entity, Renamed_Object,
	Set_Renamed_Object): Add assertions that reflect how these are
	supposed to be used and what they are supposed to return.
	(Renamed_Entity_Or_Object): New getter.
	(Set_Renamed_Object_Of_Possibly_Void): Setter that allows N to
	be E_Void.
	* checks.adb (Ensure_Valid): Use Renamed_Entity_Or_Object
	because this is called for both cases.
	* exp_dbug.adb (Debug_Renaming_Declaration): Use
	Renamed_Entity_Or_Object because this is called for both cases.
	Add assertions.
	* exp_util.adb (Possible_Bit_Aligned_Component): Likewise.
	* freeze.adb (Freeze_All_Ent): Likewise.
	* sem_ch5.adb (Within_Function): Likewise.
	* exp_attr.adb (Calculate_Header_Size): Call Renamed_Entity
	instead of Renamed_Object.
	* exp_ch11.adb (Expand_N_Raise_Statement): Likewise.
	* repinfo.adb (Find_Declaration): Likewise.
	* sem_ch10.adb (Same_Unit, Process_Spec_Clauses,
	Analyze_With_Clause, Install_Parents): Likewise.
	* sem_ch12.adb (Build_Local_Package, Needs_Body_Instantiated,
	Build_Subprogram_Renaming, Check_Formal_Package_Instance,
	Check_Generic_Actuals, In_Enclosing_Instance,
	Denotes_Formal_Package, Process_Nested_Formal,
	Check_Initialized_Types, Map_Formal_Package_Entities,
	Restore_Nested_Formal): Likewise.
	* sem_ch6.adb (Report_Conflict): Likewise.
	* sem_ch8.adb (Analyze_Exception_Renaming,
	Analyze_Generic_Renaming, Analyze_Package_Renaming,
	Is_Primitive_Operator_In_Use, Declared_In_Actual,
	Note_Redundant_Use): Likewise.
	* sem_warn.adb (Find_Package_Renaming): Likewise.
	* sem_elab.adb (Ultimate_Variable): Call Renamed_Object instead
	of Renamed_Entity.
	* exp_ch6.adb (Get_Function_Id): Call
	Set_Renamed_Object_Of_Possibly_Void, because the defining
	identifer is still E_Void at this point.
	* sem_util.adb (Function_Call_Or_Allocator_Level): Likewise.
	Remove redundant (unreachable) code.
	(Is_Object_Renaming, Is_Valid_Renaming): Call Renamed_Object
	instead of Renamed_Entity.
	(Get_Fullest_View): Call Renamed_Entity instead of
	Renamed_Object.
	(Copy_Node_With_Replacement): Call
	Set_Renamed_Object_Of_Possibly_Void because the defining entity
	is sometimes E_Void.
	* exp_ch5.adb (Expand_N_Assignment_Statement): Protect a call to
	Renamed_Object with Is_Object to avoid assertion failure.
	* einfo.ads: Minor comment fixes.
	* inline.adb: Minor comment fixes.
	* tbuild.ads: Minor comment fixes.
2021-10-25 15:07:19 +00:00
Arnaud Charlet
bb20000c9f [Ada] Remove more uses of exception propagation during bootstrap
gcc/ada/

	* sem_ch13.adb (Build_Discrete_Static_Predicate): Remove use of
	exception propagation since this code is exercised during the
	bootstrap.
2021-10-25 15:07:19 +00:00
Yannick Moy
5145d173a8 [Ada] Issue error on invalid use of Ghost inside pragma Predicate
gcc/ada/

	* sem_ch13.adb (Freeze_Entity_Checks): Perform same check on
	predicate expression inside pragma as inside aspect.
	* sem_util.adb (Is_Current_Instance): Recognize possible
	occurrence of subtype as current instance inside the pragma
	Predicate.
2021-10-25 15:07:19 +00:00
Ghjuvan Lacambre
ea5f7f3962 [Ada] Fix deleted Compile_Time warnings causing crashes
gcc/ada/

	* erroutc.adb (Count_Compile_Time_Pragma_Warnings): Don't count
	deleted warnings.
2021-10-25 15:07:19 +00:00
Andrew MacLeod
387c665392 Initialize variable.
gcc/fortran/
	* trans-decl.c (gfc_conv_cfi_to_gfc): Initialize rank to NULL_TREE.
2021-10-25 10:43:06 -04:00
Andrew MacLeod
17d26698aa Always output exported ranges to a dump_file.
* gimple-range.cc (gimple_ranger::export_global_ranges): Remove check
	for TDF_DETAILS.
2021-10-25 10:43:06 -04:00
Andrew MacLeod
2bfb21bb8c Tweak ranger-debug flags.
Set the 3 possible flags as all individual bits and group for options.

	* flag-types.h (enum ranger_debug): Adjust values.
	* params.opt (ranger_debug): Ditto.
2021-10-25 10:43:06 -04:00
Tamar Christina
2cbfaba606 AArch64 testsuite: Force shrn-combine-*.c to use NEON.
These tests are testing Advanced SIMD codegen, so if the compiler or the
testsuite is forcing SVE they will fail.

This adds +nosve so that we always generate Advanced SIMD codegen.

gcc/testsuite/ChangeLog:

	PR target/102907
	* gcc.target/aarch64/shrn-combine-1.c: Disable SVE.
	* gcc.target/aarch64/shrn-combine-2.c: Likewise.
	* gcc.target/aarch64/shrn-combine-3.c: Likewise.
	* gcc.target/aarch64/shrn-combine-4.c: Likewise.
	* gcc.target/aarch64/shrn-combine-5.c: Likewise.
	* gcc.target/aarch64/shrn-combine-6.c: Likewise.
	* gcc.target/aarch64/shrn-combine-7.c: Likewise.
2021-10-25 15:14:04 +01:00
Martin Jambor
f217e87972
sra: Fix the fix for PR 102505 (PR 102886)
I was not careful with the fix for PR 102505 and did not craft the
check to satisfy the verifier carefully, which lead to PR 102886.
(The verifier has the test structured differently and somewhat
redundantly, so I could not just copy it).

This patch fixes it.  I hope it is quite obvious correction of an
oversight and so will commit it if survives bootstrap and testing on
x86_64-linux and ppc64le-linux.

Testcase for this bug is gcc.dg/tree-ssa/sra-18.c (but only on
platforms with constant pools).  I will backport the two fixes
to the release branches squashed.

gcc/ChangeLog:

2021-10-22  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/102886
	* tree-sra.c (totally_scalarize_subtree): Fix the out of
	access-condition.
2021-10-25 15:26:39 +02:00
Andrew Pinski
7518e4c2f0 Fix PR 102908: wrongly removing null pointer loads
Just like PR 100382, here we have a DCE removing a
null pointer load which is needed still.
In this case, execute_fixup_cfg removes a store (correctly)
and then removes the null load (incorrectly) due to
not checking stmt_unremovable_because_of_non_call_eh_p.
This patch adds the check in the similar way as the patch
to fix PR 100382 did.

gcc/ChangeLog:

	* tree-ssa-dce.c (simple_dce_from_worklist):
	Check stmt_unremovable_because_of_non_call_eh_p also
	before removing the statement.
2021-10-25 12:08:37 +00:00
Richard Biener
0b028fb498 tree-optimization/102905 - restore re-align load for alignment peeling
Previous refactoring made the possibility of considering re-aligned
loads for unlimited cost model alignment peeling difficult so I
ditched that.  Later refactoring made it easily possible again so
the following patch re-instantiates this which should fix the
observed regression on powerpc with altivec.

2021-10-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/102905
	* tree-vect-data-refs.c (vect_enhance_data_refs_alignment):
	Use vect_supportable_dr_alignment again to determine whether
	an access is supported when not aligned.
2021-10-25 12:49:24 +02:00
Kito Cheng
77b84fb0a8 RISC-V: Cost model for ZBS extension.
gcc/ChangeLog:

	* config/riscv/riscv.c (riscv_rtx_costs): Handle cost model
	for zbs extension.
2021-10-25 17:10:16 +08:00
Jim Wilson
4e1e0d79ec RISC-V: Implement instruction patterns for ZBS extension.
2021-10-25  Jim Wilson  <jimw@sifive.com>
	    Kito Cheng  <kito.cheng@sifive.com>

gcc/ChangeLog:

	* config/riscv/bitmanip.md (shiftm1): New.
	(*bset<mode>): Ditto.
	(*bset<mode>_mask): Ditto.
	(*bset<mode>_1): Ditto.
	(*bset<mode>_1_mask): Ditto.
	(*bseti<mode>): Ditto.
	(*bclr<mode>): Ditto.
	(*bclri<mode>): Ditto.
	(*binv<mode>): Ditto.
	(*binvi<mode>): Ditto.
	(*bext<mode>): Ditto.
	(*bexti): Ditto.
	* config/riscv/predicates.md (splittable_const_int_operand):
	Handle bseti.
	(single_bit_mask_operand): New.
	(not_single_bit_mask_operand): Ditto.
	(const31_operand): Ditto.
	(const63_operand): Ditto.
	* config/riscv/riscv.c (riscv_build_integer_1): Handle bseti.
	(riscv_output_move): Ditto.
	(riscv_print_operand): Handle new operand type: T and S.
	* config/riscv/riscv.h (SINGLE_BIT_MASK_OPERAND): New.

2021-10-25  Jia-Wei Chen  <jiawei@iscas.ac.cn>
	    Shi-Hua Liao  <shihua@iscas.ac.cn>

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/zba-slliuw.c: Apply zbs to this testcase.
	* gcc.target/riscv/zbs-bclr.c: New.
	* gcc.target/riscv/zbs-bext.c: Ditto.
	* gcc.target/riscv/zbs-binv.c: Ditto.
	* gcc.target/riscv/zbs-bset.c: Ditto.

Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
Co-authored-by: Jia-Wei Chen <jiawei@iscas.ac.cn>
Co-authored-by: Shi-Hua Liao <shihua@iscas.ac.cn>
2021-10-25 17:10:02 +08:00
Jim Wilson
26d2818bb7 RISC-V: Use li and rori to load constants.
gcc/ChangeLog:

	* config/riscv/riscv.c (riscv_build_integer_1): Build integer
	with rotate.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/zbb-li-rotr.c: New.
2021-10-25 17:06:46 +08:00
Kito Cheng
3329d892eb RISC-V: Cost model for zbb extension.
2021-10-25  Kito Cheng  <kito.cheng@sifive.com>

gcc/ChangeLog:

	* config/riscv/riscv.c (riscv_extend_cost): Handle cost model
	for zbb extension.
	(riscv_rtx_costs): Ditto.
2021-10-25 17:06:46 +08:00
Jim Wilson
e596a283e5 RISC-V: Implement instruction patterns for ZBB extension.
2021-10-25  Jim Wilson  <jimw@sifive.com>
	    Kito Cheng  <kito.cheng@sifive.com>
	    Jia-Wei Chen  <jiawei@iscas.ac.cn>

gcc/ChangeLog:

	* config/riscv/bitmanip.md (bitmanip_bitwise): New.
	(bitmanip_minmax): New.
	(clz_ctz_pcnt): New.
	(bitmanip_optab): New.
	(bitmanip_insn): New.
	(*<optab>_not<mode>): New.
	(*xor_not<mode>): New.
	(<bitmanip_optab>si2): New.
	(*<bitmanip_optab>disi2): New.
	(<bitmanip_optab>di2): New.
	(*zero_extendhi<GPR:mode>2_bitmanip): New.
	(*extend<SHORT:mode><SUPERQI:mode>2_zbb): New.
	(*zero_extendhi<GPR:mode>2_zbb): New.
	(rotrsi3): New.
	(rotrdi3): New.
	(rotrsi3_sext): New.
	(rotlsi3): New.
	(rotldi3): New.
	(rotlsi3_sext): New.
	(bswap<mode>2): New.
	(<bitmanip_optab><mode>3): New.
	* config/riscv/riscv.md (type): Add rotate.
	(zero_extendhi<GPR:mode>2): Change to define_expand pattern.
	(*zero_extendhi<GPR:mode>2): New.
	(extend<SHORT:mode><SUPERQI:mode>2): Change to define_expand pattern.
	(*extend<SHORT:mode><SUPERQI:mode>2): New.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/zbb-andn-orn-xnor-01.c: New.
	* gcc.target/riscv/zbb-andn-orn-xnor-02.c: Ditto.
	* gcc.target/riscv/zbb-min-max.c: Ditto.
	* gcc.target/riscv/zbb-rol-ror-01.c: Ditto.
	* gcc.target/riscv/zbb-rol-ror-02.c: Ditto.
	* gcc.target/riscv/zbb-rol-ror-03.c: Ditto.
	* gcc.target/riscv/zbbw.c: Ditto.

Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
Co-authored-by: Jia-Wei Chen <jiawei@iscas.ac.cn>
2021-10-25 17:06:40 +08:00
Kito Cheng
04a9b554ba RISC-V: Cost model for zba extension.
gcc/ChangeLog:

	* config/riscv/riscv.c (riscv_extend_cost): Handle cost model
	for zba extension.
	(riscv_rtx_costs): Ditto.
2021-10-25 17:06:18 +08:00
Jim Wilson
283b1707f2 RISC-V: Implement instruction patterns for ZBA extension.
2021-10-25  Jim Wilson  <jimw@sifive.com>
	    Kito Cheng  <kito.cheng@sifive.com>
	    Jia-Wei Chen  <jiawei@iscas.ac.cn>

gcc/ChangeLog:

	* config/riscv/bitmanip.md (*zero_extendsidi2_bitmanip): New.
	(*shNadd): Ditto.
	(*shNadduw): Ditto.
	(*add.uw): Ditto.
	(*slliuw): Ditto.
	(riscv_rtx_costs): Ditto.
	* config/riscv/riscv.md: Include bitmanip.md
	(type): Add bitmanip bype.
	(zero_extendsidi2): Change to define_expand pattern.
	(*zero_extendsidi2_internal): New.
	(zero_extendsidi2_shifted): Disable for ZBA.

2021-10-25  Kito Cheng  <kito.cheng@sifive.com>
	    Jia-Wei Chen  <jiawei@iscas.ac.cn>

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/zba-adduw.c: New.
	* gcc.target/riscv/zba-shNadd-01.c: Ditto.
	* gcc.target/riscv/zba-shNadd-02.c: Ditto.
	* gcc.target/riscv/zba-shNadd-03.c: Ditto.
	* gcc.target/riscv/zba-slliuw.c: Ditto.
	* gcc.target/riscv/zba-zextw.c: Ditto.

Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
Co-authored-by: Jia-Wei Chen <jiawei@iscas.ac.cn>
2021-10-25 17:06:13 +08:00
Kito Cheng
149e217033 RISC-V: Minimal support of bitmanip extension
2021-10-25  Kito Cheng  <kito.cheng@sifive.com>

gcc/ChangeLog:

	* common/config/riscv/riscv-common.c (riscv_ext_version_table):
	Add zba, zbb, zbc and zbs.
	(riscv_ext_flag_table): Ditto.
	* config/riscv/riscv-opts.h (MASK_ZBA): New.
	(MASK_ZBB): Ditto.
	(MASK_ZBC): Ditto.
	(MASK_ZBS): Ditto.
	(TARGET_ZBA): Ditto.
	(TARGET_ZBB): Ditto.
	(TARGET_ZBC): Ditto.
	(TARGET_ZBS): Ditto.
	* config/riscv/riscv.opt (riscv_zb_subext): New.
2021-10-25 17:04:17 +08:00
liuhongt
1a07bc9cda Simplify (_Float16) sqrtf((float) a) to .SQRT(a) when a is a _Float16 value.
Similar for sqrt/sqrtl.

gcc/ChangeLog:

	PR target/102464
	* match.pd: Simplify (_Float16) sqrtf((float) a) to .SQRT(a)
	when direct_internal_fn_supported_p, similar for sqrt/sqrtl.

gcc/testsuite/ChangeLog:

	PR target/102464
	* gcc.target/i386/pr102464-sqrtph.c: New test.
	* gcc.target/i386/pr102464-sqrtsh.c: New test.
2021-10-25 16:53:55 +08:00
Richard Biener
aa15952d64 tree-optimization/102920 - fix PHI VN with undefined args
This fixes a latent issue exposed by now allowing VN_TOP in PHI
arguments.  We may only use optimistic equality when merging values on
different edges, not when merging values on the same edge - in particular
we may not choose the undef value on any edge when there's a not undef
value as well.

2021-10-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/102920
	* tree-ssa-sccvn.h (expressions_equal_p): Add argument
	controlling VN_TOP matching behavior.
	* tree-ssa-sccvn.c (expressions_equal_p): Likewise.
	(vn_phi_eq): Do not optimistically match VN_TOP.

	* gcc.dg/torture/pr102920.c: New testcase.
2021-10-25 10:28:00 +02:00
konglin1
7c20a9b738 Combine the FADD(A, FMA(B, C, 0)) to FMA(B, C, A) and combine FADD(A, FMUL(B, C)) to FMA(B, C, A).
This patch is to support transform in fast-math something like
_mm512_add_ph(x1, _mm512_fmadd_pch(a, b, _mm512_setzero_ph())) to
 _mm512_fmadd_pch(a, b, x1).

And support transform _mm512_add_ph(x1, _mm512_fmul_pch(a, b))
to _mm512_fmadd_pch(a, b, x1).

gcc/ChangeLog:

	* config/i386/sse.md (fma_<mode>_fadd_fmul): Add new
	define_insn_and_split.
	(fma_<mode>_fadd_fcmul):Likewise
	(fma_<complexopname>_<mode>_fma_zero):Likewise

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-complex-fma.c: New test.
2021-10-25 16:01:14 +08:00
GCC Administrator
37935c0184 Daily bump. 2021-10-25 00:16:18 +00:00
John David Anglin
3f861a5c8f Revise -mdisable-fpregs option and add new -msoft-mult option
The behavior of the -mdisable-fpregs is confusing in that it doesn't
disable the use of the floating-point registers in all situations.
The -msoft-float disables the use of the floating-point registers in
all situations.  The Linux kernel only needs to disable use of the
xmpyu instruction to avoid using the floating-point registers.

This change revises the -mdisable-fpregs option to disable the use of
the floating-point registers in all situations.  It is now equivalent
to the -msoft-float option.  A new -msoft-mult option is added to
disable use of the xmpyu instruction.  The libgcc library can be
compiled with the -msoft-mult option to avoid using hardware integer
multiplication.

2021-10-24  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

	* config/pa/pa-d.c (pa_d_handle_target_float_abi): Don't check
	TARGET_DISABLE_FPREGS.
	* config/pa/pa.c (fix_range): Use MASK_SOFT_FLOAT instead of
	MASK_DISABLE_FPREGS.
	(hppa_rtx_costs): Don't check TARGET_DISABLE_FPREGS.  Adjust
	cost of hardware integer multiplication.
	(pa_conditional_register_usage): Don't check TARGET_DISABLE_FPREGS.
	* config/pa/pa.h (INT14_OK_STRICT): Likewise.
	* config/pa/pa.md: Don't check TARGET_DISABLE_FPREGS. Check
	TARGET_SOFT_FLOAT in patterns that use xmpyu instruction.
	* config/pa/pa.opt (mdisable-fpregs): Change target mask to
	SOFT_FLOAT.  Revise comment.
	(msoft-float): New option.
2021-10-24 17:52:02 +00:00
John David Anglin
c448579312 Don't use 'G' constraint in integer move patterns
The 'G' constraint only matches a float zero.

2021-10-24  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

	* config/pa/pa.md: Don't use 'G' constraint in integer move patterns.
2021-10-24 16:38:58 +00:00
Roger Sayle
9d1727a30e [Committed] Correct testcase gcc.target/bfin/20090914-3.c
This patch cures the testsuite failure of bfin/20090914-3.c, which
currently FAILs on bfin-elf with "(test for excess errors)" due to:
20090914-3.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
which is obviously not what this code was intended to test.  Fixed by
turning the code into a function returning the final "fract32" result,
as simply specifying an "int" return type for main, results in the
entire function being optimized away, as the result is unused.

2021-10-24  Roger Sayle  <roger@nextmovesoftware.com>

gcc/testsuite/ChangeLog
	* gcc.target/bfin/20090914-3.c: Tweak test case.
2021-10-24 14:30:10 +01:00
Gerald Pfeifer
dfe1ac896a doc: Remove details around Itanium on GNU/Linux and Windows
gcc:
	* doc/install.texi (Specific): Remove obsolete details
	around GNU/Linux on Itanium.
	(Specific): Remove reference to Windows for Itanium.
2021-10-24 11:22:45 +02:00
GCC Administrator
a350f56f06 Daily bump. 2021-10-24 00:16:25 +00:00
Bernhard Reutner-Fischer
710d9ad5a2 config/i386: Commentary typo fix
gcc/ChangeLog:

	* config/i386/x86-tune-sched-bd.c (dispatch_group): Commentary
	typo fix.
2021-10-23 20:51:00 +02:00
Jan Hubicka
e3725624ec cleanup compute_points_to_sets
gcc/ChangeLog:

	* tree-ssa-structalias.c (compute_points_to_sets): Cleanup.
2021-10-23 17:44:32 +02:00
H.J. Lu
d891ab1bc8 Move bind-c-intent-out-2.f90 to gfortran.dg/ubsan
Move bind-c-intent-out-2.f90 to gfortran.dg/ubsan for -fsanitize=undefined.

	PR fortran/9262
	* gfortran.dg/bind-c-intent-out-2.f90: Moved to ...
	* gfortran.dg/ubsan/bind-c-intent-out-2.f90
2021-10-23 05:40:09 -07:00
Roger Sayle
3605187516 x86_64: Add insn patterns for V1TI mode logic operations.
On x86_64, V1TI mode holds a 128-bit integer value in a (vector) SSE
register (where regular TI mode uses a pair of 64-bit general purpose
scalar registers).  This patch improves the implementation of AND, IOR,
XOR and NOT on these values.

The benefit is demonstrated by the following simple test program:

typedef unsigned __int128 v1ti __attribute__ ((__vector_size__ (16)));
v1ti and(v1ti x, v1ti y) { return x & y; }
v1ti ior(v1ti x, v1ti y) { return x | y; }
v1ti xor(v1ti x, v1ti y) { return x ^ y; }
v1ti not(v1ti x) { return ~x; }

For which GCC currently generates the rather large:

and:    movdqa  %xmm0, %xmm2
        movq    %xmm1, %rdx
        movq    %xmm0, %rax
        andq    %rdx, %rax
        movhlps %xmm2, %xmm3
        movhlps %xmm1, %xmm4
        movq    %rax, %xmm0
        movq    %xmm4, %rdx
        movq    %xmm3, %rax
        andq    %rdx, %rax
        movq    %rax, %xmm5
        punpcklqdq      %xmm5, %xmm0
        ret

ior:	movdqa  %xmm0, %xmm2
        movq    %xmm1, %rdx
        movq    %xmm0, %rax
        orq     %rdx, %rax
        movhlps %xmm2, %xmm3
        movhlps %xmm1, %xmm4
        movq    %rax, %xmm0
        movq    %xmm4, %rdx
        movq    %xmm3, %rax
        orq     %rdx, %rax
        movq    %rax, %xmm5
        punpcklqdq      %xmm5, %xmm0
        ret

xor:	movdqa  %xmm0, %xmm2
        movq    %xmm1, %rdx
        movq    %xmm0, %rax
        xorq    %rdx, %rax
        movhlps %xmm2, %xmm3
        movhlps %xmm1, %xmm4
        movq    %rax, %xmm0
        movq    %xmm4, %rdx
        movq    %xmm3, %rax
        xorq    %rdx, %rax
        movq    %rax, %xmm5
        punpcklqdq      %xmm5, %xmm0
        ret

not:	movdqa  %xmm0, %xmm1
        movq    %xmm0, %rax
        notq    %rax
        movhlps %xmm1, %xmm2
        movq    %rax, %xmm0
        movq    %xmm2, %rax
        notq    %rax
        movq    %rax, %xmm3
        punpcklqdq      %xmm3, %xmm0
        ret

with this patch we now generate the much more efficient:

and:	pand    %xmm1, %xmm0
        ret

ior:	por     %xmm1, %xmm0
        ret

xor:	pxor    %xmm1, %xmm0
        ret

not:	pcmpeqd %xmm1, %xmm1
        pxor    %xmm1, %xmm0
        ret

For my first few attempts at this patch I tried adding V1TI to the
existing VI and VI12_AVX_512F mode iterators, but these then have
dependencies on other iterators (and attributes), and so on until
everything ties itself into a knot, as V1TI mode isn't really a
first-class vector mode on x86_64.  Hence I ultimately opted to use
simple stand-alone patterns (as used by the existing TF mode support).

2021-10-23  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	* config/i386/sse.md (<any_logic>v1ti3): New define_insn to
	implement V1TImode AND, IOR and XOR on TARGET_SSE2 (and above).
	(one_cmplv1ti2): New define expand.

gcc/testsuite/ChangeLog
	* gcc.target/i386/sse2-v1ti-logic.c: New test case.
	* gcc.target/i386/sse2-v1ti-logic-2.c: New test case.
2021-10-23 10:06:06 +01:00
Sandra Loosemore
693abdb66a Add testcase for PR fortran/95196
2021-10-22  José Rui Faustino de Sousa  <jrfsousa@gmail.com>
	    Sandra Loosemore  <sandra@codesourcery.com>

	gcc/testsuite/

	PR fortran/95196
	* gfortran.dg/PR95196.f90: New.
2021-10-22 17:25:08 -07:00
GCC Administrator
c2bd5d8a30 Daily bump. 2021-10-23 00:16:26 +00:00