Ignore:
Timestamp:
Sep 4, 2011, 12:05:57 AM (12 years ago)
Author:
sam
Message:

core: implement accelerated cos().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/lol-bench.cpp

    r890 r897  
    7575static void bench_trig(int mode)
    7676{
    77     float result[5] = { 0.0f };
     77    float result[7] = { 0.0f };
    7878    Timer timer;
    7979
     
    128128        result[3] += timer.GetMs();
    129129
     130        /* Fast cos */
     131        timer.GetMs();
     132        for (size_t i = 0; i < TRIG_TABLE_SIZE; i++)
     133#if defined HAVE_FASTMATH_H
     134            pf2[i] = f_cosf(pf[i]);
     135#else
     136            pf2[i] = cosf(pf[i]);
     137#endif
     138        result[4] += timer.GetMs();
     139
     140        /* Lol cos */
     141        timer.GetMs();
     142        for (size_t i = 0; i < TRIG_TABLE_SIZE; i++)
     143            pf2[i] = lol_cos(pf[i]);
     144        result[5] += timer.GetMs();
     145
    130146        /* Tan */
    131147        timer.GetMs();
    132148        for (size_t i = 0; i < TRIG_TABLE_SIZE; i++)
    133149            pf2[i] = __builtin_tanf(pf[i]);
    134         result[4] += timer.GetMs();
     150        result[6] += timer.GetMs();
    135151    }
    136152
     
    146162    Log::Info("float = lol_sinf(float)  %7.3f\n", result[2]);
    147163    Log::Info("float = cosf(float)      %7.3f\n", result[3]);
    148     Log::Info("float = tanf(float)      %7.3f\n", result[4]);
     164    Log::Info("float = fastcosf(float)  %7.3f\n", result[4]);
     165    Log::Info("float = lol_cosf(float)  %7.3f\n", result[5]);
     166    Log::Info("float = tanf(float)      %7.3f\n", result[6]);
    149167}
    150168
Note: See TracChangeset for help on using the changeset viewer.