>
> > BTW: If abs is a define_insn_and_split, pr117722.c still fails
> > because combine can no longer fold abs(a - b) into the old form.
> > So I keep it as an expand.
>
> There shouldn't be any difference WRT combine.  Or do you mean
> a
>  (define_insn_and_split (
>    [(set (match_operand:V_VLSI 0 "register_operand")
>      (abs:V_VLSI
>        (match_operand:V_VLSI 1 "register_operand")))]?
>

Yeah, i tried
```
 (define_insn_and_split (
   [(set (match_operand:V_VLSI 0 "register_operand")
     (abs:V_VLSI
       (match_operand:V_VLSI 1 "register_operand")))]?
```

the dump shows:
  /tmp/pr117722-split/pr117722.c.309r.combine
    513 (insn 21 20 22 4 (set (reg:RVVMF2HI 159 [ vect_patt_18.18_125 ])
    514         (minus:RVVMF2HI (zero_extend:RVVMF2HI (reg:RVVMF4QI 155))
    515             (zero_extend:RVVMF2HI (reg:RVVMF4QI 157))))
"gcc/testsuite/gcc.target/riscv/rvv/autovec/pr117722.c":16:27 34245
{*dual_widen_suburvvmf2hi}
    516      (expr_list:REG_DEAD (reg:RVVMF4QI 157)
    517         (expr_list:REG_DEAD (reg:RVVMF4QI 155)
    518             (nil))))
    519 (insn 22 21 23 4 (set (reg:RVVMF2HI 160 [ vect_patt_45.20_127 ])
    520         (abs:RVVMF2HI (reg:RVVMF2HI 159 [ vect_patt_18.18_125
]))) "gcc/testsuite/gcc.target/riscv/rvv/autovec/pr117722.c":16:15
30864 {absrvvmf2hi2}
    521      (expr_list:REG_DEAD (reg:RVVMF2HI 159 [ vect_patt_18.18_125 ])
    522         (nil)))

combine still sees `abs`.
but with the `define_expand` version, it sees `neg + smax` sequence,
then rewrite from `neg (a - b)` into `(b - a)`.

Reply via email to