MCPcopy Create free account
hub / github.com/MegEngine/MegCC / GiMultiplyInt8

Function GiMultiplyInt8

immigration/include/gi_int.h:519–536  ·  view source on GitHub ↗

in x86, there is no int multiply, so implement it naive

Source from the content-addressed store, hash-verified

517}
518//! in x86, there is no int multiply, so implement it naive
519GI_FORCEINLINE
520GI_INT8_t GiMultiplyInt8(GI_INT8_t Vector1, GI_INT8_t Vector2) {
521#if defined(GI_NEON_INTRINSICS)
522 return vmulq_s8(Vector1, Vector2);
523#elif defined(GI_SSE2_INTRINSICS)
524 int8_t v1[16], v2[16], res[16];
525 _mm_storeu_si128((__m128i*)v1, Vector1);
526 _mm_storeu_si128((__m128i*)v2, Vector2);
527 for (size_t id = 0; id < 16; id++) {
528 res[id] = v1[id] * v2[id];
529 }
530 return _mm_loadu_si128((__m128i*)res);
531#elif defined(GI_RVV_INTRINSICS)
532 return vmul_vv_i8m1(Vector1, Vector2, GI_SIMD_LEN_BYTE / sizeof(int8_t));
533#else
534 return Vector1 * Vector2;
535#endif
536}
537
538GI_FORCEINLINE
539GI_INT32_t GiMultiplyAddInt32(

Callers 1

GiMultiplyAddInt8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected