Visual C++ 中的 128 位除法内在 [英] 128-bit division intrinsic in Visual C++

查看:22
本文介绍了Visual C++ 中的 128 位除法内在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 Visual C++ 中是否真的没有 128 位除法内在函数?

I'm wondering if there really is no 128-bit division intrinsic function in Visual C++?

有一个名为 _umul128() 的 64x64=128 位乘法内在函数,它很好地匹配了 MUL x64 汇编指令.

There is a 64x64=128 bit multiplication intrinsic function called _umul128(), which nicely matches the MUL x64 assembler instruction.

当然,我假设也会有一个 128/64=64 位的内在除法(模拟 DIV 指令),但令我惊讶的是,Visual C++ 和 Intel C++ 似乎都没有,至少它没有在 intrin.h 中列出.

Naturally, I assumed there would be a 128/64=64 bit division intrinsic as well (modelling the DIV instruction), but to my amazement neither Visual C++ nor Intel C++ seem to have it, at least it's not listed in intrin.h.

有人可以确认吗?我尝试对编译器可执行文件中的函数名称进行 grep'ing,但首先找不到 _umul128,所以我想我找错了地方.

Can someone confirm that? I tried grep'ing for the function names in the compiler executable files, but couldn't find _umul128 in the first place, so I guess I looked in the wrong spot.

更新:至少我现在在 Visual C++ 2010 的 c1.dll 中找到了模式 umul128(没有前导下划线).所有其他内在函数都列在它周围,但不幸的是没有udiv128"之类的 :( 所以他们似乎真的忘记"了实施它.

Update: at least I have now found the pattern umul128 (without the leading underscore) in c1.dll of Visual C++ 2010. All the other intrinsics are listed around it, but unfortunately no "udiv128" or the like :( So it seems they really have "forgotten" to implement it.

澄清:我不仅要寻找 128 位数据类型,还要寻找一种在 C++ 中将 128 位标量 int 除以 64 位 int 的方法.内在函数本机 128位整数支持都可以解决我的问题.

To clarify: I'm not only looking for a 128-bit data type, but a way to divide a 128-bit scalar int by a 64-bit int in C++. Either an intrinsic function or native 128-bit integer support would solve my problem.

答案是否定的,直到 2017 年,Visual Studio 2010 中没有 _udiv128 内在函数,但它在 Visual Studio 2019 RTM 中可用

The answer is no, there is no _udiv128 intrinsic in Visual Studio 2010 up to 2017, but it is available in Visual Studio 2019 RTM

推荐答案

我不是专家,但我挖了这个:

I am no expert, but I dug this up:

http://research.swtch.com/2008/01/除法通过乘法.html

有趣的东西.希望有帮助.

Interesting stuff. Hope it helps.

这也很有见地:http://www.gamedev.net/topic/508197-x64-div-intrinsic/

这篇关于Visual C++ 中的 128 位除法内在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