aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2023-06-15ada: Revert latest change to Find_Hook_ContextEric Botcazou1-10/+0
The issue is that, if an aggregate is both below a conditional expression and above another conditional expression in the tree, we have currently no place to put the finalization actions generated by the innermost expression in the context of the aggregate before it is expanded, so they end up being placed after the outermost expression. But it is not clear whether that's really problematic because this does not seem to happen for array aggregates with multiple or others choices: in this case the aggregate is expanded first and the code path is not taken. gcc/ada/ * exp_util.adb (Find_Hook_Context): Revert latest change.
2023-06-15ada: Fix too small secondary stack allocation for returned aggregateEric Botcazou1-3/+14
This restores the specific treatment of aggregates that are returned through an extended return statement in a function returning a class-wide type, and which was incorrectly dropped in an earlier change. gcc/ada/ * exp_ch3.adb (Make_Allocator_For_Return): Deal again specifically with an aggregate returned through an object of a class-wide type.
2023-06-15ada: Remove dead code in Expand_Iterator_Loop_Over_ContainerEric Botcazou1-13/+4
The Condition_Actions field can only be populated for while loops. gcc/ada/ * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Do not insert an always empty list. Remove unused parameter Isc. (Expand_Iterator_Loop): Adjust call to above procedure.
2023-06-15ada: Add escape hatch to configurable run-timeRonan Desplanques2-0/+12
Before this patch, the fact that Restrictions pragmas had to fit on a single line in system.ads was difficult to reconcile with the 80-character line limit that is enforced in that file. The special rules for pragmas in system.ads made it impossible to us the Style_Checks pragma to allow long Restrictions pragmas. This patch relaxes those rules so the Style_Checks pragma can be used in system.ads. gcc/ada/ * targparm.adb: Allow pragma Style_Checks in some forms. * targparm.ads: Document new pragma permission.
2023-06-15ada: Fix missing finalization for aggregates nested in conditional expressionsEric Botcazou2-1/+23
The finalization actions for the components of the aggregates are blocked by Expand_Ctrl_Function_Call, which sets Is_Ignored_Transient on all the temporaries generated from within a conditional expression whatever the intermediate constructs. Now aggregates and their expansion in the form of block and loop statements are "impenetrable" as far as temporaries are concerned, i.e. the lifetime of temporaries generated within them does not extend beyond them, so their finalization must not be blocked there. gcc/ada/ * exp_util.ads (Within_Case_Or_If_Expression): Adjust description. * exp_util.adb (Find_Hook_Context): Stop the search for the topmost conditional expression, if within one, at contexts where temporaries may be contained. (Within_Case_Or_If_Expression): Return false upon first encoutering contexts where temporaries may be contained.
2023-06-15ada: Adjust QNX Ada priorities to match QNX system prioritiesJohannes Kliemann2-9/+7
The Ada priority range of the QNX runtime started from 0, differing from the QNX system priorities range starting from 1. As this may cause confusion, especially if used in a mixed language environment, the Ada priority range now starts at 1. The default priority of Ada tasks as mandated is the middle of the priority range. On QNX this means the default priority of Ada tasks is 30. This is much higher than the default QNX priority of 10 and may cause unexpected system interruptions when Ada tasks take a lot of CPU time. gcc/ada/ * libgnarl/s-osinte__qnx.adb: Adjust priority conversion function. * libgnat/system-qnx-arm.ads: Adjust priority range and default priority.
2023-06-15ada: Adjust comments in targparm.adsRonan Desplanques1-20/+5
This patch removes a few dangling references to the late front-end implementation of exceptions from the comments of targparm.ads, and also fixes a thinko there. gcc/ada/ * targparm.ads: Remove references to front-end-based exceptions. Fix thinko.
2023-06-15ada: Accept aspect Always_Terminates on packagesPiotr Trojanek2-2/+21
The recently added aspect Always_Terminates is now allowed on packages and generic packages, but only when it has no arguments. The intuitive meaning is that all subprograms declared in such a package are always terminating. gcc/ada/ * contracts.adb (Add_Contract_Item): Add pragma Always_Terminates to package contract. * sem_prag.adb (Analyze_Pragma): Accept pragma Always_Terminates on packages and generic packages, but only when it has no arguments.
2023-06-15ada: Accept aspect Always_Terminates on entriesPiotr Trojanek1-0/+5
The recently added aspect Always_Terminates is allowed on both procedures and entries. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Accept pragma Always_Terminates when it applies to an entry.
2023-06-15ada: Reject aspect Always_Terminates on functions and generic functionsPiotr Trojanek1-0/+13
The recently added aspect Always_Terminates is only allowed on procedures. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Reject pragma Always_Terminates when it applies to a function or generic function.
2023-06-15ada: Fix missing error on function call returning incomplete viewEric Botcazou1-0/+6
Testing for the presence of Non_Limited_View is not sufficient to detect whether the nonlimited view has been analyzed because Build_Limited_Views always sets the field on the limited view. Instead the discriminant is whether this nonlimited view is itself an incomplete type. gcc/ada/ * sem_ch4.adb (Analyze_Call): Adjust the test to detect the presence of an incomplete view of a type on a function call.
2023-06-15ada: Fix minor issues in commentsRonan Desplanques1-3/+2
The package Ttypef has been removed but a reference to it was left over in a comment. This patch removes that reference, and also fixes a typo. gcc/ada/ * ttypes.ads: Remove reference to Ttypef in comment. Fix typo in comment.
2023-06-15ada: Remove Ttypes.Max_Unaligned_FieldEric Botcazou6-28/+2
This constant has been unused for ages. The corresponding getter function is also removed from the Get_Targ package, but the corresponding constant declared in Set_Targ is preserved for the sake of backward compatibility of the target file format. gcc/ada/ * get_targ.ads (Get_Max_Unaligned_Field): Delete. * ada_get_targ.adb (Get_Max_Unaligned_Field): Likewise. * get_targ.adb (Get_Max_Unaligned_Field): Likewise. * set_targ.ads (Max_Unaligned_Field): Adjust comment. * set_targ.adb: Set Max_Unaligned_Field to 1 during elaboration. * ttypes.ads (Max_Unaligned_Field): Delete.
2023-06-15ada: Fix inverted implementation of RM 8.4(10) clause for operatorsEric Botcazou1-1/+1
The comment is correct but the code implements the opposite outcome. gcc/ada/ * sem_type.adb (Disambiguate): Fix pasto in the implementation of the RM 8.4(10) clause for operators.
2023-06-15ada: Accept aspect Always_Terminates without expressionPiotr Trojanek3-51/+53
The recently added aspect Always_Terminates is now accepted without explicit boolean expression, where a missing expression implicitly means True, similar to aspects Async_Readers, Async_Writers, etc. gcc/ada/ * aspects.adb (Base_Aspect): Fix layout. * aspects.ads (Aspect_Argument): Expression for Always_Terminates is optional. * sem_prag.adb (Analyze_Always_Terminates_In_Decl_Part): Only analyze expression when pragma argument is present. (Analyze_Pragma): Argument for Always_Terminates is optional; fix whitespace for Async_Readers.
2023-06-15ada: Crash on C++ constructor of private typeJavier Miranda1-2/+18
The compiler crashes compiling a function that has pragma CPP_constructor when its return type is a private type. gcc/ada/ * sem_util.adb (Is_CPP_Constructor_Call): Add missing support for calls to functions returning a private type.
2023-06-15ada: Remove obsolete references for Build_Transient_Object_StatementsEric Botcazou1-3/+3
gcc/ada/ * exp_util.ads (Build_Transient_Object_Statements): Remove obsolete references to array and record aggregates in documentation.
2023-06-15ada: Fix aspect Linker_Section ignored on subprogram bodyEric Botcazou1-12/+22
The compiler is waiting for the freeze node of the body, but it is never generated since the freezing of the body is not delayed. The change also removes an obsolete piece of code. gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Specifications): Add missing items in the list of aspects handled by means of Insert_Pragma. <Aspect_Linker_Section>: Remove obsolete code. Do not delay the processing of the aspect if the entity is already frozen.
2023-06-15ada: Cleanup analysis of iterated component associationPiotr Trojanek1-7/+5
Cleanups related to analysis of iterated component association for GNATprove. gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Simplify comment. (Resolve_Iterated_Component_Association): Tune comment; change variable to constant.
2023-06-15LoongArch: Set default alignment for functions and labels with -mtuneXi Ruoyao4-0/+27
The LA464 micro-architecture is sensitive to alignment of code. The Loongson team has benchmarked various combinations of function, the results [1] show that 16-byte label alignment together with 32-byte function alignment gives best results in terms of SPEC score. Add a mtune-based table-driven mechanism to set the default of -falign-{functions,labels}. As LA464 is the first (and the only for now) uarch supported by GCC, the same setting is also used for the "generic" -mtune=loongarch64. In the future we may set different settings for LA{2,3,6}64 once we add the support for them. Bootstrapped and regtested on loongarch64-linux-gnu. Ok for trunk? gcc/ChangeLog: * config/loongarch/loongarch-tune.h (loongarch_align): New struct. * config/loongarch/loongarch-def.h (loongarch_cpu_align): New array. * config/loongarch/loongarch-def.c (loongarch_cpu_align): Define the array. * config/loongarch/loongarch.cc (loongarch_option_override_internal): Set the value of -falign-functions= if -falign-functions is enabled but no value is given. Likewise for -falign-labels=.
2023-06-15Fix 'dg-warning' in 'c-c++-common/Wfree-nonheap-object-3.c' for C++Thomas Schwinge1-1/+1
[...]/c-c++-common/Wfree-nonheap-object-3.c:57:24: warning: 'malloc (dealloc_float)' attribute ignored with deallocation functions declared 'inline' [-Wattributes] [...]/c-c++-common/Wfree-nonheap-object-3.c:51:1: note: deallocation function declared here [...]/c-c++-common/Wfree-nonheap-object-3.c: In function 'void test_nowarn_int(int)': [...]/c-c++-common/Wfree-nonheap-object-3.c:25:20: warning: 'void __builtin_free(void*)' called on pointer 'p' with nonzero offset 4 [-Wfree-nonheap-object] [...]/c-c++-common/Wfree-nonheap-object-3.c:24:24: note: returned from 'int* alloc_int(int)' [...]/c-c++-common/Wfree-nonheap-object-3.c: In function 'void test_nowarn_long(int)': [...]/c-c++-common/Wfree-nonheap-object-3.c:45:18: warning: 'void dealloc_long(long int*)' called on pointer '<unknown>' with nonzero offset 8 [-Wfree-nonheap-object] [...]/c-c++-common/Wfree-nonheap-object-3.c:44:26: note: returned from 'long int* alloc_long(int)' In function 'void dealloc_float(float*)', inlined from 'void test_nowarn_float(int)' at [...]/c-c++-common/Wfree-nonheap-object-3.c:68:19: [...]/c-c++-common/Wfree-nonheap-object-3.c:53:18: warning: 'void __builtin_free(void*)' called on pointer '<unknown>' with nonzero offset 8 [-Wfree-nonheap-object] [...]/c-c++-common/Wfree-nonheap-object-3.c: In function 'void test_nowarn_float(int)': [...]/c-c++-common/Wfree-nonheap-object-3.c:67:28: note: returned from 'float* alloc_float(int)' PASS: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 25) FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 45) PASS: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 51) PASS: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 53) PASS: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for warnings, line 57) FAIL: c-c++-common/Wfree-nonheap-object-3.c -std=gnu++98 (test for excess errors) Excess errors: [...]/c-c++-common/Wfree-nonheap-object-3.c:45:18: warning: 'void dealloc_long(long int*)' called on pointer '<unknown>' with nonzero offset 8 [-Wfree-nonheap-object] ..., that is: decorated 'void dealloc_long(long int*)' instead of plain 'dealloc_long' -- similar to how all the other 'dg-warning's allow for the decorated function signature in addition to the plain one. This issue was latent since the test case was added in commit fe7f75cf16783589eedbab597e6d0b8d35d7e470 "Correct/improve maybe_emit_free_warning (PR middle-end/98166, PR c++/57111, PR middle-end/98160)", and was finally exposed by my recent commit 9c03391ba447ff86038d6a34c90ae737c3915b5f "Tighten 'dg-warning' alternatives in 'c-c++-common/Wfree-nonheap-object{,-2,-3}.c'". gcc/testsuite/ * c-c++-common/Wfree-nonheap-object-3.c: Fix 'dg-warning' for C++.
2023-06-15middle-end, i386: Pattern recognize add/subtract with carry [PR79173]Jakub Jelinek20-6/+1118
The following patch introduces {add,sub}c5_optab and pattern recognizes various forms of add with carry and subtract with carry/borrow, see pr79173-{1,2,3,4,5,6}.c tests on what is matched. Primarily forms with 2 __builtin_add_overflow or __builtin_sub_overflow calls per limb (with just one for the least significant one), for add with carry even when it is hand written in C (for subtraction reassoc seems to change it too much so that the pattern recognition doesn't work). __builtin_{add,sub}_overflow are standardized in C23 under ckd_{add,sub} names, so it isn't any longer a GNU only extension. Note, clang has for these (IMHO badly designed) __builtin_{add,sub}c{b,s,,l,ll} builtins which don't add/subtract just a single bit of carry, but basically add 3 unsigned values or subtract 2 unsigned values from one, and result in carry out of 0, 1, or 2 because of that. If we wanted to introduce those for clang compatibility, we could and lower them early to just two __builtin_{add,sub}_overflow calls and let the pattern matching in this patch recognize it later. I've added expanders for this on ix86 and in addition to that added various peephole2s (in preparation patches for this patch) to make sure we get nice (and small) code for the common cases. I think there are other PRs which request that e.g. for the _{addcarry,subborrow}_u{32,64} intrinsics, which the patch also improves. Would be nice if support for these optabs was added to many other targets, arm/aarch64 and powerpc* certainly have such instructions, I'd expect in fact that most targets do. The _BitInt support I'm working on will also need this to emit reasonable code. 2023-06-15 Jakub Jelinek <jakub@redhat.com> PR middle-end/79173 * internal-fn.def (UADDC, USUBC): New internal functions. * internal-fn.cc (expand_UADDC, expand_USUBC): New functions. (commutative_ternary_fn_p): Return true also for IFN_UADDC. * optabs.def (uaddc5_optab, usubc5_optab): New optabs. * tree-ssa-math-opts.cc (uaddc_cast, uaddc_ne0, uaddc_is_cplxpart, match_uaddc_usubc): New functions. (math_opts_dom_walker::after_dom_children): Call match_uaddc_usubc for PLUS_EXPR, MINUS_EXPR, BIT_IOR_EXPR and BIT_XOR_EXPR unless other optimizations have been successful for those. * gimple-fold.cc (gimple_fold_call): Handle IFN_UADDC and IFN_USUBC. * fold-const-call.cc (fold_const_call): Likewise. * gimple-range-fold.cc (adjust_imagpart_expr): Likewise. * tree-ssa-dce.cc (eliminate_unnecessary_stmts): Likewise. * doc/md.texi (uaddc<mode>5, usubc<mode>5): Document new named patterns. * config/i386/i386.md (uaddc<mode>5, usubc<mode>5): New define_expand patterns. (*setcc_qi_addqi3_cconly_overflow_1_<mode>, *setccc): Split into NOTE_INSN_DELETED note rather than nop instruction. (*setcc_qi_negqi_ccc_1_<mode>, *setcc_qi_negqi_ccc_2_<mode>): Likewise. * gcc.target/i386/pr79173-1.c: New test. * gcc.target/i386/pr79173-2.c: New test. * gcc.target/i386/pr79173-3.c: New test. * gcc.target/i386/pr79173-4.c: New test. * gcc.target/i386/pr79173-5.c: New test. * gcc.target/i386/pr79173-6.c: New test. * gcc.target/i386/pr79173-7.c: New test. * gcc.target/i386/pr79173-8.c: New test. * gcc.target/i386/pr79173-9.c: New test. * gcc.target/i386/pr79173-10.c: New test.
2023-06-15i386: Add peephole2 patterns to improve subtract with borrow with memory ↵Jakub Jelinek1-3/+151
destination [PR79173] This patch adds subborrow<mode> alternative so that it can have memory destination and adds various peephole2s which help to match it. 2023-06-15 Jakub Jelinek <jakub@redhat.com> PR middle-end/79173 * config/i386/i386.md (subborrow<mode>): Add alternative with memory destination and add for it define_peephole2 TARGET_READ_MODIFY_WRITE/-Os patterns to prefer using memory destination in these patterns.
2023-06-15i386: Add peephole2 patterns to improve add with carry or subtract with ↵Jakub Jelinek1-0/+289
borrow with memory destination [PR79173] This patch adds various peephole2s which help to recognize add with carry or subtract with borrow with memory destination. 2023-06-14 Jakub Jelinek <jakub@redhat.com> PR middle-end/79173 * config/i386/i386.md (*sub<mode>_3, @add<mode>3_carry, addcarry<mode>, @sub<mode>3_carry, *add<mode>3_cc_overflow_1): Add define_peephole2 TARGET_READ_MODIFY_WRITE/-Os patterns to prefer using memory destination in these patterns.
2023-06-15middle-end: Move constant args folding of .UBSAN_CHECK_* and .*_OVERFLOW ↵Jakub Jelinek2-16/+41
into fold-const-call.cc Here is an incremental patch to handle constant folding of these in fold-const-call.cc rather than gimple-fold.cc. Not really sure if that is the way to go because it is replacing 28 lines of former code with 65 of new code, for the overall benefit that say int foo (long long *p) { int one = 1; long long max = __LONG_LONG_MAX__; return __builtin_add_overflow (one, max, p); } can be now fully folded already in ccp1 pass while before it was only cleaned up in forwprop1 pass right after it. On Wed, Jun 14, 2023 at 12:25:46PM +0000, Richard Biener wrote: > I think that's still very much desirable so this followup looks OK. > Maybe you can re-base it as prerequesite though? Rebased then (of course with the UADDC/USUBC handling removed from this first patch, will be added in the second one). 2023-06-15 Jakub Jelinek <jakub@redhat.com> * gimple-fold.cc (gimple_fold_call): Move handling of arg0 as well as arg1 INTEGER_CSTs for .UBSAN_CHECK_{ADD,SUB,MUL} and .{ADD,SUB,MUL}_OVERFLOW calls from here... * fold-const-call.cc (fold_const_call): ... here.
2023-06-15AArch64: New RTL for ABDOluwatamilore Adebayo14-2/+424
This patch adds new RTL and tests for sabd and uabd PR tree-optimization/109156 gcc/ChangeLog: * config/aarch64/aarch64-simd.md (aarch64_<su>abd<mode>): Rename to <su>abd<mode>3. * config/aarch64/aarch64-sve.md (<su>abd<mode>_3): Rename to <su>abd<mode>3. gcc/testsuite/ChangeLog: * gcc.target/aarch64/abd.h: New file. * gcc.target/aarch64/abd_2.c: New test. * gcc.target/aarch64/abd_3.c: New test. * gcc.target/aarch64/abd_4.c: New test. * gcc.target/aarch64/abd_none_2.c: New test. * gcc.target/aarch64/abd_none_3.c: New test. * gcc.target/aarch64/abd_none_4.c: New test. * gcc.target/aarch64/abd_run_1.c: New test. * gcc.target/aarch64/sve/abd_1.c: New test. * gcc.target/aarch64/sve/abd_none_1.c: New test. * gcc.target/aarch64/sve/abd_2.c: New test. * gcc.target/aarch64/sve/abd_none_2.c: New test.
2023-06-15Missed opportunity to use [SU]ABDOluwatamilore Adebayo4-31/+217
This adds a recognition pattern for the non-widening absolute difference (ABD). gcc/ChangeLog: * doc/md.texi (sabd, uabd): Document them. * internal-fn.def (ABD): Use new optab. * optabs.def (sabd_optab, uabd_optab): New optabs, * tree-vect-patterns.cc (vect_recog_absolute_difference): Recognize the following idiom abs (a - b). (vect_recog_sad_pattern): Refactor to use vect_recog_absolute_difference. (vect_recog_abd_pattern): Use patterns found by vect_recog_absolute_difference to build a new ABD internal call.
2023-06-15LoongArch: Change the default value of LARCH_CALL_RATIO to 6.chenxiaolong1-1/+1
During the regression testing of the LoongArch architecture GCC, it was found that the tests in the pr90883.C file failed. The problem was modulated and found that the error was caused by setting the macro LARCH_CALL_RATIO to a too large value. Combined with the actual LoongArch architecture, the different thresholds for meeting the test conditions were tested using the engineering method (SPEC CPU 2006), and the results showed that its optimal threshold should be set to 6. gcc/ChangeLog: * config/loongarch/loongarch.h (LARCH_CALL_RATIO): Modify the value of macro LARCH_CALL_RATIO on LoongArch to make it perform optimally.
2023-06-15RISC-V: Use merge approach to optimize vector permutationJuzhe-Zhong15-0/+1417
This patch is to optimize the permuation case that is suiteable use merge approach. Consider this following case: typedef int8_t vnx16qi __attribute__((vector_size (16))); void __attribute__ ((noipa)) merge0 (vnx16qi x, vnx16qi y, vnx16qi *out) { vnx16qi v = __builtin_shufflevector ((vnx16qi) x, (vnx16qi) y, MASK_16); *(vnx16qi*)out = v; } The gimple IR: v_3 = VEC_PERM_EXPR <x_1(D), y_2(D), { 0, 17, 2, 19, 4, 21, 6, 23, 8, 9, 10, 27, 12, 29, 14, 31 }>; Selector = { 0, 17, 2, 19, 4, 21, 6, 23, 8, 9, 10, 27, 12, 29, 14, 31 }, the common expression: { 0, nunits + 1, 2, nunits + 3, 4, nunits + 5, ... } For this selector, we can use vmsltu + vmerge to optimize the codegen. Before this patch: merge0: addi a5,sp,16 vl1re8.v v3,0(a5) li a5,31 vsetivli zero,16,e8,m1,ta,mu vmv.v.x v2,a5 lui a5,%hi(.LANCHOR0) addi a5,a5,%lo(.LANCHOR0) vl1re8.v v1,0(a5) vl1re8.v v4,0(sp) vand.vv v1,v1,v2 vmsgeu.vi v0,v1,16 vrgather.vv v2,v4,v1 vadd.vi v1,v1,-16 vrgather.vv v2,v3,v1,v0.t vs1r.v v2,0(a0) ret After this patch: merge0: addi a5,sp,16 vl1re8.v v1,0(a5) lui a5,%hi(.LANCHOR0) addi a5,a5,%lo(.LANCHOR0) vsetivli zero,16,e8,m1,ta,ma vl1re8.v v0,0(a5) vl1re8.v v2,0(sp) vmsltu.vi v0,v0,16 vmerge.vvm v1,v1,v2,v0 vs1r.v v1,0(a0) ret The key of this optimization is that: 1. mask = vmsltu (selector, nunits) 2. result = vmerge (op0, op1, mask) gcc/ChangeLog: * config/riscv/riscv-v.cc (shuffle_merge_patterns): New pattern. (expand_vec_perm_const_1): Add merge optmization. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-1.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-2.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-3.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-4.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-5.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-6.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-7.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-1.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-2.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-3.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-4.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-5.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-6.c: New test. * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-7.c: New test.
2023-06-15RISC-V: Ensure vector args and return use function stack to pass [PR110119]Lehua Ding3-5/+64
The V2 patch address comments from Juzhe, thanks. Hi, The reason for this bug is that in the case where the vector register is set to a fixed length (with `--param=riscv-autovec-preference=fixed-vlmax` option), TARGET_PASS_BY_REFERENCE thinks that variables of type vint32m1 can be passed through two scalar registers, but when GCC calls FUNCTION_VALUE (call function riscv_get_arg_info inside) it returns NULL_RTX. These two functions are not unified. The current treatment is to pass all vector arguments and returns through the function stack, and a new calling convention for vector registers will be added in the future. https://github.com/riscv-non-isa/riscv-elf-psabi-doc/ https://github.com/palmer-dabbelt/riscv-elf-psabi-doc/commit/126fa719972ff998a8a239c47d506c7809aea363 Best, Lehua gcc/ChangeLog: PR target/110119 * config/riscv/riscv.cc (riscv_get_arg_info): Return NULL_RTX for vector mode (riscv_pass_by_reference): Return true for vector mode gcc/testsuite/ChangeLog: PR target/110119 * gcc.target/riscv/rvv/base/pr110119-1.c: New test. * gcc.target/riscv/rvv/base/pr110119-2.c: New test.
2023-06-15RISC-V: Align the predictor style for define_insn_and_splitPan Li2-22/+22
This patch is considered as the follow up of the below PATCH. https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621347.html We aligned the predictor style for the define_insn_and_split suggested by Kito. To avoid potential issues before we hit. Signed-off-by: Pan Li <pan2.li@intel.com> gcc/ChangeLog: * config/riscv/autovec-opt.md: Align the predictor sytle. * config/riscv/autovec.md: Ditto.
2023-06-15RISC-V: Bugfix for vec_init repeating auto vectorization in RV32Pan Li1-4/+12
When constructing a vector mask from individual elements we wrongly assumed that we can broadcast BITS_PER_WORD (i.e. XLEN). The maximum is actually the vector element length (i.e. ELEN). This patch fixes this. After this patch, below failures on RV32 will be fixed. FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c execution test FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c execution test FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c execution test FAIL: gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c execution test FAIL: gcc.target/riscv/rvv/autovec/vls-vlmax/repeat_run-3.c -std=c99 -O3 -ftree-vectorize --param riscv-autovec-preference=fixed-vlmax execution test Signed-off-by: Pan Li <pan2.li@intel.com> gcc/ChangeLog: * config/riscv/riscv-v.cc (rvv_builder::get_merge_scalar_mask): Take elen instead of scalar BITS_PER_WORD. (expand_vector_init_merge_repeating_sequence): Use inner_bits_size instead of scaler BITS_PER_WORD.
2023-06-15Daily bump.GCC Administrator4-1/+59
2023-06-14Remove MFWRAP_SPEC remnantJivan Hakobyan1-8/+0
This patch removes a remnant of mudflap. gcc/ChangeLog: * config/moxie/uclinux.h (MFWRAP_SPEC): Remove
2023-06-14aarch64: Fix -Werror=sign-compare bootstrap failureKyrylo Tkachov1-3/+3
Pushing to fix bootstrap. gcc/ChangeLog: * config/aarch64/aarch64-sve-builtins-base.cc (svlast_impl::fold): Fix signed comparison warning in loop from npats to enelts.
2023-06-14c++: tweak c++17 ctor/conversion tiebreaker [DR2327]Jason Merrill3-36/+39
In discussion of this issue CWG decided that the change of behavior on well-formed code like overload-conv-4.C is undesirable. In further discussion of possible resolutions, we discovered that we can avoid that change while still getting the desired behavior on overload-conv-3.C by making this a tiebreaker after comparing conversions, rather than before. This also simplifies the implementation. The issue resolution has not yet been finalized, but this seems like a clear improvement. DR 2327 PR c++/86521 gcc/cp/ChangeLog: * call.cc (joust_maybe_elide_copy): Don't change cand. (joust): Move the elided tiebreaker later. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/overload-conv-4.C: Remove warnings. * g++.dg/cpp1z/elide7.C: New test.
2023-06-14driver: Forward '-lgfortran', '-lm' to offloading compilationThomas Schwinge4-3/+82
..., so that users don't manually need to specify '-foffload-options=-lgfortran', '-foffload-options=-lm' in addition to '-lgfortran', '-lm' (specified manually, or implicitly by the driver). gcc/ * gcc.cc (driver_handle_option): Forward host '-lgfortran', '-lm' to offloading compilation. * config/gcn/mkoffload.cc (main): Adjust. * config/nvptx/mkoffload.cc (main): Likewise. * doc/invoke.texi (foffload-options): Update example. libgomp/ * testsuite/libgomp.fortran/fortran.exp (lang_link_flags): Don't set. * testsuite/libgomp.oacc-fortran/fortran.exp (lang_link_flags): Likewise. * testsuite/libgomp.c/simd-math-1.c: Remove '-foffload-options=-lm'. * testsuite/libgomp.fortran/fortran-torture_execute_math.f90: Likewise. * testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90: Likewise.
2023-06-14Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'Thomas Schwinge1-2/+22
..., via 'include'ing the existing 'gfortran.fortran-torture/execute/math.f90', which therefore is enhanced for optional OpenACC 'serial', OpenMP 'target' usage. gcc/testsuite/ * gfortran.fortran-torture/execute/math.f90: Enhance for optional OpenACC 'serial', OpenMP 'target' usage. libgomp/ * testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New. * testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90: Likewise.
2023-06-14Tighten 'dg-warning' alternatives in ↵Thomas Schwinge3-8/+8
'c-c++-common/Wfree-nonheap-object{,-2,-3}.c' ..., added in commit fe7f75cf16783589eedbab597e6d0b8d35d7e470 "Correct/improve maybe_emit_free_warning (PR middle-end/98166, PR c++/57111, PR middle-end/98160)". These use alternatives like, for example, "AB|CDE|FG", but what really must've been meant is "A(B|C)D(E|F)G". The former variant also does "work": it matches any of "AB", or "CDE", or "FG", which are components of the latter variant. (That means, the former variant matches too loosely.) gcc/testsuite/ * c-c++-common/Wfree-nonheap-object-2.c: Tighten 'dg-warning' alternatives. * c-c++-common/Wfree-nonheap-object-3.c: Likewise. * c-c++-common/Wfree-nonheap-object.c: Likewise.
2023-06-14Remove 'gcc/testsuite/g++.dg/warn/Wfree-nonheap-object.s'Thomas Schwinge1-0/+0
..., which, presumably, was added by mistake in commit dce6c58db87ebf7f4477bd3126228e73e4eeee97 "Add support for detecting mismatched allocation/deallocation calls". gcc/testsuite/ * g++.dg/warn/Wfree-nonheap-object.s: Remove.
2023-06-14Use x instead of v for alternative 2 (v, BH) in mov<mode>_internal.liuhongt2-1/+12
Since there's no evex version for vpcmpeq ymm, ymm, ymm. gcc/ChangeLog: PR target/110227 * config/i386/sse.md (mov<mode>_internal>): Use x instead of v for alternative 2 since there's no evex version for vpcmpeqd ymm, ymm, ymm. gcc/testsuite/ChangeLog: * gcc.target/i386/pr110227.c: New test.
2023-06-14Daily bump.GCC Administrator8-1/+638
2023-06-13modula2 Fixes to the error format specificationsGaius Mulley4-30/+164
This patch contains a python3 script to check the meta format error specifications. It also includes about 20 fixes to M2Quads.mod format specifications. gcc/m2/ChangeLog: * Make-lang.in (check-format-error): New rule. * gm2-compiler/M2MetaError.mod (op): Add calls InternalError if digits are detected. * gm2-compiler/M2Quads.mod (BuildForToByDo): Bugfix to format specifier. (BuildLengthFunction): Bugfix to format specifiers. (BuildOddFunction): Bugfix to format specifiers. (BuildAbsFunction): Bugfix to format specifiers. (BuildCapFunction): Bugfix to format specifiers. (BuildChrFunction): Bugfix to format specifiers. (BuildOrdFunction): Bugfix to format specifiers. (BuildMakeAdrFunction): Bugfix to format specifiers. (BuildSizeFunction): Bugfix to format specifiers. (BuildBitSizeFunction): Bugfix to format specifiers. * tools-src/checkmeta.py: New file. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-06-13c/c++: use positive tone in missing header notes [PR84890]David Malcolm14-145/+145
Quoting "How a computer should talk to people" (as quoted in "Concepts Error Messages for Humans"): "Various negative tones or actions are unfriendly: being manipulative, not giving a second chance, talking down, using fashionable slang, blaming. We must not seem to blame the person. We should avoid suggesting that the person is inadequate. Phrases like "you forgot" may seem harmless, but what if a computer said this to you four or five times in two minutes? Anyway, the person may disagree, so why risk offense?" gcc/c-family/ChangeLog: PR c/84890 * known-headers.cc (suggest_missing_header::~suggest_missing_header): Reword note to avoid negative tone of "forgetting". gcc/cp/ChangeLog: PR c/84890 * name-lookup.cc (missing_std_header::~missing_std_header): Reword note to avoid negative tone of "forgetting". gcc/testsuite/ChangeLog: PR c/84890 * g++.dg/cpp2a/srcloc3.C: Update expected message. * g++.dg/lookup/missing-std-include-2.C: Likewise. * g++.dg/lookup/missing-std-include-3.C: Likewise. * g++.dg/lookup/missing-std-include-6.C: Likewise. * g++.dg/lookup/missing-std-include.C: Likewise. * g++.dg/spellcheck-inttypes.C: Likewise. * g++.dg/spellcheck-stdint.C: Likewise. * g++.dg/spellcheck-stdlib.C: Likewise. * gcc.dg/spellcheck-inttypes.c: Likewise. * gcc.dg/spellcheck-stdbool.c: Likewise. * gcc.dg/spellcheck-stdint.c: Likewise. * gcc.dg/spellcheck-stdlib.c: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2023-06-13Fortran: add DATA statement testcaseFrancois-Xavier Coudert1-0/+26
gcc/testsuite/ * gfortran.dg/data_array_7.f90: New test.
2023-06-13Fortran: fix passing of zero-sized array arguments to procedures [PR86277]Harald Anlauf3-1/+296
gcc/fortran/ChangeLog: PR fortran/86277 * trans-array.cc (gfc_trans_allocate_array_storage): When passing a zero-sized array with fixed (= non-dynamic) size, allocate temporary by the caller, not by the callee. gcc/testsuite/ChangeLog: PR fortran/86277 * gfortran.dg/zero_sized_14.f90: New test. * gfortran.dg/zero_sized_15.f90: New test. Co-authored-by: Mikael Morin <mikael@gcc.gnu.org>
2023-06-13Remove a couple mudflap remnantsJeff Law1-2/+2
I happened to be digging into the specs to understand a build failure and spotted mflib and mfwrap. Those were used by the mudflap system which we ripped out years ago and we just missed these. I verified x86 still bootstraps after removing these bits. Pushed to the trunk as obvious, gcc/ * gcc.cc (LINK_COMMAND_SPEC): Remove mudflap spec handling.
2023-06-13Remove sh5media divtab codeJeff Law1-203/+0
Spurred by Akari Takahashi's patch to config/sh/divtab.cc, this removes divtab.cc completely. divtab.cc was used to calculate a division table for the sh5 media processor. GCC dropped support for that (unmanufactured) chip back in 2016 and this file simply got missed AFAICT. gcc/ * config/sh/divtab.cc: Remove.
2023-06-13i386: Fix up whitespace in assemblyJakub Jelinek1-3/+3
I've noticed that standard_sse_constant_opcode emits some spurious whitespace around tab, that isn't something which is done for any other instruction and looks wrong. 2023-06-13 Jakub Jelinek <jakub@redhat.com> * config/i386/i386.cc (standard_sse_constant_opcode): Remove superfluous spaces around \t for vpcmpeqd.
2023-06-13Avoid duplicate vector initializations during RTL expansion.Roger Sayle1-2/+5
This middle-end patch avoids some redundant RTL for vector initialization during RTL expansion. For the simple test case: typedef __int128 v1ti __attribute__ ((__vector_size__ (16))); __int128 key; v1ti foo() { return (v1ti){key}; } the middle-end currently expands: (set (reg:V1TI 85) (const_vector:V1TI [ (const_int 0) ])) (set (reg:V1TI 85) (mem/c:V1TI (symbol_ref:DI ("key")))) where we create a dead instruction that initializes the vector to zero, immediately followed by a set of the entire vector. This patch skips this zeroing instruction when the vector has only a single element. It also updates the code to indicate when we've cleared the vector, so that we don't need to initialize zero elements. 2023-06-13 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * expr.cc (store_constructor) <case VECTOR_TYPE>: Don't bother clearing vectors with only a single element. Set CLEARED if the vector was initialized to zero.