Issue 133182
Summary clang-cl does not support MSVC x86(64) div intrinsics
Labels new issue
Assignees
Reporter davidben
    MSVC has intrinsics corresponding to the x86 DIV instruction:
https://learn.microsoft.com/en-us/cpp/intrinsics/udiv64?view=msvc-170
https://learn.microsoft.com/en-us/cpp/intrinsics/udiv128?view=msvc-170
https://learn.microsoft.com/en-us/cpp/intrinsics/div64?view=msvc-170
https://learn.microsoft.com/en-us/cpp/intrinsics/div128?view=msvc-170

These operations (well, the unsigned ones) are useful in implementing big integer arithmetic. Sadly, clang-cl does not seem to support them. (I'm having to special-case clang-cl from MSVC in some code right now.)

Even with a clang-cl special case, these are not easily accessible from LLVM without inline asm, from what I can tell, because the x86 instructions trap when the quotient doesn't fit in a single word. A priori, trying to divide, say, uint128_t by uint64_t may give a 128-bit result.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to