FastLED 3.10.9
Loading...
Searching...
No Matches

◆ test_mulhi32_i32_4()

bool autoresearch::simd_check::test_mulhi32_i32_4 ( )
inline

Definition at line 537 of file AutoResearchSimd.h.

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