- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On the intrinsics reference site, the _subborrow_u64() intrinsic says it computes "b - a". But in both ICC and MSVC, the intrinsic does "a - b".
So the documentation contradicts what the intrinsic actually does in ICC and MSVC. Unfortunately, GCC's implementation of the intrinsic follows the documentation rather than ICC/MSVC's behavior. And this is causing a bit of a headache when porting some Windows code to Linux/GCC.
The following code prints 23 in ICC/MSVC. But it prints 18446744073709551593 in GCC. I don't know who's "right" or "wrong", but this inconsistency should probably be fixed.
#include <stdint.h> #include <iostream> using namespace std; #if __GNUC__ #include <x86intrin.h> #else #include <intrin.h> #endif int main(){ unsigned char carry = 0; uint64_t a = 123; uint64_t b = 100; uint64_t c; carry = _subborrow_u64(carry, a, b, (unsigned long long*)&c); cout << c << endl; system("pause"); }
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Alex, I'll look into this and update you accordingly and could be an issue in the doc, thanks.
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alex,
Thanks for bringing this to our attention, much appreciated. Yes, the documentation needs to be fixed and apparently GCC too. I do find that the word description is correct in the doc but the formula is apparently not right. I'll file an issue with the documentation team. I'll also keep you updated as soon as the release with the fix is out - appreciate much.
Regards,
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alex, the issue filed is DPD200410409 and will keep you updated as soon as the release with the fix is out, thanks.
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please fix this page too.
https://software.intel.com/en-us/node/523869
It is also wrong but in different way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Michael,
Yes, will do. Thanks for letting me know and I've already passed on that info as well to the doc team - appreciate much.
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One month later: nothing done.
You are not very quick, guys :(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Michael,
Yes, I notice that it's not in the update 2 version :-( I've again pinged the doc team to find out as the issue is being addressed per notes in the tracker. I'll update you as soon as I hear from the team.
Thanks,
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 months later: nothing done.
I am starting to suspect that it will never be fixed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 months later: Intel Intrinsics Guide is finally fixed.
I didn't check if the fix propagated to the latest gcc.
"Intel® C++ Compiler 17.0 Developer Guide and Reference" is correct.
https://software.intel.com/en-us/node/683526
"Intel® C++ Compiler 16.0 User and Reference Guide" is correct.
https://software.intel.com/en-us/node/694996
But "User and Reference Guide for the Intel® C++ Compiler 15.0" is still wrong.
https://software.intel.com/en-us/node/523869

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page