Hi Richard I just found that modifying match.pd may be a better way since for forwprop-19.c, VEC_PERM_EXPR exists in all gimple until 235t.optimize with current trunk code, that leave us no pass to ‘scan-tree-dump-not’.
Best Regards Levy > On 14 Oct 2022, at 2:19 pm, Richard Biener <richard.guent...@gmail.com> wrote: > > On Fri, Oct 14, 2022 at 3:49 AM Lulu Cheng <chengl...@loongson.cn> wrote: >> >> >>> 在 2022/10/13 下午7:10, Richard Biener 写道: >>> On Thu, Oct 13, 2022 at 10:16 AM Lulu Cheng <chengl...@loongson.cn> wrote: >>>> >>>> 在 2022/10/13 下午2:44, Xi Ruoyao 写道: >>>>> On Thu, 2022-10-13 at 14:15 +0800, Levy wrote: >>>>>> Hi RuoYao >>>>>> >>>>>> It’s probably because loongarch64 doesn’t support >>>>>> can_vec_perm_const_p(result_mode, op_mode, sel2, false) >>>>>> >>>>>> I’m not sure whether if loongarch will support it or should I just >>>>>> limit the test target for pr54346.c? >>>>> I'm not sure if we can add TARGET_VECTORIZE_VEC_PERM_CONST when we don't >>>>> actually support vector. (LoongArch has SIMD instructions but the >>>>> support in GCC won't be added in a very recent future.) >>>>> >>>> If what I understand is correct, I think this might be a better solution. >>>> >>>> /* { dg-do compile } */ >>>> >>>> +/* { dg-require-effective-target vect_perm } */ >>>> /* { dg-options "-O -fdump-tree-dse1" } */ >>> Btw, what forwprop does is check whether any of the original permutations >>> are >>> not supported and then elide the supportability check for the result. >>> The reasoning >>> is that the original permute(s) would be lowered during vectlower so we can >>> as >>> well do that for the result. We should just never turn a supported >>> permutation >>> sequence into a not supported one. >>> >>> Richard. >>> >> Hi Richard: >> >> I'm very sorry. I don't fully understand what you mean. >> >> Could you give me some more details? > > The argument is that if Loongarch64 doesn't support the VEC_PERM_EXPR in the > IL > before the transform then it doesn't matter if the transform introduces > another > VEC_PERM_EXPR that isn't supported. Both are later (in the veclower pass) > lowered to scalar operations. > > So instead of > > if (can_vec_perm_const_p (result_mode, op_mode, sel2, false)) > .. > > you'd do > > if (can_vec_perm_const_p (result_mode, op_mode, sel2, false) > || !can_vec_perm_const_p ( ... original vec_perm1 ...) > || !can_vec_perm_const_p ( ... original vec_perm2 ...)) > > Richard. > >> >> Thanks! >> >> Lulu Cheng >>