[PATCH] D80744: DAGCombiner optimization for pow(x, 0.75) even in case massv function is asked

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 02:40:29 PDT 2020


steven.zhang added a comment.

> I tested with a c code too
> 
>   $ cat vst.c 
>   #include<math.h>
>   void my_vspow_075 (float y[], float x[]) {
>     #pragma disjoint (*y, *x)
>   
>     float *xp=x, *yp=y;
>     int i;
>   
>     for (i=0; i<1024; i++) {
>        *yp=powf(*xp, 0.75);
>        xp++;
>        yp++;
>     }
>   }
> 
> 
> compile it with `clang -Ofast -fveclib=MASSV vst.c -mllvm -print-after-all`. I can see that after LoopVectorizePass, llvm.pow.f32 is converted to `__powf4_massv` and after PPCLowerMASSVEntries `__powf4_massv` is converted to `__powf4_P8`. But later we will get conversion to sqrt's. This is happening if you just set `setOperationAction(ISD::FPOW, MVT::v4f32, Custom);` no other changes. The rest of changes in PPCISelLowring.cpp is needed to handle the cases of powf(x,y) when y is not 0.75.

I don't see any difference of the assembly output from your example code with your patch. I see that we turn the llvm.pow.f32 into two sqrts w/o this patch, not `__powf4_P8`.  I assume that, you want to turn `__powf4_P8` into two sqrt's if the arguments is 0.75. Please correct me if I misunderstand the intention.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80744/new/

https://reviews.llvm.org/D80744





More information about the llvm-commits mailing list