Re: [PATCH] vax: resolve long-standing documentation bugs re floating-point codegen [PR79646]

2024-05-26 Thread Maciej W. Rozycki
Hi Abe, > After many years away from contributing to GCC, I am rejoining as a > "gardener": my intent/plan is to clean up the bug backlog, weeding out > old bugs that are relatively-easy to fix yet have languished for a long > time.  First for today`s gardening: a documentation-only bug or two

[committed v2 2/2] VAX/doc: Fix issues with FP format option documentation

2024-05-26 Thread Maciej W. Rozycki
Use the correct names of the D_floating and G_floating data formats as per the VAX ISA nomenclature[1]. Document the `-md', `-md-float', and `-mg-float' options. References: [1] DEC STD 032-0 "VAX Architecture Standard", Digital Equipment Corporation, A-DS-EL-00032-00-0 Rev J, December

[committed v2 1/2] vax: Fix descriptions of the FP format options [PR79646]

2024-05-26 Thread Maciej W. Rozycki
From: Abe Skolnik Replace "Target" with "Generate" consistently and place a hyphen in "double-precision" as this is used as an adjective here. gcc/ChangeLog: PR target/79646 * config/vax/vax.opt (md, md-float, mg, mg-float): Correct descriptions. --- Changes from v1:

[committed v2 0/2] VAX: Fix issues with FP format option documentation

2024-05-26 Thread Maciej W. Rozycki
Hi, As reported in PR target/79646 and fixed by a change proposed by Abe we have a couple of issues with the descriptions of the VAX floating-point format options in the option definition file. Additionally most of these options are not documented in the manual. This mini patch series

[gcc r15-844] VAX/doc: Fix issues with FP format option documentation

2024-05-26 Thread Maciej W. Rozycki via Gcc-cvs
https://gcc.gnu.org/g:314448fc65f40c98ee8bc02dfb54ea49d2f2c60d commit r15-844-g314448fc65f40c98ee8bc02dfb54ea49d2f2c60d Author: Maciej W. Rozycki Date: Mon May 27 05:07:32 2024 +0100 VAX/doc: Fix issues with FP format option documentation Use the correct names of the D_floating

[gcc r15-843] vax: Fix descriptions of the FP format options [PR79646]

2024-05-26 Thread Maciej W. Rozycki via Gcc-cvs
https://gcc.gnu.org/g:a7f6543f21303583356fd2d2d1805bffbecc1bc5 commit r15-843-ga7f6543f21303583356fd2d2d1805bffbecc1bc5 Author: Abe Skolnik Date: Mon May 27 05:07:32 2024 +0100 vax: Fix descriptions of the FP format options [PR79646] Replace "Target" with "Generate" consistently

Re: [committed] Fix MIPS bootstrap

2024-05-09 Thread Maciej W. Rozycki
On Sun, 14 Jan 2024, Jeff Law wrote: > The condition for the pattern looks like this: > > "ISA_HAS_MIPS16E2" > > And if you dig into ISA_HAS_MIPS16E2: > > /* The MIPS16e V2 instructions are available. */ > #define ISA_HAS_MIPS16E2 (TARGET_MIPS16 && TARGET_MIPS16E2 \ >

Re: [PATCH] Turn on LRA on all targets

2024-02-16 Thread Maciej W. Rozycki
On Fri, 16 Feb 2024, Maciej W. Rozycki wrote: > On Fri, 16 Feb 2024, Jakub Jelinek wrote: > > > > There is no function prologue to optimise in the VAX case, because all > > > the frame setup has already been made by the CALLS instruction itself in > > &g

Re: [PATCH] Turn on LRA on all targets

2024-02-16 Thread Maciej W. Rozycki
On Fri, 16 Feb 2024, Jakub Jelinek wrote: > > There is no function prologue to optimise in the VAX case, because all > > the frame setup has already been made by the CALLS instruction itself in > > the caller. The first machine instruction of the callee is technically > > already past the

Re: [PATCH] Turn on LRA on all targets

2024-02-16 Thread Maciej W. Rozycki
On Fri, 16 Feb 2024, Segher Boessenkool wrote: > > Conversely no heuristics is required to unwind VAX frames, because they > > are fixed in layout by hardware, fully self-described, and with the > > hardware frame pointer always available. > > The downside of the VAX situation of course is

Re: [PATCH] Turn on LRA on all targets

2024-02-16 Thread Maciej W. Rozycki
On Thu, 15 Feb 2024, Paul Koning wrote: > > On May 15, 2023, at 5:09 PM, Maciej W. Rozycki wrote: > > > > ... > > > > I may choose to implement a non-DWARF unwinder instead, as the VAX stack > > frame is always fully described by the hardware and there

[committed] MAINTAINERS: Update my e-mail address

2024-02-03 Thread Maciej W. Rozycki
sparc port Eric Botcazou v850 port Nick Clifton vax port Matt Thomas -vax port Maciej W. Rozycki +vax port Maciej W. Rozycki visium portEric Botcazou x86

Re: Odd Python errors in the G++ testsuite

2024-02-02 Thread Maciej W. Rozycki
Hi Ben, This has fallen between the cracks. On Mon, 9 Oct 2023, Ben Boeckel wrote: > On Mon, Oct 09, 2023 at 20:12:01 +0100, Maciej W. Rozycki wrote: > > I'm seeing these tracebacks for several cases across the G++ testsuite: > > > > Executing on host: python3 -

Re: [PATCH DejaGNU/GCC 0/1] Support per-test execution timeout factor

2024-02-01 Thread Maciej W. Rozycki
On Wed, 3 Jan 2024, Hans-Peter Nilsson wrote: > > > Hmm. I think it would be more correct to emphasize that the > > > existing dg-timeout-factor affects both the tool execution *and* > > > the test execution, whereas your new dg-test-timeout-factor only > > > affects the test execution. (And

Re: [PATCH 2/2] RISC-V/testsuite: Also verify if-conversion runs for pr105314.c

2024-01-26 Thread Maciej W. Rozycki
On Wed, 24 Jan 2024, Jeff Law wrote: > > Do we have consensus now to move forward with this change as posted? I'd > > like to get these patches ticked off ASAP. > I think it should move forward. I think having the RTL tests deals with > Andrew's concern and the testcase adjustment has value

Re: [PATCH 2/2] RISC-V/testsuite: Also verify if-conversion runs for pr105314.c

2024-01-24 Thread Maciej W. Rozycki
On Tue, 16 Jan 2024, Maciej W. Rozycki wrote: > > I don't have a strong opinion on this. I certainly see Andrew's point, but > > it's also the case that if some work earlier in the RTL or gimple pipeline > > comes along and compromises the test, then we'd see th

[PATCH 2/2] RISC-V/testsuite: Add RTL cset-sext.c testcase variants

2024-01-24 Thread Maciej W. Rozycki
Add RTL tests, for RV64 and RV32 where appropriate, corresponding to the existing cset-sext.c tests. They have been produced from RTL code as at the entry of the "ce1" pass for the respective cset-sext.c tests built at -O3. gcc/testsuite/ * gcc.target/riscv/cset-sext-rtl.c:

[PATCH 1/2] RISC-V/testsuite: Add RTL pr105314.c testcase variants

2024-01-24 Thread Maciej W. Rozycki
Add a pair of RTL tests, for RV64 and RV32 respectively, corresponding to the existing pr105314.c test. They have been produced from RTL code as at the entry of the "ce1" pass for pr105314.c compiled at -O3. gcc/testsuite/ * gcc.target/riscv/pr105314-rtl.c: New file. *

[PATCH 0/2] RISC-V/testsuite: Add RTL if-conversion testcases

2024-01-24 Thread Maciej W. Rozycki
Hi, As discussed previously here are a bunch of RTL if-conversion testcases corresponding to and produced from existing pr105314.c and cset-sext.c C testcases. Verified with RV64 and RV32. OK to apply? Maciej

Re: [PATCH 2/2] RISC-V/testsuite: Also verify if-conversion runs for pr105314.c

2024-01-16 Thread Maciej W. Rozycki
On Tue, 16 Jan 2024, Jeff Law wrote: > > It's not clear to me what you mean by an "RTL testcase", i.e. how you'd > > see the testcase changed (or an additional one produced instead) and why, > > please elaborate. Right now we verify that branches are absent from > > output, but not how that

Re: [PATCH 2/2] RISC-V/testsuite: Also verify if-conversion runs for pr105314.c

2024-01-12 Thread Maciej W. Rozycki
On Fri, 12 Jan 2024, Andrew Pinski wrote: > > Verify that if-conversion succeeded through noce_try_store_flag_mask, as > > per PR rtl-optimization/105314, tightening the test case and making it > > explicit. > > > > gcc/testsuite/ > > * gcc.target/riscv/pr105314.c: Scan the RTL

[PATCH 2/2] RISC-V/testsuite: Also verify if-conversion runs for pr105314.c

2024-01-11 Thread Maciej W. Rozycki
Verify that if-conversion succeeded through noce_try_store_flag_mask, as per PR rtl-optimization/105314, tightening the test case and making it explicit. gcc/testsuite/ * gcc.target/riscv/pr105314.c: Scan the RTL "ce1" pass too. --- gcc/testsuite/gcc.target/riscv/pr105314.c |

[PATCH 1/2] RISC-V/testsuite: Widen coverage for pr105314.c

2024-01-11 Thread Maciej W. Rozycki
The optimization levels pr105314.c is iterated over are needlessly overridden with "-O2", limiting the coverage of the test case to that level, perhaps with additional options the original optimization level has been supplied with. We could prevent the extra iterations other than "-O2" from

[PATCH 0/2] RISC-V/testsuite: A couple of improvements for pr105314.c

2024-01-11 Thread Maciej W. Rozycki
Hi, Here's a pair of further pr105314.c changes I came up with in the course of recent RISC-V if-conversion work. It's not entirely clear to me what our policy is for Stages 3 and 4 when it comes to testsuite cleanups or improvements, but I think it's worth sharing these updates anyway. OK

[committed] RISC-V/testsuite: Fix comment termination in pr105314.c

2024-01-10 Thread Maciej W. Rozycki
Add terminating `/' character missing from one of the test harness command clauses in pr105314.c. This causes no issue with compilation owing to another comment immediately following, but would cause a: pr105314.c:3:1: warning: "/*" within comment [-Wcomment] message if warnings were enabled.

