| 1124 | // Helper: time 4-wide scalar float with a binary op |
| 1125 | template <typename Op> |
| 1126 | inline int64_t benchFloat4(int iters, Op op) { |
| 1127 | float a0 = 1.5f, a1 = 2.3f, a2 = 0.7f, a3 = 3.1f; |
| 1128 | float b0 = 0.5f, b1 = 1.2f, b2 = 2.0f, b3 = 0.9f; |
| 1129 | uint32_t t0 = micros(); |
| 1130 | for (int i = 0; i < iters; i++) { |
| 1131 | a0 = op(a0, b0); a1 = op(a1, b1); |
| 1132 | a2 = op(a2, b2); a3 = op(a3, b3); |
| 1133 | b0 = a0 + 0.001f; b1 = a1 + 0.001f; |
| 1134 | b2 = a2 + 0.001f; b3 = a3 + 0.001f; |
| 1135 | } |
| 1136 | uint32_t t1 = micros(); |
| 1137 | uint32_t tmp; fl::memcpy(&tmp, &a0, sizeof(tmp)); |
| 1138 | g_bench_sink = tmp; |
| 1139 | return static_cast<int64_t>(t1 - t0); |
| 1140 | } |
| 1141 | |
| 1142 | // Helper: time 4-wide scalar s16x16 with a binary op |
| 1143 | template <typename Op> |
no test coverage detected