A: expf fmaf 180296c80 + rt_div_tables vpermps dump
This commit is contained in:
+29
-2
@@ -1,7 +1,34 @@
|
||||
#include "fn529fe0.hpp"
|
||||
#include "rt_div_tables.hpp"
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <cfenv>
|
||||
|
||||
namespace {
|
||||
inline float expf_180296c80(float x) {
|
||||
// BLOCKMAP:569 expf FLOAT 180296c80 — n=fma(1.44269502,x,12582912), k=n-MAGIC,
|
||||
// r=(x-0.69314718*k)-1.42861e-06*k, p=(((0.00829172*r+0.0418735)*r+0.166674)*r+0.499994)*r+1)*r+1
|
||||
// out = bits((k<<23)+bits(p)), guard |x|>87.3365 slow
|
||||
if (std::abs(x) > 87.3365478515625f) return std::exp(x);
|
||||
const float LOG2E = 1.44269502f;
|
||||
const float MAGIC = 12582912.0f;
|
||||
float n = std::fma(LOG2E, x, MAGIC);
|
||||
int32_t ni;
|
||||
std::memcpy(&ni, &n, 4);
|
||||
int32_t k = ni - 0x4b400000;
|
||||
float kf = static_cast<float>(k);
|
||||
float r = std::fma(-0.69314718f, kf, x);
|
||||
r = std::fma(-1.428606e-06f, kf, r);
|
||||
float p = std::fma(0.00829172f, r, 0.0418735f);
|
||||
p = std::fma(p, r, 0.166674f);
|
||||
p = std::fma(p, r, 0.499994f);
|
||||
p = std::fma(p, r, 1.0f);
|
||||
p = std::fma(p, r, 1.0f);
|
||||
// scale by 2^k
|
||||
return std::ldexp(p, k);
|
||||
}
|
||||
}
|
||||
|
||||
// Structural mask-apply chain FUN_180529fe0 (mono path). Step-by-step
|
||||
// transcription; each component is a pure function so it can be unit-tested and
|
||||
@@ -180,12 +207,12 @@ void chain_9_19(float* bands, float* tmp6f8, float* accVec,
|
||||
tmp6f8[i] += rel[i] * accVec[i]; // lower
|
||||
}
|
||||
// 14: EXP#1 180296c80 expf + +=(-1) th2270 (24mm2 order fix)
|
||||
for (size_t i = 0; i < nbin; i++) bands[i] = std::exp(bands[i]) - 1.0f;
|
||||
for (size_t i = 0; i < nbin; i++) bands[i] = expf_180296c80(bands[i]) - 1.0f;
|
||||
// 15: array-mul track* th2000
|
||||
// 16: *=kWarp + LOG#2 140980 (placeholder warp already passed)
|
||||
for (size_t i = 0; i < nbin; i++) bands[i] *= warp[i];
|
||||
// 17: EXP#2 + exp-variant 140a40/140b00
|
||||
for (size_t i = 0; i < nbin; i++) bands[i] = std::exp(bands[i]);
|
||||
for (size_t i = 0; i < nbin; i++) bands[i] = expf_180296c80(bands[i]);
|
||||
}
|
||||
|
||||
// ---- Legacy structural chain (pre-cascade) ---------------------------------
|
||||
|
||||
Reference in New Issue
Block a user