Re: [PATCH] RISC-V: Also handle sign extension in branch costing

2024-01-10 Thread Maciej W. Rozycki
On Tue, 9 Jan 2024, Jeff Law wrote: > > Depending on how you look at it you may qualify this as a bug fix (for > > the commit referred; it's surely rare enough a case I missed in original > > testing) or a missed optimisation. Either way it's a narrow-scoped very > > small change, almost an

[PATCH] RISC-V: Also handle sign extension in branch costing

2024-01-07 Thread Maciej W. Rozycki
Complement commit c1e8cb3d9f94 ("RISC-V: Rework branch costing model for if-conversion") and also handle extraneous sign extend operations that are sometimes produced by `noce_try_cmove_arith' instead of zero extend operations, making branch costing consistent. It is unclear what the

Re: [PATCH DejaGNU/GCC 0/1] Support per-test execution timeout factor

2024-01-03 Thread Maciej W. Rozycki
On Wed, 3 Jan 2024, Hans-Peter Nilsson wrote: > > The test execution timeout is different from the tool execution timeout > > where it is GCC execution that is being guarded against taking excessive > > amount of time on the test host rather than the resulting test case > > executable run on

Re: [PATCH] Treat "p" in asms as addressing VOIDmode

2023-12-12 Thread Maciej W. Rozycki
On Mon, 11 Dec 2023, Richard Sandiford wrote: > > It all seems a bit hackish. I don't think ports have had much success > > using 'p' through the decades. I think I generally ended up having to > > go with distinct constraints rather than relying on 'p'. > > > > OK for the trunk, but ewww. >

[PATCH DejaGNU 1/1] Support per-test execution timeout factor

2023-12-12 Thread Maciej W. Rozycki
Add support for the `test_timeout_factor' global variable letting a test case scale the wait timeout used for code execution. This is useful for particularly slow test cases for which increasing the wait timeout globally would be excessive. * baseboards/qemu.exp (qemu_load): Handle

[PATCH GCC 1/1] testsuite: Support test execution timeout factor as a keyword

2023-12-12 Thread Maciej W. Rozycki
Add support for the `dg-test-timeout-factor' keyword letting a test case scale the wait timeout used for code execution, analogously to `dg-timeout-factor' used for code compilation. This is useful for particularly slow test cases for which increasing the wait timeout globally would be excessive.

[PATCH DejaGNU/GCC 0/1] Support per-test execution timeout factor

2023-12-12 Thread Maciej W. Rozycki
Hi, This patch quasi-series makes it possible for individual test cases identified as being slow to request more time via the GCC test harness by providing a test execution timeout factor, applied to the tool execution timeout set globally for all the test cases. This is to avoid excessive

Re: [PATCH] Treat "p" in asms as addressing VOIDmode

2023-12-11 Thread Maciej W. Rozycki
On Mon, 11 Dec 2023, Jeff Law wrote: > > This happened with the late-combine pass that I posted in October: > > https://gcc.gnu.org/pipermail/gcc-patches/2023-October/634166.html > > which in turn triggered an error from aarch64_print_operand_address. > > > > This patch takes the (hopefully)

Re: Re: [PATCH] RISC-V: Normalize user vsetvl intrinsics[PR112092]

2023-12-04 Thread Maciej W. Rozycki
On Wed, 8 Nov 2023, Kito Cheng wrote: > OK, then LGTM, thanks for the explanation :) Please don't top-post on a GCC mailing list (and preferably in off-list replies to such mailing list messages unless it's been agreed to somehow with the participants), as it makes it difficult to make

