[llvm] 5fe0cab - [PowerPC] Removing sqrtd2 and sqrtf4 from list of vectorizable function with MASSV

Masoud Ataei via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 1 07:43:28 PST 2021


Author: Masoud Ataei
Date: 2021-03-01T15:42:19Z
New Revision: 5fe0cab79e184e48a6519eb5408bda99c837648a

URL: https://github.com/llvm/llvm-project/commit/5fe0cab79e184e48a6519eb5408bda99c837648a
DIFF: https://github.com/llvm/llvm-project/commit/5fe0cab79e184e48a6519eb5408bda99c837648a.diff

LOG: [PowerPC] Removing sqrtd2 and sqrtf4 from list of vectorizable function with MASSV

Under -O3 and -Ofast, the MASSV conversion prevents the sqrt call to be inlined.
Inline sqrt is faster than MASSV call on leppc.

Differential Revision: https://reviews.llvm.org/D97487

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/VecFuncs.def
    llvm/test/CodeGen/PowerPC/lower-massv.ll
    llvm/test/Transforms/LoopVectorize/PowerPC/massv-calls.ll

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/VecFuncs.def b/llvm/include/llvm/Analysis/VecFuncs.def
index 6f9636a79c11..1593d03ffdb7 100644
--- a/llvm/include/llvm/Analysis/VecFuncs.def
+++ b/llvm/include/llvm/Analysis/VecFuncs.def
@@ -156,10 +156,6 @@ TLI_DEFINE_VECFUNC("pow", "__powd2_massv", FIXED(2))
 TLI_DEFINE_VECFUNC("llvm.pow.f64", "__powd2_massv", FIXED(2))
 TLI_DEFINE_VECFUNC("powf", "__powf4_massv", FIXED(4))
 TLI_DEFINE_VECFUNC("llvm.pow.f32", "__powf4_massv", FIXED(4))
-TLI_DEFINE_VECFUNC("sqrt", "__sqrtd2_massv", FIXED(2))
-TLI_DEFINE_VECFUNC("llvm.sqrt.f64", "__sqrtd2_massv", FIXED(2))
-TLI_DEFINE_VECFUNC("sqrtf", "__sqrtf4_massv", FIXED(4))
-TLI_DEFINE_VECFUNC("llvm.sqrt.f32", "__sqrtf4_massv", FIXED(4))
 
 // Exponential and Logarithmic Functions
 TLI_DEFINE_VECFUNC("exp", "__expd2_massv", FIXED(2))

diff  --git a/llvm/test/CodeGen/PowerPC/lower-massv.ll b/llvm/test/CodeGen/PowerPC/lower-massv.ll
index b0ea47ccbf52..301aa7b94e66 100644
--- a/llvm/test/CodeGen/PowerPC/lower-massv.ll
+++ b/llvm/test/CodeGen/PowerPC/lower-massv.ll
@@ -8,9 +8,6 @@ declare <4 x float> @__cbrtf4_massv(<4 x float>)
 declare <2 x double> @__powd2_massv(<2 x double>, <2 x double>)
 declare <4 x float> @__powf4_massv(<4 x float>, <4 x float>)
 
-declare <2 x double> @__sqrtd2_massv(<2 x double>)
-declare <4 x float> @__sqrtf4_massv(<4 x float>)
-
 declare <2 x double> @__expd2_massv(<2 x double>)
 declare <4 x float> @__expf4_massv(<4 x float>)
 
@@ -118,29 +115,6 @@ define <4 x float>  @pow_f32_massv(<4 x float> %opnd1, <4 x float> %opnd2) {
   ret <4 x float> %1 
 }
 
-; sqrt
-define <2 x double>  @sqrt_f64_massv(<2 x double> %opnd) {
-; CHECK-ALL-LABEL: @sqrt_f64_massv
-; CHECK-PWR9: bl __sqrtd2_P9
-; CHECK-PWR8: bl __sqrtd2_P8
-; CHECK-NOT: bl __sqrtd2_massv
-; CHECK-ALL: blr
-;
-  %1 = call <2 x double> @__sqrtd2_massv(<2 x double> %opnd)
-  ret <2 x double> %1 
-}
-
-define <4 x float>  @sqrt_f32_massv(<4 x float> %opnd) {
-; CHECK-ALL-LABEL: @sqrt_f32_massv
-; CHECK-PWR9: bl __sqrtf4_P9
-; CHECK-PWR8: bl __sqrtf4_P8
-; CHECK-NOT: bl __sqrtf4_massv
-; CHECK-ALL: blr
-;
-  %1 = call <4 x float> @__sqrtf4_massv(<4 x float> %opnd)
-  ret <4 x float> %1 
-}
-
 ; exp
 define <2 x double>  @exp_f64_massv(<2 x double> %opnd) {
 ; CHECK-ALL-LABEL: @exp_f64_massv

diff  --git a/llvm/test/Transforms/LoopVectorize/PowerPC/massv-calls.ll b/llvm/test/Transforms/LoopVectorize/PowerPC/massv-calls.ll
index eafca05c5aa7..8e48d760e482 100644
--- a/llvm/test/Transforms/LoopVectorize/PowerPC/massv-calls.ll
+++ b/llvm/test/Transforms/LoopVectorize/PowerPC/massv-calls.ll
@@ -236,7 +236,7 @@ for.end:
 
 define void @sqrt_f64(double* nocapture %varray) {
 ; CHECK-LABEL: @sqrt_f64(
-; CHECK: __sqrtd2_massv{{.*}}<2 x double>
+; CHECK-NOT: __sqrtd2_massv{{.*}}<2 x double>
 ; CHECK: ret void
 ;
 entry:
@@ -259,7 +259,7 @@ for.end:
 
 define void @sqrt_f32(float* nocapture %varray) {
 ; CHECK-LABEL: @sqrt_f32(
-; CHECK: __sqrtf4_massv{{.*}}<4 x float>
+; CHECK-NOT: __sqrtf4_massv{{.*}}<4 x float>
 ; CHECK: ret void
 ;
 entry:


        


More information about the llvm-commits mailing list