This is a list of x64 intrinsics used in many popular codebases but is lacking an ARM64 implementation and an alternative MSVC intrinsics.
An alternative ARM64 implementation in C is provided to help developers port code for windows arm64 targets.
Intrinsics / Windows API | Description | ARM64 alternative implementation | |
---|---|---|---|
1 | 128-bit unsigned multiplication | #pragma intrinsic(__umulh) uint64_t _umul128(uint64_t a, uint64_t b, uint64_t *high) { *high = __umulh(a, b); return a * b; } | |
2 | |||
3 | 64-bit add with carry returning the carry flag | uint64_t addcarry(uint64_t x, uint64_t y, uint64_t carry_in, uint64_t *sum) { *sum = x + y + (carry_in !=0 ? 1 : 0); return a > UINT32_MAX - b; } | |
4 | Processor time stamp - Number of clock cycles since reset | int64_t processor_cycle_count() { const int64_t pmccntr_el0 = (((3 & 1) << 14) | // op0 ((3 & 7) << 11) | // op1 ((9 & 15) << 7) | // crn ((13 & 15) << 3) | // crm ((0 & 7) << 0)); // op2 return _ReadStatusReg (pmccntr_el0); } | |
5 | __popcnt and variants | Counts the number of |