Re: [COMMITTED] testsuite: Adjust g++.dg/opt/devirt2.C on SPARC

2023-11-29 Thread Maciej W. Rozycki
On Wed, 29 Nov 2023, Rainer Orth wrote: > Tested on sparc-sun-solaris2.11, installed on trunk. Thank you for fixing it. Maciej

Re: [PATCH 09/44] RISC-V: Rework branch costing model for if-conversion

2023-11-29 Thread Maciej W. Rozycki
On Tue, 28 Nov 2023, Jeff Law wrote: > FWIW, I was looking at a regression with our internal tests after your > changes. It was quite nice to see how well twiddling -mbranch-cost > correlated to how many instructions we would allow in a conditional move > sequence. I'm a bit concerned though

Re: [PATCH 34/44] RISC-V: Provide FP conditional-branch instructions for if-conversion

2023-11-23 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Jeff Law wrote: > So this is a more gradual lowering of the FP branches to allow ifcvt to do a > better job. Seems generally reasonable. I don't expect that we're missing > any significant simplifications, though I probably could construct a missed > CSE/GCSE if I worked at

Re: [PATCH 33/44] RISC-V: Also allow FP conditions in `riscv_expand_conditional_move'

2023-11-23 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Jeff Law wrote: > > Lift this restriction and only bail out if a non-word-mode integer > > condition has been requested, as we cannot handle this specific case > > owing to machine instruction set restriction. We already take care of > > the non-integer, non-floating-point

Re: [PATCH 31/44] RISC-V/testsuite: Add branchless cases for generic integer cond adds

2023-11-23 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Jeff Law wrote: > > The reason to XFAIL SImode tests for RV64 targets is the compiler thinks > > it has to sign-extend addends, which causes if-conversion to give up. > WRT extension and causing if-conversion to give up. Yes, it's a real issue. > In fact when we had Jivan do

Re: [PATCH 29/44] RISC-V: Add `addMODEcc' implementation for generic targets

