Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with MSVC caused by adcx (Intel ADX) #10

Closed
Koromix opened this issue Aug 13, 2020 · 1 comment
Closed

Crash with MSVC caused by adcx (Intel ADX) #10

Koromix opened this issue Aug 13, 2020 · 1 comment

Comments

@Koromix
Copy link

Koromix commented Aug 13, 2020

I've made some tests with MSVC and got a crash on ADCX instruction. My CPU predates Intel ADX (introduced in Broadwell). But it seems like ADC can be used instead.

diff --git a/grisu_exact.h b/grisu_exact.h
index 4d99f8a89..d8b69fcea 100644
--- a/grisu_exact.h
+++ b/grisu_exact.h
@@ -145,8 +145,8 @@ namespace jkj {
 
 #if defined(_MSC_VER) && defined(_M_X64)
 			std::uint64_t high, low;
-			auto carry = _addcarryx_u64(0, g0.low(), g10, &low);
-			_addcarryx_u64(carry, g0.high(), 0, &high);
+			auto carry = _addcarry_u64(0, g0.low(), g10, &low);
+			_addcarry_u64(carry, g0.high(), 0, &high);
 			return high;
 #elif (defined(__GNUC__) || defined(__clang__)) && defined(__SIZEOF_INT128__) && defined(__x86_64__)
 			return uint128{ g0.internal_ + g10 }.high();
@jk-jeon
Copy link
Owner

jk-jeon commented Aug 13, 2020

Yeah, I thought ADCX should perform better than ADC, but it seems not. I'll commit the patch you suggested.

@jk-jeon jk-jeon closed this as completed Aug 13, 2020
jk-jeon added a commit that referenced this issue Aug 13, 2020
jk-jeon added a commit that referenced this issue Aug 13, 2020
jk-jeon added a commit that referenced this issue Aug 13, 2020
This reverts commit da29192.
jk-jeon added a commit that referenced this issue Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants