Re: [PATCH] ARM cmpsi2_addneg fixes (PR target/89506)

2019-03-01 Thread Jakub Jelinek
On Fri, Mar 01, 2019 at 05:04:24PM +0100, Jakub Jelinek wrote: > + /* For 0 and INT_MIN it is essential that we use subs, as adds > + will result in different condition codes (like cmn rather than > + like cmp). Both alternatives can match also for -1/1 with > + TARGET_THUMB2, prefer

Re: [PATCH] ARM cmpsi2_addneg fixes (PR target/89506)

2019-03-01 Thread Jakub Jelinek
On Fri, Mar 01, 2019 at 03:41:33PM +, Wilco Dijkstra wrote: > >> This is overcomplicating something simple - adds/subs are completely > >> symmetrical on all Arm targets. So for addition you simply place adds > >> alternative first and then subs. For comparison/subtraction place the > > > > A

Re: [PATCH] ARM cmpsi2_addneg fixes (PR target/89506)

2019-03-01 Thread Wilco Dijkstra
Hi Jakub, >> This is overcomplicating something simple - adds/subs are completely >> symmetrical on all Arm targets. So for addition you simply place adds >> alternative first and then subs. For comparison/subtraction place the > > As I wrote, that is what I have done, That's not what your pro

Re: [PATCH] ARM cmpsi2_addneg fixes (PR target/89506)

2019-03-01 Thread Jakub Jelinek
On Fri, Mar 01, 2019 at 02:57:57PM +, Wilco Dijkstra wrote: > > This can be done incrementally, I just have no idea what the rules > > for thumb2 constant encoding are. > > This is overcomplicating something simple - adds/subs are completely > symmetrical on all Arm targets. So for addition yo

Re: [PATCH] ARM cmpsi2_addneg fixes (PR target/89506)

2019-03-01 Thread Wilco Dijkstra
Hi Jakub, > Well, with the patch the decision which insn is chosen is done in C code. > So it could look like: >  if (operands[2] == const0_rtx >  || INTVAL (operands[2]) == -HOST_WIDE_INT_C (0x8000) >    subs; // mandatory >  else if (TARGET_THUMB2 >    && arm_immediate_operand (ope

Re: [PATCH] ARM cmpsi2_addneg fixes (PR target/89506)

2019-03-01 Thread Kyrill Tkachov
On 3/1/19 9:42 AM, Kyrill Tkachov wrote: On 3/1/19 9:36 AM, Jakub Jelinek wrote: > On Fri, Mar 01, 2019 at 09:21:16AM +, Kyrill Tkachov wrote: >>> Ok for trunk? >> Ok. > Thanks.  I'll wait for my regtest, previously I've regtested it only with > an older version of this patch. > >>> Or i

Re: [PATCH] ARM cmpsi2_addneg fixes (PR target/89506)

2019-03-01 Thread Kyrill Tkachov
On 3/1/19 9:36 AM, Jakub Jelinek wrote: On Fri, Mar 01, 2019 at 09:21:16AM +, Kyrill Tkachov wrote: Ok for trunk? Ok. Thanks. I'll wait for my regtest, previously I've regtested it only with an older version of this patch. Or is there an easy way to estimate if a constant satisfies bo

Re: [PATCH] ARM cmpsi2_addneg fixes (PR target/89506)

2019-03-01 Thread Jakub Jelinek
On Fri, Mar 01, 2019 at 09:21:16AM +, Kyrill Tkachov wrote: > > Ok for trunk? > > Ok. Thanks. I'll wait for my regtest, previously I've regtested it only with an older version of this patch. > > Or is there an easy way to estimate if a constant satisfies both "I" and "L" > > constraints at

Re: [PATCH] ARM cmpsi2_addneg fixes (PR target/89506)

2019-03-01 Thread Kyrill Tkachov
Hi Jakub, On 2/28/19 9:43 PM, Jakub Jelinek wrote: Hi! The following testcase ICEs on ARM, because the backend creates CONST_INTs that aren't valid for SImode, in which they are used (0x8000 rather than the canonical -0x8000). This is fixed by the 3 gen_int_mode calls instead of just G