2023-11-23 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Jeff Law wrote: > Is this an improvement over what if-convert creates for a conditional add or > is the goal to expose the sequence earlier in the pipeline rather than waiting > for ifcvt? TBH I haven't ever seen if-convert eliminate a branch here without this pattern

Re: [PATCH 26/44] RISC-V: Add `movMODEcc' implementation for generic targets

2023-11-23 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Jeff Law wrote: > OK. Just curious are y'all seeing significant interest in this case from > customers or is this more a case of rounding out the implementation to cover > all potential possibilities? As in the cover letter: we have a case where the pipeline seems to imply

Re: [PATCH 11/44] RISC-V/testsuite: Add branchless cases for integer cond-move operations

2023-11-23 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Kito Cheng wrote: > Just one minor comment, I think we don't really need to check rv64 or > rv32 for those compiled without any header file test, but I am fine > with that. We need to set `-march=' differently depending on whether verifying for rv64 or rv32, and then we

Re: [PATCH 09/44] RISC-V: Rework branch costing model for if-conversion

2023-11-23 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Jeff Law wrote: > As I suspect you know a big part of the problem here is that BRANCH_COST and > rtx_cost don't have any common scale and thus trying to compare BRANCH_COST to > RTX_COST doesn't have well defined meaning. We do have preexisting places using COSTS_N_INSNS

Re: [PATCH] AArch64/testsuite: Use non-capturing parentheses with ccmp_1.c

2023-11-23 Thread Maciej W. Rozycki
On Wed, 22 Nov 2023, Richard Earnshaw (lists) wrote: > > Use non-capturing parentheses for the subexpressions used with > > `scan-assembler-times', to avoid a quirk with double-counting. > > > > gcc/testsuite/ > > * gcc.target/aarch64/ccmp_1.c: Use non-capturing parentheses > >

[PATCH] AArch64/testsuite: Use non-capturing parentheses with ccmp_1.c

2023-11-22 Thread Maciej W. Rozycki
Use non-capturing parentheses for the subexpressions used with `scan-assembler-times', to avoid a quirk with double-counting. gcc/testsuite/ * gcc.target/aarch64/ccmp_1.c: Use non-capturing parentheses with `scan-assembler-times'. --- Hi, Here's another one. I

Re: [PING^2][PATCH RFA] PR target/111815: VAX: Only accept the index scaler as the RHS operand to ASHIFT

2023-11-21 Thread Maciej W. Rozycki
On Mon, 13 Nov 2023, Jeff Law wrote: > > > The testcase is generic enough I thought it wouldn't hurt to place it in > > > a generic part of the testsuite, where it has been verified to pass with > > > the `powerpc64le-linux-gnu', `riscv64-linux-gnu', and `vax-netbsdelf' > > > targets. I'm fine

Re: [PATCH] testsuite: Fix subexpressions with `scan-assembler-times'

2023-11-21 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Jeff Law wrote: > > Verified with the `riscv64-linux-gnu' target and the C language > > testsuite. OK to apply? > Not sure why it is the way it is -- I walked back to Zdenek's change which > introduced the scan-assembler-times and nothing about the -inline argument. I

[PATCH] ARM/testsuite: Use non-capturing parentheses with pr53447-5.c

2023-11-21 Thread Maciej W. Rozycki
Use non-capturing parentheses for the subexpressions used with `scan-assembler-times', to avoid a quirk with double-counting. gcc/testsuite/ * gcc.target/arm/pr53447-5.c: Use non-capturing parentheses with `scan-assembler-times'. --- Hi, The `scan-assembler-times'

Re: [PATCH 40/44] RISC-V: Handle FP NE operator via inversion in cond-operation expansion

