| 449 | } |
| 450 | |
| 451 | inline bool test_sra_i32_4() { |
| 452 | // Arithmetic shift preserves sign bit |
| 453 | uint32_t input[4] = {as_u32(-16), as_u32(16), 0x80000000, 0x7FFFFFFF}; |
| 454 | uint32_t output[4] = {0}; |
| 455 | store_u32_4(output, sra_i32_4(load_u32_4(input), 2)); |
| 456 | if (as_i32(output[0]) != -4) return false; // -16 >> 2 = -4 (sign-extended) |
| 457 | if (as_i32(output[1]) != 4) return false; // 16 >> 2 = 4 |
| 458 | if (as_i32(output[2]) != as_i32(0xE0000000)) return false; // 0x80000000 >> 2 sign-extended |
| 459 | if (as_i32(output[3]) != as_i32(0x1FFFFFFF)) return false; // 0x7FFFFFFF >> 2 |
| 460 | return true; |
| 461 | } |
| 462 | |
| 463 | // ============================================================================ |
| 464 | // i32x4 Min/Max Tests (signed) |