[libc-commits] [libc] e5d104b - [libc][NFC] Add NOLINT annotations at call sites to immintrin functions.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Thu Dec 9 22:39:23 PST 2021


Author: Siva Chandra Reddy
Date: 2021-12-10T06:38:45Z
New Revision: e5d104b2800d2ecf8b305567163abfaead059acb

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

LOG: [libc][NFC] Add NOLINT annotations at call sites to immintrin functions.

These annotations are intended to be temporary while we understand why
clang-tidy is not able to treat them as builtin exceptions.

Added: 
    

Modified: 
    libc/src/__support/FPUtil/x86_64/FMA.h
    libc/src/__support/FPUtil/x86_64/PolyEval.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/FPUtil/x86_64/FMA.h b/libc/src/__support/FPUtil/x86_64/FMA.h
index f31b337e0cce3..db0a18a1ca6b0 100644
--- a/libc/src/__support/FPUtil/x86_64/FMA.h
+++ b/libc/src/__support/FPUtil/x86_64/FMA.h
@@ -26,11 +26,11 @@ __attribute__((target(
     "fma"))) static inline cpp::EnableIfType<cpp::IsSame<T, float>::Value, T>
 fma(T x, T y, T z) {
   float result;
-  __m128 xmm = _mm_load_ss(&x);
-  __m128 ymm = _mm_load_ss(&y);
-  __m128 zmm = _mm_load_ss(&z);
-  __m128 r = _mm_fmadd_ss(xmm, ymm, zmm);
-  _mm_store_ss(&result, r);
+  __m128 xmm = _mm_load_ss(&x);           // NOLINT
+  __m128 ymm = _mm_load_ss(&y);           // NOLINT
+  __m128 zmm = _mm_load_ss(&z);           // NOLINT
+  __m128 r = _mm_fmadd_ss(xmm, ymm, zmm); // NOLINT
+  _mm_store_ss(&result, r);               // NOLINT
   return result;
 }
 
@@ -39,11 +39,11 @@ __attribute__((target(
     "fma"))) static inline cpp::EnableIfType<cpp::IsSame<T, double>::Value, T>
 fma(T x, T y, T z) {
   double result;
-  __m128d xmm = _mm_load_sd(&x);
-  __m128d ymm = _mm_load_sd(&y);
-  __m128d zmm = _mm_load_sd(&z);
-  __m128d r = _mm_fmadd_sd(xmm, ymm, zmm);
-  _mm_store_sd(&result, r);
+  __m128d xmm = _mm_load_sd(&x);           // NOLINT
+  __m128d ymm = _mm_load_sd(&y);           // NOLINT
+  __m128d zmm = _mm_load_sd(&z);           // NOLINT
+  __m128d r = _mm_fmadd_sd(xmm, ymm, zmm); // NOLINT
+  _mm_store_sd(&result, r);                // NOLINT
   return result;
 }
 