2023-11-21 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Jeff Law wrote: > > gcc/ > > * config/riscv/riscv-protos.h (riscv_expand_float_scc): Add > > `invert_ptr' parameter. > > * config/riscv/riscv.cc (riscv_emit_float_compare): Add NE > > inversion handling. > > (riscv_expand_float_scc): Pass `invert_ptr'

Re: [PATCH 01/44] testsuite: Add cases for conditional-move and conditional-add operations

2023-11-21 Thread Maciej W. Rozycki
On Mon, 20 Nov 2023, Richard Biener wrote: > > > ok > > > > Thank you for your review, but I think I need a general maintainer's ack > > for this one. > > OK. I have committed this change now, thank you for your review. Maciej

Re: [PATCH] RISC-V: Remove duplicate `order_operator' predicate

2023-11-21 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Jeff Law wrote: > > Verified with the `riscv64-linux-gnu' target and the C language > > testsuite. OK to apply? > OK Applied now, thank you for your review. Maciej

Re: [PATCH 01/44] testsuite: Add cases for conditional-move and conditional-add operations

2023-11-20 Thread Maciej W. Rozycki
On Sun, 19 Nov 2023, Kito Cheng wrote: > ok Thank you for your review, but I think I need a general maintainer's ack for this one. Maciej

[PATCH] testsuite: Fix subexpressions with `scan-assembler-times'

2023-11-19 Thread Maciej W. Rozycki
We have an issue with `scan-assembler-times' handling expressions using subexpressions as produced by capturing parentheses `()' in an odd way, and one that is inconsistent with `scan-assembler', `scan-assembler-not', etc. The problem comes from calling `regexp' with `-inline -all', which

[PATCH] RISC-V: Remove duplicate `order_operator' predicate

2023-11-19 Thread Maciej W. Rozycki
Remove our RISC-V-specific `order_operator' predicate, which is exactly the same as generic `ordered_comparison_operator' one. gcc/ * config/riscv/predicates.md (order_operator): Remove predicate. * config/riscv/riscv.cc (riscv_rtx_costs): Update accordingly. *

Re: [PATCH 13/44] RISC-V/testsuite: Add branchless cases for FP cond-move operations

2023-11-18 Thread Maciej W. Rozycki
On Sat, 18 Nov 2023, Jeff Law wrote: > Is this dependent on any of the other patches in this series? Or is it > independent and ready to go as-is? I ask becuase it's marked as 13/44 and I > haven't seen the other 43 patches in the series :-) > > If it's independent and been tested, then it's

[PATCH 44/44] RISC-V/testsuite: Add branchless cases for FP NE cond-add operation

2023-11-18 Thread Maciej W. Rozycki
Verify, for the generic floating-point NE conditional-add operation, that if-conversion triggers via `noce_try_addcc' at `-mbranch-cost=3' setting, which makes branchless code sequences emitted by if-conversion cheaper than their original branched equivalents, and that extraneous instructions

[PATCH 43/44] RISC-V/testsuite: Add branched cases for FP NE cond-add operation

2023-11-18 Thread Maciej W. Rozycki
Verify, for the generic floating-point NE conditional-add operation, that if-conversion does *not* trigger at `-mbranch-cost=2' setting, which makes original branched code sequences cheaper than their branchless equivalents if-conversion would emit. gcc/testsuite/ *

[PATCH 42/44] RISC-V/testsuite: Add branched cases for FP NE cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for the floating-point NE conditional-move operation, that if-conversion triggers via `noce_try_cmove' at the respective sufficiently high `-mbranch-cost=' settings that make branchless code sequences produced by if-conversion cheaper than their original branched equivalents, and that

[PATCH 41/44] RISC-V/testsuite: Add branched cases for FP NE cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for generic, Ventana and Zicond targets and the floating-point NE conditional-move operation, that if-conversion does *not* trigger at the respective sufficiently low `-mbranch-cost=' settings that make original branched code sequences cheaper than their branchless equivalents

[PATCH 39/44] RISC-V/testsuite: Add branchless cases for generic FP cond adds

2023-11-18 Thread Maciej W. Rozycki
Verify, for generic floating-point conditional-add operations that have a corresponding conditional-set machine instruction, that if-conversion triggers via `noce_try_addcc' at `-mbranch-cost=3' setting, which makes branchless code sequences emitted by if-conversion cheaper than their original

[PATCH 40/44] RISC-V: Handle FP NE operator via inversion in cond-operation expansion

2023-11-18 Thread Maciej W. Rozycki
We have no FNE.fmt machine instructions, but we can emulate them for the purpose of conditional-move and conditional-add operations by using the respective FEQ.fmt instruction and then swapping the data input operands or complementing the mask for the conditional addend respectively, so update

[PATCH 36/44] RISC-V/testsuite: Add branched cases for generic FP cond moves

