FastLED 3.9.15
Loading...
Searching...
No Matches

◆ test_mulhi32_i32_4()

bool autoresearch::simd_check::test_mulhi32_i32_4 ( )
inline

Definition at line 536 of file AutoResearchSimd.h.

536 {
537 // mulhi32_i32_4: ((i64)a * (i64)b) >> 32
538 // Test: 0x40000000 * 0x40000000 >> 32 = 0x10000000
539 uint32_t a[4] = {0x40000000, as_u32(-0x40000000), 0x7FFFFFFF, 0x00000001};
540 uint32_t b[4] = {0x40000000, 0x40000000, 0x00000002, 0x7FFFFFFF};
541 uint32_t output[4] = {0};
542 store_u32_4(output, mulhi32_i32_4(load_u32_4(a), load_u32_4(b)));
543 if (output[0] != 0x10000000) return false; // 0.5 * 0.5 = 0.25 (Q31)
544 if (as_i32(output[1]) != as_i32(0xF0000000)) return false; // -0.5 * 0.5 = -0.25
545 if (output[2] != 0x00000000) return false; // small * small -> 0
546 if (output[3] != 0x00000000) return false; // 1 * MAX -> 0 (high bits only)
547 return true;
548}
uint32_t as_u32(int32_t v)
int32_t as_i32(uint32_t v)

References as_i32(), and as_u32().

Referenced by getTests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: