Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a16a9814 authored by Stephen Hines's avatar Stephen Hines
Browse files

Remove unnecessary library functions.

Change-Id: I47fadb2b9e8b9e9ef5f139470366ce43c75fadbb
parent eb60932a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ volatile int4 i4;
    i4 = fnc(f4);


static bool test_math(uint32_t index) {
static bool test_fp_math(uint32_t index) {
    bool failed = false;
    start();

@@ -159,10 +159,10 @@ static bool test_math(uint32_t index) {
    float time = end(index);

    if (failed) {
        rsDebug("test_math FAILED", time);
        rsDebug("test_fp_math FAILED", time);
    }
    else {
        rsDebug("test_math PASSED", time);
        rsDebug("test_fp_math PASSED", time);
    }

    return failed;
@@ -170,7 +170,7 @@ static bool test_math(uint32_t index) {

void math_test(uint32_t index, int test_num) {
    bool failed = false;
    failed |= test_math(index);
    failed |= test_fp_math(index);

    if (failed) {
        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+0 −35
Original line number Diff line number Diff line
@@ -24,26 +24,6 @@ using namespace android;
using namespace android::renderscript;


static float SC_acospi(float v) {
    return acosf(v)/ M_PI;
}

static float SC_asinpi(float v) {
    return asinf(v) / M_PI;
}

static float SC_atanpi(float v) {
    return atanf(v) / M_PI;
}

static float SC_atan2pi(float y, float x) {
    return atan2f(y, x) / M_PI;
}

static float SC_cospi(float v) {
    return cosf(v * M_PI);
}

static float SC_exp10(float v) {
    return pow(10.f, v);
}
@@ -83,14 +63,6 @@ float SC_sincos(float v, float *cosptr) {
    return sinf(v);
}

static float SC_sinpi(float v) {
    return sinf(v * M_PI);
}

static float SC_tanpi(float v) {
    return tanf(v * M_PI);
}

//////////////////////////////////////////////////////////////////////////////
// Integer
//////////////////////////////////////////////////////////////////////////////
@@ -186,21 +158,16 @@ static ScriptCState::SymbolTable_t gSyms[] = {
    // OpenCL math
    { "_Z4acosf", (void *)&acosf, true },
    { "_Z5acoshf", (void *)&acoshf, true },
    { "_Z6acospif", (void *)&SC_acospi, true },
    { "_Z4asinf", (void *)&asinf, true },
    { "_Z5asinhf", (void *)&asinhf, true },
    { "_Z6asinpif", (void *)&SC_asinpi, true },
    { "_Z4atanf", (void *)&atanf, true },
    { "_Z5atan2ff", (void *)&atan2f, true },
    { "_Z5atanhf", (void *)&atanhf, true },
    { "_Z6atanpif", (void *)&SC_atanpi, true },
    { "_Z7atan2piff", (void *)&SC_atan2pi, true },
    { "_Z4cbrtf", (void *)&cbrtf, true },
    { "_Z4ceilf", (void *)&ceilf, true },
    { "_Z8copysignff", (void *)&copysignf, true },
    { "_Z3cosf", (void *)&cosf, true },
    { "_Z4coshf", (void *)&coshf, true },
    { "_Z5cospif", (void *)&SC_cospi, true },
    { "_Z4erfcf", (void *)&erfcf, true },
    { "_Z3erff", (void *)&erff, true },
    { "_Z3expf", (void *)&expf, true },
@@ -240,11 +207,9 @@ static ScriptCState::SymbolTable_t gSyms[] = {
    { "_Z3sinf", (void *)&sinf, true },
    { "_Z6sincosfPf", (void *)&SC_sincos, true },
    { "_Z4sinhf", (void *)&sinhf, true },
    { "_Z5sinpif", (void *)&SC_sinpi, true },
    { "_Z4sqrtf", (void *)&sqrtf, true },
    { "_Z3tanf", (void *)&tanf, true },
    { "_Z4tanhf", (void *)&tanhf, true },
    { "_Z5tanpif", (void *)&SC_tanpi, true },
    { "_Z6tgammaf", (void *)&lgammaf, true }, // FIXME!!! NEEDS TO USE tgammaf
    { "_Z5truncf", (void *)&truncf, true },

+344 −362
Original line number Diff line number Diff line
@@ -9,16 +9,20 @@

// Conversions
#define CVT_FUNC_2(typeout, typein)                             \
_RS_STATIC typeout##2 __attribute__((overloadable)) convert_##typeout##2(typein##2 v) { \
_RS_STATIC typeout##2 __attribute__((overloadable))             \
        convert_##typeout##2(typein##2 v) {                     \
    typeout##2 r = {(typeout)v.x, (typeout)v.y};                \
    return r;                                                   \
}                                                               \
_RS_STATIC typeout##3 __attribute__((overloadable)) convert_##typeout##3(typein##3 v) { \
_RS_STATIC typeout##3 __attribute__((overloadable))             \
        convert_##typeout##3(typein##3 v) {                     \
    typeout##3 r = {(typeout)v.x, (typeout)v.y, (typeout)v.z};  \
    return r;                                                   \
}                                                               \
_RS_STATIC typeout##4 __attribute__((overloadable)) convert_##typeout##4(typein##4 v) { \
    typeout##4 r = {(typeout)v.x, (typeout)v.y, (typeout)v.z, (typeout)v.w}; \
_RS_STATIC typeout##4 __attribute__((overloadable))             \
        convert_##typeout##4(typein##4 v) {                     \
    typeout##4 r = {(typeout)v.x, (typeout)v.y, (typeout)v.z,   \
                    (typeout)v.w};                              \
    return r;                                                   \
}

@@ -38,8 +42,6 @@ CVT_FUNC(int)
CVT_FUNC(uint)
CVT_FUNC(float)



// Float ops, 6.11.2

#define FN_FUNC_FN(fnc)                                         \
@@ -181,90 +183,96 @@ _RS_STATIC float4 __attribute__((overloadable)) fnc(float4 v1, int v2) { \
}

#define FN_FUNC_FN_PFN(fnc)                     \
_RS_STATIC float2 __attribute__((overloadable)) fnc(float2 v1, float2 *v2) { \
_RS_STATIC float2 __attribute__((overloadable)) \
        fnc(float2 v1, float2 *v2) {            \
    float2 r;                                   \
    float q; \
    r.x = fnc(v1.x, &q); \
    v2->x = q; \
    r.y = fnc(v1.y, &q); \
    v2->y = q; \
    float t[2];                                 \
    r.x = fnc(v1.x, &t[0]);                     \
    r.y = fnc(v1.y, &t[1]);                     \
    v2->x = t[0];                               \
    v2->y = t[1];                               \
    return r;                                   \
}                                               \
_RS_STATIC float3 __attribute__((overloadable)) fnc(float3 v1, float3 *v2) { \
_RS_STATIC float3 __attribute__((overloadable)) \
        fnc(float3 v1, float3 *v2) {            \
    float3 r;                                   \
    float q; \
    r.x = fnc(v1.x, &q); \
    v2->x = q; \
    r.y = fnc(v1.y, &q); \
    v2->y = q; \
    r.z = fnc(v1.z, &q); \
    v2->z = q; \
    float t[3];                                 \
    r.x = fnc(v1.x, &t[0]);                     \
    r.y = fnc(v1.y, &t[1]);                     \
    r.z = fnc(v1.z, &t[2]);                     \
    v2->x = t[0];                               \
    v2->y = t[1];                               \
    v2->z = t[2];                               \
    return r;                                   \
}                                               \
_RS_STATIC float4 __attribute__((overloadable)) fnc(float4 v1, float4 *v2) { \
_RS_STATIC float4 __attribute__((overloadable)) \
        fnc(float4 v1, float4 *v2) {            \
    float4 r;                                   \
    float q; \
    r.x = fnc(v1.x, &q); \
    v2->x = q; \
    r.y = fnc(v1.y, &q); \
    v2->y = q; \
    r.z = fnc(v1.z, &q); \
    v2->z = q; \
    r.w = fnc(v1.w, &q); \
    v2->w = q; \
    float t[4];                                 \
    r.x = fnc(v1.x, &t[0]);                     \
    r.y = fnc(v1.y, &t[1]);                     \
    r.z = fnc(v1.z, &t[2]);                     \
    r.w = fnc(v1.w, &t[3]);                     \
    v2->x = t[0];                               \
    v2->y = t[1];                               \
    v2->z = t[2];                               \
    v2->w = t[3];                               \
    return r;                                   \
}

#define FN_FUNC_FN_PIN(fnc)                                                 \
_RS_STATIC float2 __attribute__((overloadable)) fnc(float2 v1, int2 *v2) {  \
    float2 r;                                                               \
    int q; \
    r.x = fnc(v1.x, &q); \
    v2->x = q; \
    r.y = fnc(v1.y, &q); \
    v2->y = q; \
    int t[2];                                                               \
    r.x = fnc(v1.x, &t[0]);                                                 \
    r.y = fnc(v1.y, &t[1]);                                                 \
    v2->x = t[0];                                                           \
    v2->y = t[1];                                                           \
    return r;                                                               \
}                                                                           \
_RS_STATIC float3 __attribute__((overloadable)) fnc(float3 v1, int3 *v2) {  \
    float3 r;                                                               \
    int q; \
    r.x = fnc(v1.x, &q); \
    v2->x = q; \
    r.y = fnc(v1.y, &q); \
    v2->y = q; \
    r.z = fnc(v1.z, &q); \
    v2->z = q; \
    int t[3];                                                               \
    r.x = fnc(v1.x, &t[0]);                                                 \
    r.y = fnc(v1.y, &t[1]);                                                 \
    r.z = fnc(v1.z, &t[2]);                                                 \
    v2->x = t[0];                                                           \
    v2->y = t[1];                                                           \
    v2->z = t[2];                                                           \
    return r;                                                               \
}                                                                           \
_RS_STATIC float4 __attribute__((overloadable)) fnc(float4 v1, int4 *v2) {  \
    float4 r;                                                               \
    int q; \
    r.x = fnc(v1.x, &q); \
    v2->x = q; \
    r.y = fnc(v1.y, &q); \
    v2->y = q; \
    r.z = fnc(v1.z, &q); \
    v2->z = q; \
    r.w = fnc(v1.w, &q); \
    v2->w = q; \
    int t[4];                                                               \
    r.x = fnc(v1.x, &t[0]);                                                 \
    r.y = fnc(v1.y, &t[1]);                                                 \
    r.z = fnc(v1.z, &t[2]);                                                 \
    r.w = fnc(v1.w, &t[3]);                                                 \
    v2->x = t[0];                                                           \
    v2->y = t[1];                                                           \
    v2->z = t[2];                                                           \
    v2->w = t[3];                                                           \
    return r;                                                               \
}

#define FN_FUNC_FN_FN_FN(fnc)                   \
_RS_STATIC float2 __attribute__((overloadable)) fnc(float2 v1, float2 v2, float2 v3) { \
_RS_STATIC float2 __attribute__((overloadable)) \
        fnc(float2 v1, float2 v2, float2 v3) {  \
    float2 r;                                   \
    r.x = fnc(v1.x, v2.x, v3.x);                \
    r.y = fnc(v1.y, v2.y, v3.y);                \
    return r;                                   \
}                                               \
_RS_STATIC float3 __attribute__((overloadable)) fnc(float3 v1, float3 v2, float3 v3) { \
_RS_STATIC float3 __attribute__((overloadable)) \
        fnc(float3 v1, float3 v2, float3 v3) {  \
    float3 r;                                   \
    r.x = fnc(v1.x, v2.x, v3.x);                \
    r.y = fnc(v1.y, v2.y, v3.y);                \
    r.z = fnc(v1.z, v2.z, v3.z);                \
    return r;                                   \
}                                               \
_RS_STATIC float4 __attribute__((overloadable)) fnc(float4 v1, float4 v2, float4 v3) { \
_RS_STATIC float4 __attribute__((overloadable)) \
        fnc(float4 v1, float4 v2, float4 v3) {  \
    float4 r;                                   \
    r.x = fnc(v1.x, v2.x, v3.x);                \
    r.y = fnc(v1.y, v2.y, v3.y);                \
@@ -274,42 +282,44 @@ _RS_STATIC float4 __attribute__((overloadable)) fnc(float4 v1, float4 v2, float4
}

#define FN_FUNC_FN_FN_PIN(fnc)                  \
_RS_STATIC float2 __attribute__((overloadable)) fnc(float2 v1, float2 v2, int2 *v3) { \
_RS_STATIC float2 __attribute__((overloadable)) \
        fnc(float2 v1, float2 v2, int2 *v3) {   \
    float2 r;                                   \
    int q; \
    r.x = fnc(v1.x, v2.x, &q); \
    v3->x = q; \
    r.y = fnc(v1.y, v2.y, &q); \
    v3->y = q; \
    int t[2];                                   \
    r.x = fnc(v1.x, v2.x, &t[0]);               \
    r.y = fnc(v1.y, v2.y, &t[1]);               \
    v3->x = t[0];                               \
    v3->y = t[1];                               \
    return r;                                   \
}                                               \
_RS_STATIC float3 __attribute__((overloadable)) fnc(float3 v1, float3 v2, int3 *v3) { \
_RS_STATIC float3 __attribute__((overloadable)) \
        fnc(float3 v1, float3 v2, int3 *v3) {   \
    float3 r;                                   \
    int q; \
    r.x = fnc(v1.x, v2.x, &q); \
    v3->x = q; \
    r.y = fnc(v1.y, v2.y, &q); \
    v3->y = q; \
    r.z = fnc(v1.z, v2.z, &q); \
    v3->z = q; \
    int t[3];                                   \
    r.x = fnc(v1.x, v2.x, &t[0]);               \
    r.y = fnc(v1.y, v2.y, &t[1]);               \
    r.z = fnc(v1.z, v2.z, &t[2]);               \
    v3->x = t[0];                               \
    v3->y = t[1];                               \
    v3->z = t[2];                               \
    return r;                                   \
}                                               \
_RS_STATIC float4 __attribute__((overloadable)) fnc(float4 v1, float4 v2, int4 *v3) { \
_RS_STATIC float4 __attribute__((overloadable)) \
        fnc(float4 v1, float4 v2, int4 *v3) {   \
    float4 r;                                   \
    int q; \
    r.x = fnc(v1.x, v2.x, &q); \
    v3->x = q; \
    r.y = fnc(v1.y, v2.y, &q); \
    v3->y = q; \
    r.z = fnc(v1.z, v2.z, &q); \
    v3->z = q; \
    r.w = fnc(v1.w, v2.w, &q); \
    v3->w = q; \
    int t[4];                                   \
    r.x = fnc(v1.x, v2.x, &t[0]);               \
    r.y = fnc(v1.y, v2.y, &t[1]);               \
    r.z = fnc(v1.z, v2.z, &t[2]);               \
    r.w = fnc(v1.w, v2.w, &t[3]);               \
    v3->x = t[0];                               \
    v3->y = t[1];                               \
    v3->z = t[2];                               \
    v3->w = t[3];                               \
    return r;                                   \
}



extern float __attribute__((overloadable)) acos(float);
FN_FUNC_FN(acos)

@@ -420,39 +430,7 @@ _RS_STATIC float __attribute__((overloadable)) fract(float v, float *iptr) {
    iptr[0] = i;
    return fmin(v - i, 0x1.fffffep-1f);
}
_RS_STATIC float2 __attribute__((overloadable)) fract(float2 v, float2 *iptr) {
    float t[2];
    float2 r;
    r.x = fract(v.x, &t[0]);
    r.y = fract(v.y, &t[1]);
    iptr[0] = t[0];
    iptr[1] = t[1];
    return r;
}
_RS_STATIC float3 __attribute__((overloadable)) fract(float3 v, float3 *iptr) {
    float t[3];
    float3 r;
    r.x = fract(v.x, &t[0]);
    r.y = fract(v.y, &t[1]);
    r.z = fract(v.z, &t[2]);
    iptr[0] = t[0];
    iptr[1] = t[1];
    iptr[2] = t[2];
    return r;
}
_RS_STATIC float4 __attribute__((overloadable)) fract(float4 v, float4 *iptr) {
    float t[4];
    float4 r;
    r.x = fract(v.x, &t[0]);
    r.y = fract(v.y, &t[1]);
    r.z = fract(v.z, &t[2]);
    r.w = fract(v.w, &t[3]);
    iptr[0] = t[0];
    iptr[1] = t[1];
    iptr[2] = t[2];
    iptr[3] = t[3];
    return r;
}
FN_FUNC_FN_PFN(fract)

extern float __attribute__((overloadable)) frexp(float, int *);
FN_FUNC_FN_PIN(frexp)
@@ -650,30 +628,34 @@ XN_FUNC_YN(uint, fnc, uint) \
XN_FUNC_YN(int, fnc, int)

#define XN_FUNC_XN_XN_BODY(type, fnc, body)         \
_RS_STATIC type __attribute__((overloadable)) fnc(type v1, type v2) {           \
_RS_STATIC type __attribute__((overloadable))       \
        fnc(type v1, type v2) {                     \
    return body;                                    \
}                                                   \
_RS_STATIC type##2 __attribute__((overloadable)) fnc(type##2 v1, type##2 v2) {  \
_RS_STATIC type##2 __attribute__((overloadable))    \
        fnc(type##2 v1, type##2 v2) {               \
    type##2 r;                                      \
    r.x = fnc(v1.x, v2.x);                          \
    r.y = fnc(v1.y, v2.y);                          \
    return r;                                       \
}                                                   \
_RS_STATIC type##3 __attribute__((overloadable)) fnc(type##3 v1, type##3 v2) {  \
_RS_STATIC type##3 __attribute__((overloadable))    \
        fnc(type##3 v1, type##3 v2) {               \
    type##3 r;                                      \
    r.x = fnc(v1.x, v2.x);                          \
    r.y = fnc(v1.y, v2.y);                          \
    r.z = fnc(v1.z, v2.z);                          \
    return r;                                       \
}                                                   \
_RS_STATIC type##4 __attribute__((overloadable)) fnc(type##4 v1, type##4 v2) {  \
_RS_STATIC type##4 __attribute__((overloadable))    \
        fnc(type##4 v1, type##4 v2) {               \
    type##4 r;                                      \
    r.x = fnc(v1.x, v2.x);                          \
    r.y = fnc(v1.y, v2.y);                          \
    r.z = fnc(v1.z, v2.z);                          \
    r.w = fnc(v1.w, v2.w);                          \
    return r;                                       \
}                                                                           \
}

#define IN_FUNC_IN_IN_BODY(fnc, body) \
XN_FUNC_XN_XN_BODY(uchar, fnc, body)  \