2023-11-18 Thread Maciej W. Rozycki
Verify, for generic floating-point conditional-move operations that have a corresponding conditional-set machine instruction, that if-conversion does *not* trigger at `-mbranch-cost=4' setting, which makes original branched code sequences cheaper than their branchless equivalents if-conversion

[PATCH 38/44] RISC-V/testsuite: Add branched cases for generic FP cond adds

2023-11-18 Thread Maciej W. Rozycki
Verify, for generic floating-point conditional-add operations that have a corresponding conditional-set machine instruction, that if-conversion does *not* trigger at `-mbranch-cost=2' setting, which makes original branched code sequences cheaper than their branchless equivalents if-conversion

[PATCH 35/44] RISC-V: Avoid extraneous integer comparison for FP comparisons

2023-11-18 Thread Maciej W. Rozycki
We have floating-point coditional-set machine instructions for a subset of FP comparisons, so avoid going through a comparison against constant zero in `riscv_expand_float_scc' where not necessary, preventing an extraneous RTL instruction from being produced that counts against the cost of the

[PATCH 32/44] RISC-V: Only use SUBREG if applicable in `riscv_expand_float_scc'

2023-11-18 Thread Maciej W. Rozycki
A subsequent change to enable the processing of conditional moves on a floating-point condition by `riscv_expand_conditional_move' will cause `riscv_expand_float_scc' to be called for word-mode target RTX with RV64 targets. In that case an invalid insn such as: (insn 25 24 0 (set (reg:DI 141)

[PATCH 37/44] RISC-V/testsuite: Add branchless cases for generic FP cond moves

