Re: [PATCH v3 34/48] tcg/optimize: Split out fold_to_not

2021-10-25 Thread Richard Henderson

On 10/25/21 11:13 AM, Luis Fernando Fujita Pires wrote:

From: Richard Henderson 


   static bool fold_eqv(OptContext *ctx, TCGOp *op)  {
-return fold_const2(ctx, op);
+if (fold_const2(ctx, op) ||
+fold_xi_to_not(ctx, op, 0)) {


Should be fold_ix_to_not (not fold xi_to_not).


No, because for eqv we expect the second operand to be the constant -- eqv is
commutative.


Ah, got it! The previous code was wrong, and I failed to notice that eqv 
would've had its arguments swapped to have the constant as second.


Ah!  I failed to notice that the previous code was wrong.  ;-)


r~



RE: [PATCH v3 34/48] tcg/optimize: Split out fold_to_not

2021-10-25 Thread Luis Fernando Fujita Pires
From: Richard Henderson 

> >>   static bool fold_eqv(OptContext *ctx, TCGOp *op)  {
> >> -return fold_const2(ctx, op);
> >> +if (fold_const2(ctx, op) ||
> >> +fold_xi_to_not(ctx, op, 0)) {
> >
> > Should be fold_ix_to_not (not fold xi_to_not).
> 
> No, because for eqv we expect the second operand to be the constant -- eqv is
> commutative.

Ah, got it! The previous code was wrong, and I failed to notice that eqv 
would've had its arguments swapped to have the constant as second.

--
Luis Pires
Instituto de Pesquisas ELDORADO
Aviso Legal - Disclaimer 


Re: [PATCH v3 34/48] tcg/optimize: Split out fold_to_not

2021-10-25 Thread Richard Henderson

On 10/25/21 7:17 AM, Luis Fernando Fujita Pires wrote:

From: Richard Henderson 

Split out the conditional conversion from a more complex logical operation to a
simple NOT.  Create a couple more helpers to make this easy for the outer-most
logical operations.

Signed-off-by: Richard Henderson 
---
  tcg/optimize.c | 154 +++--
  1 file changed, 86 insertions(+), 68 deletions(-)



  static bool fold_eqv(OptContext *ctx, TCGOp *op)  {
-return fold_const2(ctx, op);
+if (fold_const2(ctx, op) ||
+fold_xi_to_not(ctx, op, 0)) {


Should be fold_ix_to_not (not fold xi_to_not).


No, because for eqv we expect the second operand to be the constant -- eqv is 
commutative.




  static bool fold_orc(OptContext *ctx, TCGOp *op)  {
-return fold_const2(ctx, op);
+if (fold_const2(ctx, op) ||
+fold_xi_to_not(ctx, op, 0)) {


But for orc you are correct.  Thanks.


r~



RE: [PATCH v3 34/48] tcg/optimize: Split out fold_to_not

2021-10-25 Thread Luis Fernando Fujita Pires
From: Richard Henderson 
> Split out the conditional conversion from a more complex logical operation to 
> a
> simple NOT.  Create a couple more helpers to make this easy for the outer-most
> logical operations.
> 
> Signed-off-by: Richard Henderson 
> ---
>  tcg/optimize.c | 154 +++--
>  1 file changed, 86 insertions(+), 68 deletions(-)

>  static bool fold_eqv(OptContext *ctx, TCGOp *op)  {
> -return fold_const2(ctx, op);
> +if (fold_const2(ctx, op) ||
> +fold_xi_to_not(ctx, op, 0)) {

Should be fold_ix_to_not (not fold xi_to_not).

>  static bool fold_orc(OptContext *ctx, TCGOp *op)  {
> -return fold_const2(ctx, op);
> +if (fold_const2(ctx, op) ||
> +fold_xi_to_not(ctx, op, 0)) {

Same here.

--
Luis Pires
Instituto de Pesquisas ELDORADO
Aviso Legal - Disclaimer