Re: [PATCH][AArch64] Improve bit tests [PR105773]

2022-10-13 Thread Wilco Dijkstra via Gcc-patches
Hi Richard, > Maybe pre-existing, but are ordered comparisons safe for the > ZERO_EXTRACT case?  If we extract the top 8 bits (say), zero extend, > and compare with zero, the result should be >= 0, whereas TST would > set N to the top bit. Yes in principle zero extract should always be positive

Re: [PATCH][AArch64] Improve bit tests [PR105773]

2022-10-12 Thread Richard Sandiford via Gcc-patches
Wilco Dijkstra writes: > Hi Richard, > >> Realise this is awkward, but: CC_NZmode is for operations that set only >> the N and Z flags to useful values. If we want to take advantage of V >> being zero then I think we need a different mode. >> >> We can't go all the way to CCmode because the

Re: [PATCH][AArch64] Improve bit tests [PR105773]

2022-10-12 Thread Wilco Dijkstra via Gcc-patches
Hi Richard, > Realise this is awkward, but: CC_NZmode is for operations that set only > the N and Z flags to useful values.  If we want to take advantage of V > being zero then I think we need a different mode. > > We can't go all the way to CCmode because the carry flag has the opposite > value

Re: [PATCH][AArch64] Improve bit tests [PR105773]

2022-10-05 Thread Richard Sandiford via Gcc-patches
Wilco Dijkstra writes: > Since AArch64 sets all flags on logical operations, comparisons with zero > can be combined into an AND even if the condition is LE or GT. > > Passes regress, OK for commit? > > gcc: > PR target/105773 > * config/aarch64/aarch64.cc

[PATCH][AArch64] Improve bit tests [PR105773]

2022-10-05 Thread Wilco Dijkstra via Gcc-patches
Since AArch64 sets all flags on logical operations, comparisons with zero can be combined into an AND even if the condition is LE or GT. Passes regress, OK for commit? gcc: PR target/105773 * config/aarch64/aarch64.cc (aarch64_select_cc_mode): Allow GT/LE for merging