diff  --git a/libc/src/__support/FPUtil/x86_64/PolyEval.h b/libc/src/__support/FPUtil/x86_64/PolyEval.h
index 4f8d3fcf7ea96..43153f3c1eaf3 100644
--- a/libc/src/__support/FPUtil/x86_64/PolyEval.h
+++ b/libc/src/__support/FPUtil/x86_64/PolyEval.h
@@ -25,11 +25,11 @@ namespace fputil {
 template <>
 __attribute__((target("fma"))) inline float
 polyeval(float x, float a0, float a1, float a2, float a3) {
-  __m128 xmm = _mm_set1_ps(x);
-  __m128 a13 = _mm_set_ps(0.0f, x, a3, a1);
-  __m128 a02 = _mm_set_ps(0.0f, 0.0f, a2, a0);
+  __m128 xmm = _mm_set1_ps(x);                 // NOLINT
+  __m128 a13 = _mm_set_ps(0.0f, x, a3, a1);    // NOLINT
+  __m128 a02 = _mm_set_ps(0.0f, 0.0f, a2, a0); // NOLINT
   // r = (0, x^2, a3*x + a2, a1*x + a0)
-  __m128 r = _mm_fmadd_ps(a13, xmm, a02);
+  __m128 r = _mm_fmadd_ps(a13, xmm, a02); // NOLINT
   // result = (a3*x + a2) * x^2 + (a1*x + a0)
   return fma(r[2], r[1], r[0]);
 }
@@ -37,11 +37,11 @@ polyeval(float x, float a0, float a1, float a2, float a3) {
 template <>
 __attribute__((target("fma"))) inline double
 polyeval(double x, double a0, double a1, double a2, double a3) {
-  __m256d xmm = _mm256_set1_pd(x);
-  __m256d a13 = _mm256_set_pd(0.0, x, a3, a1);
-  __m256d a02 = _mm256_set_pd(0.0, 0.0, a2, a0);
+  __m256d xmm = _mm256_set1_pd(x);               // NOLINT
+  __m256d a13 = _mm256_set_pd(0.0, x, a3, a1);   // NOLINT
+  __m256d a02 = _mm256_set_pd(0.0, 0.0, a2, a0); // NOLINT
   // r = (0, x^2, a3*x + a2, a1*x + a0)
-  __m256d r = _mm256_fmadd_pd(a13, xmm, a02);
+  __m256d r = _mm256_fmadd_pd(a13, xmm, a02); // NOLINT
   // result = (a3*x + a2) * x^2 + (a1*x + a0)
   return fma(r[2], r[1], r[0]);
 }
@@ -52,14 +52,14 @@ polyeval(double x, double a0, double a1, double a2, double a3) {
 template <>
 __attribute__((target("fma"))) inline float
 polyeval(float x, float a0, float a1, float a2, float a3, float a4, float a5) {
-  __m128 xmm = _mm_set1_ps(x);
-  __m128 a25 = _mm_set_ps(0.0f, x, a5, a2);
-  __m128 a14 = _mm_set_ps(0.0f, 0.0f, a4, a1);
-  __m128 a03 = _mm_set_ps(0.0f, 0.0f, a3, a0);
+  __m128 xmm = _mm_set1_ps(x);                 // NOLINT
+  __m128 a25 = _mm_set_ps(0.0f, x, a5, a2);    // NOLINT
+  __m128 a14 = _mm_set_ps(0.0f, 0.0f, a4, a1); // NOLINT
+  __m128 a03 = _mm_set_ps(0.0f, 0.0f, a3, a0); // NOLINT
   // r1 = (0, x^2, a5*x + a4, a2*x + a1)
-  __m128 r1 = _mm_fmadd_ps(a25, xmm, a14);
+  __m128 r1 = _mm_fmadd_ps(a25, xmm, a14); // NOLINT
   // r2 = (0, x^3, (a5*x + a4)*x + a3, (a2*x + a1)*x + a0
-  __m128 r2 = _mm_fmadd_ps(r1, xmm, a03);
+  __m128 r2 = _mm_fmadd_ps(r1, xmm, a03); // NOLINT
   // result = ((a5*x + a4)*x + a3) * x^3 + ((a2*x + a1)*x + a0)
   return fma(r2[2], r2[1], r2[0]);
 }
@@ -68,14 +68,14 @@ template <>
 __attribute__((target("fma"))) inline double
 polyeval(double x, double a0, double a1, double a2, double a3, double a4,
          double a5) {
-  __m256d xmm = _mm256_set1_pd(x);
-  __m256d a25 = _mm256_set_pd(0.0, x, a5, a2);
-  __m256d a14 = _mm256_set_pd(0.0, 0.0, a4, a1);
-  __m256d a03 = _mm256_set_pd(0.0, 0.0, a3, a0);
+  __m256d xmm = _mm256_set1_pd(x);               // NOLINT
+  __m256d a25 = _mm256_set_pd(0.0, x, a5, a2);   // NOLINT
+  __m256d a14 = _mm256_set_pd(0.0, 0.0, a4, a1); // NOLINT
+  __m256d a03 = _mm256_set_pd(0.0, 0.0, a3, a0); // NOLINT
   // r1 = (0, x^2, a5*x + a4, a2*x + a1)
-  __m256d r1 = _mm256_fmadd_pd(a25, xmm, a14);
+  __m256d r1 = _mm256_fmadd_pd(a25, xmm, a14); // NOLINT
   // r2 = (0, x^3, (a5*x + a4)*x + a3, (a2*x + a1)*x + a0
-  __m256d r2 = _mm256_fmadd_pd(r1, xmm, a03);
+  __m256d r2 = _mm256_fmadd_pd(r1, xmm, a03); // NOLINT
   // result = ((a5*x + a4)*x + a3) * x^3 + ((a2*x + a1)*x + a0)
   return fma(r2[2], r2[1], r2[0]);
 }


        


More information about the libc-commits mailing list