2023-11-18 Thread Maciej W. Rozycki
Verify, for generic floating-point conditional-move operations that have a corresponding conditional-set machine instruction, that if-conversion triggers (via `cond_move_convert_if_block', which doesn't report) at `-mbranch-cost=5' setting, which makes branchless code sequences emitted by

[PATCH 34/44] RISC-V: Provide FP conditional-branch instructions for if-conversion

2023-11-18 Thread Maciej W. Rozycki
Do not expand floating-point conditional-branch RTL instructions right away that use a comparison operation that is either directly available as a machine conditional-set instruction or is NE, which can be emulated by EQ. This is so that if-conversion sees them in their original form and can

[PATCH 29/44] RISC-V: Add `addMODEcc' implementation for generic targets

2023-11-18 Thread Maciej W. Rozycki
Provide RTL expansion of conditional-add operations for generic targets using a suitable sequence of base integer machine instructions according to cost evaluation by if-conversion. Use existing `-mmovcc' command line option to enable this transformation. gcc/ *

[PATCH 33/44] RISC-V: Also allow FP conditions in `riscv_expand_conditional_move'

2023-11-18 Thread Maciej W. Rozycki
In `riscv_expand_conditional_move' we only let integer conditions through at the moment, even though code has already been prepared to handle floating-point conditions as well. Lift this restriction and only bail out if a non-word-mode integer condition has been requested, as we cannot handle

[PATCH 31/44] RISC-V/testsuite: Add branchless cases for generic integer cond adds

2023-11-18 Thread Maciej W. Rozycki
Verify, for generic integer conditional-add operations, if-conversion to trigger via `noce_try_addcc' at the respective sufficiently high `-mbranch-cost=' settings that make branchless code sequences produced by if-conversion cheaper than their original branched equivalents, and, where applicable,

[PATCH 27/44] RISC-V/testsuite: Add branched cases for generic integer cond moves

2023-11-18 Thread Maciej W. Rozycki
Verify, for generic integer conditional-move operations, if-conversion *not* to trigger at the respective sufficiently low `-mbranch-cost=' settings that make original branched code sequences cheaper than their branchless equivalents if-conversion would emit. Cover all integer relational

[PATCH 30/44] RISC-V/testsuite: Add branched cases for generic integer cond adds

2023-11-18 Thread Maciej W. Rozycki
Verify, for generic integer conditional-add operations, if-conversion *not* to trigger at the respective sufficiently low `-mbranch-cost=' settings that make original branched code sequences cheaper than their branchless equivalents if-conversion would emit. Cover all integer relational

[PATCH 28/44] RISC-V/testsuite: Add branchless cases for generic integer cond moves

2023-11-18 Thread Maciej W. Rozycki
Verify, for generic integer conditional-move operations, if-conversion to trigger via `noce_try_cmove' at the respective sufficiently high `-mbranch-cost=' settings that make branchless code sequences produced by if-conversion cheaper than their original branched equivalents, and, where

[PATCH 26/44] RISC-V: Add `movMODEcc' implementation for generic targets

2023-11-18 Thread Maciej W. Rozycki
Provide RTL expansion of conditional-move operations for generic targets using a suitable sequence of base integer machine instructions according to cost evaluation by if-conversion. Add `-mmovcc' command line option to enable this transformation, off by default. For the generic sequences

[PATCH 24/44] RISC-V/testsuite: Add branchless cases for T-Head non-equality cond moves

2023-11-18 Thread Maciej W. Rozycki
Verify, for T-Head targets and the non-equality integer conditional-move operations, that if-conversion triggers via `noce_try_cmove' at `-mbranch-cost=2' setting, which makes branchless code sequences produced by if-conversion cheaper than their original branched equivalents, and that

[PATCH 25/44] RISC-V: Implement `riscv_emit_unary' helper

2023-11-18 Thread Maciej W. Rozycki
Add a `riscv_emit_unary' helper for unary operations, complementing `riscv_emit_binary'. gcc/ * config/riscv/riscv-protos.h (riscv_emit_unary): New prototype. * config/riscv/riscv.cc (riscv_emit_unary): New function. --- gcc/config/riscv/riscv-protos.h |1 +

[PATCH 23/44] RISC-V/testsuite: Add branched cases for T-Head non-equality cond moves

2023-11-18 Thread Maciej W. Rozycki
Verify, for T-Head targets and the non-equality integer conditional-move operations, that if-conversion does *not* trigger at `-mbranch-cost=1' setting, which makes original branched code sequences cheaper than their branchless equivalents if-conversion would emit. gcc/testsuite/

[PATCH 22/44] RISC-V: Fold all the cond-move variants together

2023-11-18 Thread Maciej W. Rozycki
Code in `riscv_expand_conditional_move' for Ventana and Zicond targets seems like bolted on as an afterthought rather than properly merged so as to handle all the cases together. Fold the existing code pieces together then (observing that for short forward branch targets no integer comparisons

[PATCH 21/44] RISC-V: Also accept constants for T-Head cond-move data input operands

2023-11-18 Thread Maciej W. Rozycki
There is no need for the requirement for conditional-move data input operands to be stricter for T-Head targets than for short forward branch targets and limit them to registers only. They are keyed according to the `sfb_alu_operand' predicate, which lets certain constants through. Such

[PATCH 20/44] RISC-V: Also accept constants for T-Head cond-move comparison operands

2023-11-18 Thread Maciej W. Rozycki
There is no need for the requirement for conditional-move comparison operands to be stricter for T-Head targets than for other targets and limit them to registers only. Constants will be reloaded if required just as with branches or other-target conditional-move operations and there is no

[PATCH 15/44] RISC-V/testsuite: Add branched cases for GEU and LEU cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for Ventana and Zicond targets and the GEU and LEU conditional-move operations, that if-conversion does *not* trigger at `-mbranch-cost=3' setting, which makes original branched code sequences cheaper than their branchless equivalents if-conversion would emit. gcc/testsuite/

[PATCH 19/44] RISC-V/testsuite: Add branchless cases for equality cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for Ventana and Zicond targets and the equality conditional-move operations, that if-conversion triggers via `noce_try_cmove' at the respective sufficiently high `-mbranch-cost=' settings that make branchless code sequences produced by if-conversion cheaper than their original branched

[PATCH 18/44] RISC-V/testsuite: Add branched cases for equality cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for Ventana and Zicond targets and the equality conditional-move operations, that if-conversion does *not* trigger at the respective sufficiently low `-mbranch-cost=' settings that make original branched code sequences cheaper than their branchless equivalents if-conversion would emit.

[PATCH 17/44] RISC-V: Avoid extraneous EQ or NE operation in cond-move expansion

2023-11-18 Thread Maciej W. Rozycki
In the non-zero case there is no need for the conditional value used by Ventana and Zicond integer conditional operations to be specifically 1. Regardless we canonicalize it by producing an extraneous conditional-set operation, such as with the sequence below: (insn 22 6 23 2 (set (reg:DI 141)

[PATCH 14/44] RISC-V: Also invert the cond-move condition for GEU and LEU

2023-11-18 Thread Maciej W. Rozycki
Update `riscv_expand_conditional_move' and handle the missing GEU and LEU operators there, avoiding an extraneous conditional set operation, such as with this output: sgtua0,a0,a1 seqza1,a0 czero.eqz a3,a3,a1 czero.nez a1,a2,a1 or

[PATCH 16/44] RISC-V/testsuite: Add branchless cases for GEU and LEU cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for Ventana and Zicond targets and the GEU and LEU conditional-move operations, that if-conversion triggers via `noce_try_cmove' at `-mbranch-cost=4' setting, which makes branchless code sequences produced by if-conversion cheaper than their original branched equivalents, and that

[PATCH 12/44] RISC-V/testsuite: Add branched cases for FP cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for Ventana and Zicond targets and the ordered floating-point conditional-move operations that already work as expected, that if-conversion does *not* trigger at `-mbranch-cost=2' setting, which makes original branched code sequences cheaper than their branchless equivalents

[PATCH 11/44] RISC-V/testsuite: Add branchless cases for integer cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for T-Head, Ventana and Zicond targets and the integer conditional-move operations that already work as expected, if-conversion to trigger via `noce_try_cmove' at the respective sufficiently high `-mbranch-cost=' settings that make branchless code sequences produced by if-conversion

[PATCH 10/44] RISC-V/testsuite: Add branched cases for integer cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for T-Head, Ventana and Zicond targets and the integer conditional-move operations that already work as expected, that if-conversion does *not* trigger at the respective sufficiently low `-mbranch-cost=' settings that make original branched code sequences cheaper than their branchless

[PATCH 09/44] RISC-V: Rework branch costing model for if-conversion

2023-11-18 Thread Maciej W. Rozycki
The generic branch costing model for if-conversion assumes a fixed cost of COSTS_N_INSNS (2) for a conditional branch, and that one half of that cost comes from a preceding condition-set instruction, such as with MODE_CC targets, and then the other half of that cost is for the actual branch

[PATCH 07/44] RISC-V: Use `nullptr' in `riscv_expand_conditional_move'

2023-11-18 Thread Maciej W. Rozycki
Use `nullptr' for consistency rather than 0 to initialize `invert_ptr'. gcc/ * config/riscv/riscv.cc (riscv_expand_conditional_move): Use `nullptr' rather than 0 to initialize a pointer. --- gcc/config/riscv/riscv.cc |2 +- 1 file changed, 1 insertion(+), 1

[PATCH 08/44] RISC-V: Simplify EQ vs NE selection in `riscv_expand_conditional_move'

2023-11-18 Thread Maciej W. Rozycki
Just choose between EQ and NE at `gen_rtx_fmt_ee' invocation, removing an extraneous variable only referred once and improving code clarity. gcc/ * config/riscv/riscv.cc (riscv_expand_conditional_move): Remove extraneous variable for EQ vs NE operation selection. ---

[PATCH 06/44] RISC-V: Avoid repeated GET_MODE calls in `riscv_expand_conditional_move'

2023-11-18 Thread Maciej W. Rozycki
Use `mode0' and `mode1' shorthands respectively for `GET_MODE (op0)' and `GET_MODE (op1)' to improve code readability. gcc/ * config/riscv/riscv.cc (riscv_expand_conditional_move): Use `mode0' and `mode1' for `GET_MODE (op0)' and `GET_MODE (op1)'. ---

[PATCH 05/44] RISC-V: Fix `mode' usage in `riscv_expand_conditional_move'

2023-11-18 Thread Maciej W. Rozycki
In `riscv_expand_conditional_move' `mode' is initialized right away from `GET_MODE (dest)', so remove needless references that refrain from using the local variable. gcc/ * config/riscv/riscv.cc (riscv_expand_conditional_move): Use `mode' for `GET_MODE (dest)'

[PATCH 04/44] RISC-V: Sanitise NEED_EQ_NE_P case with `riscv_emit_int_compare'

2023-11-18 Thread Maciej W. Rozycki
For the NEED_EQ_NE_P `riscv_emit_int_compare' is documented to only emit EQ or NE comparisons against zero, however it does not catch incorrect use where a non-equality comparison has been requested and falls through to the general case then. Add a safety guard to catch such a case then.

[PATCH 03/44] RISC-V: Reorder comment on SFB patterns

2023-11-18 Thread Maciej W. Rozycki
Our `movcc' expander is no longer specific to short forward branch targets, so move its associated comment accordingly. gcc/ * config/riscv/riscv.md (movcc): Move comment on SFB patterns over to... (*movcc): ... here. --- gcc/config/riscv/riscv.md |4 ++-- 1

[PATCH 02/44] RISC-V/testsuite: Add cases for integer SFB cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for short forward branch targets and the conditional-move operations that already work as expected, that if-conversion triggers via `noce_try_cmove' already at `-mbranch-cost=1' and that extraneous instructions such as SNEZ, etc. are not present in output. Cover all integer relational

[PATCH 01/44] testsuite: Add cases for conditional-move and conditional-add operations

2023-11-18 Thread Maciej W. Rozycki
Add generic execution tests for expressions that are expected to expand to conditional-move and conditional-add operations where supported. To ensure no corner case escapes all relational operators are extensively covered for integer comparisons and all ordered operators are covered for

[PATCH 00/44] RISC-V: Various if-conversion fixes and improvements

2023-11-18 Thread Maciej W. Rozycki
Hi, This patch series has come out from a simple change to add generic conditional-move and conditional-add expansions for a yet-out-of-tree target, which has relatively expensive branches and no conditional operations beyond the base architecture conditional-set instructions. At one point

[PATCH 13/44] RISC-V/testsuite: Add branchless cases for FP cond-move operations

2023-11-18 Thread Maciej W. Rozycki
Verify, for short forward branch, T-Head, Ventana and Zicond targets and the ordered floating-point conditional-move operations that already work as expected, that if-conversion triggers via `noce_try_cmove' at the respective sufficiently high `-mbranch-cost=' settings that make branchless

  1   2   3   4   5   6   7   8   9   10   >