MCPcopy Create free account
hub / github.com/FastLED/FastLED / benchSimd4

Function benchSimd4

examples/AutoResearch/AutoResearchSimd.h:1162–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1160// Helper: time s16x16x4 SIMD with a binary op
1161template <typename Op>
1162inline int64_t benchSimd4(int iters, Op op) {
1163 fl::s16x16x4 a = fl::s16x16x4::from_raw(
1164 set_u32_4(as_u32(fl::s16x16(1.5f).raw()), as_u32(fl::s16x16(2.3f).raw()),
1165 as_u32(fl::s16x16(0.7f).raw()), as_u32(fl::s16x16(3.1f).raw())));
1166 fl::s16x16x4 b = fl::s16x16x4::from_raw(
1167 set_u32_4(as_u32(fl::s16x16(0.5f).raw()), as_u32(fl::s16x16(1.2f).raw()),
1168 as_u32(fl::s16x16(2.0f).raw()), as_u32(fl::s16x16(0.9f).raw())));
1169 fl::s16x16x4 bump = fl::s16x16x4::set1(fl::s16x16::from_raw(1));
1170 uint32_t t0 = micros();
1171 for (int i = 0; i < iters; i++) {
1172 a = op(a, b);
1173 b = a + bump;
1174 }
1175 uint32_t t1 = micros();
1176 g_bench_sink = extract_u32_4(a.raw, 0);
1177 return static_cast<int64_t>(t1 - t0);
1178}
1179
1180struct OpAdd {
1181 template<typename T> T operator()(T a, T b) const { return a + b; }

Callers 1

runMultiplyBenchmarkFunction · 0.85

Calls 4

as_u32Function · 0.85
s16x16Class · 0.50
microsFunction · 0.50
rawMethod · 0.45

Tested by

no test coverage detected