Closed etcimon closed 4 years ago
Looking at that wmmintrin.d, it looks like the simplest solution is to import the gcc/gdc-compatible builtins from ldc.gccbuiltins_x86
and enabling the version(GDC)
path for LDC too.
_rdrand32_step
could look something like this:
int _rdrand32_step(uint* r)
{
import ldc.llvmasm;
const ret = __asm!uint("rdrandl $1", "=r,r", 0);
if (ret != 0)
{
*r = ret;
return 1;
}
return 0;
}
Are you eventually going to remove this?
version(LDC) {
pragma(LDC_intrinsic, "llvm.x86.rdrand.32")
int _rdrand32_step(uint*);
}
Remove from where? We don't declare that anywhere, so if you're asking whether LLVM is going to remove that at some point - I don't think anytime soon. Btw, the proper usage for that intrinsic would look something like this (and require -mattr=+rdrnd
in LDC cmdline):
int _rdrand32_step(uint* r)
{
import ldc.llvmasm;
return __irEx!(
"declare { i32, i32 } @llvm.x86.rdrand.32()",
`%r = call { i32, i32 } @llvm.x86.rdrand.32()
%r1 = extractvalue { i32, i32 } %r, 0
store i32 %r1, i32* %0, align 4
%r2 = extractvalue { i32, i32 } %r, 1
ret i32 %r2`,
"",
int, uint*)(r);
}
Thanks for that, I'm still learning a lot about LDC. I'm trying to add the builtin now and it compiles fine until a strange error, is that from LLVM?
version(LDC){
import ldc.gccbuiltins_x86;
__m128i _mm_clmulepi64_si128(string imm)(__vector(byte[16]) a, __vector(byte[16]) b) {
mixin(`return cast(__m128i) __builtin_ia32_pclmulqdq128(a, b, `~ imm ~`);`);
}
}
LLVM ERROR: Cannot select: intrinsic %llvm.x86.pclmulqdq
Make sure to specify the required arch features via -mattr
. Use -mattr=help
for help, or simply use -mcpu=native
for now.
Looks good enough but I think the asm engine needs some work if this compiles on DMD and not on LDC? I think my library might be good enough to put it up to par, what do you think a good bounty would be for that?
Here is where you can claim the bounty for this specific method call:
I consider DMD-style inline asm as legacy. We have some support for it via a piece originating from GDC, but GDC has removed it in the meantime. A much more worthwhile and useful direction would IMO be support for GDC-style inline asm, essentially giving our __asm
templates a built-in syntax which is arguably nicer and, most importantly, compatible with GDC. Then DMD-style inline asm with its limitations would hopefully slowly become phased out as legacy construct.
Then DMD-style inline asm with its limitations would hopefully slowly become phased out as legacy construct.
This seems a bit odd, wouldn't LDC be better off being fully compatible with code written for DMD?
This is my POV for the language, long-term; a totally x86-centric asm, without clobber constraints and clear value-register binding is misplaced in any future-proof language. Iain brought the regular gcc-style inline asm syntax to D in GDC, and LDC currently supports it in a somewhat awkward syntax via __asm. For non-naked DMD-style inline asm, we need a legacy parser to internally convert it to gcc-style asm for LLVM (edit: that's the part not supporting these data definition directives yet)... So long-term, I'd very much prefer DMD-style inline asm to be replaced by the generic GDC syntax, which is equivalent to gcc's in the C(++) world, and DMD to follow suit.
So I think I agree with you and hopefully the DigitalMars ASM can also be replaced with GCC-style first in DMD. I'll look into writing GDC style but do you think the legacy parser could be doable within reasonable time?
The parser would probably just have to be slightly extended, so I guess it's doable, but it's a black box for me, I've never really looked into that monstrous https://github.com/ldc-developers/ldc/blob/master/gen/asm-x86.h.
Ok so I added an extra $2000 to the bounty with the aim to get Digital Mars ASM up to par in LDC
Oh wow, that kind of money might also motivate someone to implement GDC-style asm for DMD. ;) (Supporting it in LDC should be pretty straight-forward).
Yes, my main motivation on the long run would be adding ldc support to Botan and making it work with android/ios ARM too without too much work
{db,ds,di,dl}
should work with #3301. I've used the rdrand example, compiled & linked it to an executable, then disassembled the executable, and rdrandl %eax
was in there.
That should settle the first $200 bounty if it works ! The rest would go through once the dmd asm support give us the botan-math tests in LDC. Do you happen to know something about android/ios support in LDC?
I'll look into what's still missing for the whole botan-math testsuite (I could use some money atm...).
Wrt. Android, the support is apparently pretty good/usable (but requires an official LDC package from GitHub, no distro packages). I just set up CI and automated package generation via cross-compilation from x64, but have never fired up a simulator or run anything on a native device though.
Wrt. iOS, that seems to finally land (probably restricted to AArch64), see Jacob's recent #3288.
Don't expect proper C(++) ABI support and support for C-style variadic functions though.
Wrt. the botan testsuite, these are my results on Win64, with #3301 and a one-lix fix-up in botan-math (here: EDI
=> RDI
):
Running .\botan-test-full.exe
D: Testing tls/test.d ...
E: Certificate verification failed - Certificate validation failure: Certificate issuer not found - but will ignore
E: Certificate verification failed - Certificate validation failure: Certificate issuer not found - but will ignore
E: Certificate verification failed - Certificate validation failure: Certificate issuer not found - but will ignore
D: TLS ... PASSED (all of 4 tests in 0 msecs)
D: Testing stream_cipher.d ...
D: ChaCha(8) ... PASSED (all of 19 tests in 0 msecs)
D: ChaCha(12) ... PASSED (all of 2 tests in 0 msecs)
D: ChaCha(20) ... PASSED (all of 7 tests in 1 msecs)
D: CTR-BE(DES) ... PASSED (all of 13 tests in 4 msecs)
D: CTR-BE(AES-128) ... PASSED (all of 4 tests in 1 msecs)
D: CTR-BE(AES-192) ... PASSED (all of 1 tests in 1 msecs)
D: CTR-BE(AES-256) ... PASSED (all of 1 tests in 0 msecs)
D: CTR-BE(TripleDES) ... PASSED (all of 149 tests in 93 msecs)
D: CTR-BE(Serpent) ... PASSED (all of 111 tests in 146 msecs)
D: CTR-BE(Noekeon) ... PASSED (all of 128 tests in 100 msecs)
D: CTR-BE(TEA) ... PASSED (all of 57 tests in 19 msecs)
D: CTR-BE(XTEA) ... PASSED (all of 57 tests in 23 msecs)
D: OFB(DES) ... PASSED (all of 4 tests in 0 msecs)
D: OFB(AES-128) ... PASSED (all of 1 tests in 0 msecs)
D: OFB(AES-192) ... PASSED (all of 1 tests in 0 msecs)
D: OFB(AES-256) ... PASSED (all of 1 tests in 0 msecs)
D: RC4 ... PASSED (all of 69 tests in 11 msecs)
D: MARK-4 ... PASSED (all of 5 tests in 1 msecs)
D: Salsa20 ... PASSED (all of 7 tests in 1 msecs)
D: stream ... PASSED (all of 637 tests in 0 msecs)
D: Testing rng/test.d ...
D: HMAC_DRBG(SHA-1) ... PASSED (all of 120 tests in 31 msecs)
D: HMAC_DRBG(SHA-224) ... PASSED (all of 120 tests in 36 msecs)
D: HMAC_DRBG(SHA-256) ... PASSED (all of 120 tests in 36 msecs)
D: HMAC_DRBG(SHA-384) ... PASSED (all of 120 tests in 44 msecs)
D: HMAC_DRBG(SHA-512) ... PASSED (all of 120 tests in 45 msecs)
D: X9.31-RNG(AES-128) ... PASSED (all of 128 tests in 3 msecs)
D: X9.31-RNG(AES-192) ... PASSED (all of 128 tests in 3 msecs)
D: X9.31-RNG(AES-256) ... PASSED (all of 128 tests in 3 msecs)
D: X9.31-RNG(TripleDES) ... PASSED (all of 128 tests in 4 msecs)
D: rng ... PASSED (all of 1112 tests in 0 msecs)
D: Testing x509_key ...
E: FAILED: User cert #1 did not validate - Certificate issuer not found
E: FAILED: User cert #2 did not validate - Certificate issuer not found
E: FAILED: User cert #1 was not revoked - Certificate issuer not found
E: FAILED: User cert #2 was not revoked - Certificate issuer not found
E: FAILED: User cert #1 was not un-revoked - Certificate issuer not found
E: X509_key ... 5 / 5 ************** FAILED ****************
D: Testing rw.d ...
D: RW Signature ... PASSED (all of 19 tests in 1488 msecs)
D: RW Verify ... PASSED (all of 9 tests in 7 msecs)
D: rw ... PASSED (all of 29 tests in 0 msecs)
D: Testing rsa.d ...
D: RSA Encryption ... PASSED (all of 123 tests in 5964 msecs)
D: RSA Signature ... PASSED (all of 110 tests in 5234 msecs)
D: RSA Verify ... PASSED (all of 27 tests in 19 msecs)
D: rsa ... PASSED (all of 262 tests in 0 msecs)
D: Testing rfc6979.d ...
D: RFC 6979 ... PASSED (all of 2 tests in 0 msecs)
D: Testing nr.d ...
D: NR Signature ... PASSED (all of 12 tests in 468 msecs)
D: nr ... PASSED (all of 15 tests in 8583 msecs)
D: Testing gost_3410.d ...
D: GOST-34.10 Signature ... PASSED (all of 3 tests in 218 msecs)
D: gost_3410 ... PASSED (all of 12 tests in 0 msecs)
D: Testing elgamal.d ...
D: ElGamal Encryption ... PASSED (all of 10 tests in 10087 msecs)
D: elg ... PASSED (all of 14 tests in 0 msecs)
D: Testing ecdsa.d ...
D: ECDSA Signature ... PASSED (all of 15 tests in 2708 msecs)
D: ECC Point Mult ... PASSED (all of 5 tests in 45 msecs)
D: ECDSA ... PASSED (all of 88 tests in 0 msecs)
D: Testing ecdh.d ...
D: ECDH ... PASSED (all of 6 tests in 196 msecs)
D: Testing dsa.d ...
D: DSA Signature ... PASSED (all of 11 tests in 449 msecs)
D: dsa ... PASSED (all of 14 tests in 8791 msecs)
D: Testing dlies.d ...
D: DLIES Encryption ... PASSED (all of 6 tests in 395 msecs)
D: dlies ... PASSED (all of 6 tests in 0 msecs)
D: Testing dh.d ...
D: DH Kex ... PASSED (all of 12 tests in 5455 msecs)
D: 1) Load private key
D: 2) Check private key
D: 3) Validate
D: 1) Load private key
D: 2) Check private key
D: 3) Validate
D: 1) Load private key
D: 2) Check private key
D: 3) Validate
D: 1) Load private key
D: 2) Check private key
D: 3) Validate
D: DH ... PASSED (all of 16 tests in 31532 msecs)
D: Testing curve25519.d ...
D: Curve25519 ScalarMult ... PASSED (all of 18 tests in 21 msecs)
D: curve25519 ... PASSED (all of 19 tests in 573 msecs)
D: Testing hkdf.d ...
D: HKDF(SHA-256) ... PASSED (all of 3 tests in 1 msecs)
D: HKDF(SHA-1) ... PASSED (all of 4 tests in 1 msecs)
D: hkdf ... PASSED (all of 7 tests in 0 msecs)
D: Testing pbkdf.d ...
D: PBKDF1(MD2) ... PASSED (all of 4 tests in 15 msecs)
D: PBKDF1(SHA-1) ... PASSED (all of 5 tests in 53 msecs)
D: PBKDF2(SHA-1) ... PASSED (all of 10 tests in 324 msecs)
D: PBKDF2(CMAC(Blowfish)) ... PASSED (all of 1 tests in 1 msecs)
D: pbkdf ... PASSED (all of 20 tests in 0 msecs)
D: Testing passhash9.d ...
D: Passhash9 ... PASSED (all of 6 tests in 4145 msecs)
D: Testing bcrypt.d ...
D: Bcrypt ... PASSED (all of 6 tests in 37 msecs)
D: Testing cipher_mode.d ...
D: DES/CBC/NoPadding ... PASSED (all of 1 tests in 1 msecs)
D: DES/CBC/PKCS7 ... PASSED (all of 33 tests in 3 msecs)
D: RC5(8)/CBC/PKCS7 ... PASSED (all of 2 tests in 0 msecs)
D: Noekeon/CBC/PKCS7 ... PASSED (all of 128 tests in 13 msecs)
D: DES/CBC/OneAndZeros ... PASSED (all of 35 tests in 3 msecs)
D: DES/CBC/CTS ... PASSED (all of 42 tests in 4 msecs)
D: AES-128/CBC/NoPadding ... PASSED (all of 1 tests in 0 msecs)
D: AES-192/CBC/NoPadding ... PASSED (all of 1 tests in 1 msecs)
D: AES-256/CBC/NoPadding ... PASSED (all of 1 tests in 0 msecs)
D: DES/CFB ... PASSED (all of 20 tests in 2 msecs)
D: DES/CFB(32) ... PASSED (all of 7 tests in 0 msecs)
D: DES/CFB(16) ... PASSED (all of 6 tests in 0 msecs)
D: DES/CFB(8) ... PASSED (all of 10 tests in 1 msecs)
D: AES-128/CFB(8) ... PASSED (all of 1 tests in 0 msecs)
D: AES-192/CFB(8) ... PASSED (all of 1 tests in 0 msecs)
D: AES-256/CFB(8) ... PASSED (all of 1 tests in 0 msecs)
D: AES-128/CFB ... PASSED (all of 1 tests in 0 msecs)
D: AES-192/CFB ... PASSED (all of 1 tests in 0 msecs)
D: AES-256/CFB ... PASSED (all of 1 tests in 0 msecs)
D: AES-128/ECB/NoPadding ... PASSED (all of 1 tests in 0 msecs)
D: Serpent/ECB/NoPadding ... PASSED (all of 1 tests in 1 msecs)
D: IDEA/ECB/NoPadding ... PASSED (all of 1 tests in 0 msecs)
D: DES/ECB/NoPadding ... PASSED (all of 2 tests in 1 msecs)
D: DES/ECB/PKCS7 ... PASSED (all of 21 tests in 1 msecs)
D: DES/ECB/OneAndZeros ... PASSED (all of 25 tests in 2 msecs)
D: TEA/ECB/NoPadding ... PASSED (all of 31 tests in 3 msecs)
D: XTEA/ECB/NoPadding ... PASSED (all of 31 tests in 3 msecs)
D: AES-128/XTS ... PASSED (all of 61 tests in 7 msecs)
D: AES-256/XTS ... PASSED (all of 45 tests in 5 msecs)
D: Twofish/XTS ... PASSED (all of 240 tests in 48 msecs)
D: Serpent/XTS ... PASSED (all of 242 tests in 47 msecs)
D: TripleDES/XTS ... PASSED (all of 128 tests in 15 msecs)
D: cipher_mode ... PASSED (all of 2244 tests in 0 msecs)
D: Testing ocb.d ...
D: OCB long ... PASSED (all of 9 tests in 132 msecs)
D: Testing aead.d ...
D: AES-128/CCM(8,2) ... PASSED (all of 3 tests in 1 msecs)
D: AES-128/CCM(10,2) ... PASSED (all of 1 tests in 0 msecs)
D: AES-128/CCM(16,2) ... PASSED (all of 2 tests in 0 msecs)
D: AES-128/CCM(16,3) ... PASSED (all of 1 tests in 0 msecs)
D: ChaCha20Poly1305 ... PASSED (all of 7 tests in 1 msecs)
D: AES-128/EAX(8) ... PASSED (all of 2 tests in 1 msecs)
D: AES-128/EAX ... PASSED (all of 78 tests in 21 msecs)
D: Blowfish/EAX ... PASSED (all of 17 tests in 17 msecs)
D: RC5/EAX ... PASSED (all of 17 tests in 10 msecs)
D: RC6/EAX ... PASSED (all of 33 tests in 35 msecs)
D: Twofish/EAX ... PASSED (all of 33 tests in 60 msecs)
D: SAFER-SK(10)/EAX ... PASSED (all of 17 tests in 27 msecs)
D: RC2/EAX ... PASSED (all of 17 tests in 27 msecs)
D: DES/EAX ... PASSED (all of 17 tests in 16 msecs)
D: TripleDES/EAX ... PASSED (all of 17 tests in 37 msecs)
D: Threefish-512/EAX ... PASSED (all of 1 tests in 3 msecs)
D: AES-128/GCM ... PASSED (all of 7 tests in 2 msecs)
D: AES-128/GCM(8) ... PASSED (all of 1 tests in 1 msecs)
D: AES-128/OCB ... PASSED (all of 25 tests in 4 msecs)
D: AES-128/OCB(12) ... PASSED (all of 1 tests in 0 msecs)
D: AES-128/SIV ... PASSED (all of 2 tests in 1 msecs)
D: Test report
D: aead ... PASSED (all of 1495 tests in 0 msecs)
D: Testing ec_gfp/test.d ...
D: ECC ... PASSED (all of 6407 tests in 24776 msecs)
D: Testing bigint/test.d ...
D: Bigint Addition ... PASSED (all of 73 tests in 39 msecs)
D: Bigint Subtraction ... PASSED (all of 63 tests in 26 msecs)
D: Bigint Multiplication ... PASSED (all of 105 tests in 77 msecs)
D: Bigint Square ... PASSED (all of 21 tests in 3 msecs)
D: Bigint LeftShift ... PASSED (all of 50 tests in 20 msecs)
D: Bigint RightShift ... PASSED (all of 51 tests in 12 msecs)
D: Bigint Division ... PASSED (all of 36 tests in 14 msecs)
D: Bigint Modulo ... PASSED (all of 72 tests in 21 msecs)
D: Bigint ModExp ... PASSED (all of 125 tests in 5187 msecs)
D: Bigint PrimeTest ... PASSED (all of 21 tests in 86 msecs)
D: BigInt ... PASSED (all of 617 tests in 0 msecs)
D: Testing mac.d ...
D: CBC-MAC(DES) ... PASSED (all of 33 tests in 1 msecs)
D: CBC-MAC(AES-128) ... PASSED (all of 48 tests in 2 msecs)
D: CMAC(AES-128) ... PASSED (all of 23 tests in 1 msecs)
D: CMAC(AES-192) ... PASSED (all of 6 tests in 0 msecs)
D: CMAC(AES-256) ... PASSED (all of 7 tests in 1 msecs)
D: CMAC(Blowfish) ... PASSED (all of 1 tests in 0 msecs)
D: CMAC(Threefish-512) ... PASSED (all of 1 tests in 0 msecs)
D: HMAC(HAS-160) ... PASSED (all of 6 tests in 1 msecs)
D: HMAC(MD5) ... PASSED (all of 4 tests in 0 msecs)
D: HMAC(SHA-1) ... PASSED (all of 6 tests in 1 msecs)
D: HMAC(RIPEMD-128) ... PASSED (all of 4 tests in 0 msecs)
D: HMAC(RIPEMD-160) ... PASSED (all of 4 tests in 1 msecs)
D: HMAC(SHA-256) ... PASSED (all of 5 tests in 0 msecs)
D: Poly1305 ... PASSED (all of 78 tests in 3 msecs)
D: SSL3-MAC(MD5) ... PASSED (all of 3 tests in 0 msecs)
D: SSL3-MAC(SHA-1) ... PASSED (all of 3 tests in 1 msecs)
D: X9.19-MAC ... PASSED (all of 6 tests in 0 msecs)
D: mac ... PASSED (all of 714 tests in 0 msecs)
D: Testing kdf.d ...
D: KDF1(SHA-1) ... PASSED (all of 5 tests in 1 msecs)
D: KDF2(SHA-1) ... PASSED (all of 76 tests in 2 msecs)
D: SSL3-PRF ... PASSED (all of 33 tests in 2 msecs)
D: TLS-PRF ... PASSED (all of 32 tests in 2 msecs)
D: X9.42-PRF(KeyWrap.TripleDES) ... PASSED (all of 1 tests in 0 msecs)
D: X9.42-PRF(KeyWrap.RC2) ... PASSED (all of 1 tests in 1 msecs)
D: X9.42-PRF(1.2.840.113549.1.9.16.3.6) ... PASSED (all of 1 tests in 0 msecs)
D: kdf ... PASSED (all of 149 tests in 0 msecs)
D: Testing hash.d ...
D: Adler32 ... PASSED (all of 31 tests in 1 msecs)
D: Comb4P(MD4,MD5) ... PASSED (all of 1 tests in 1 msecs)
D: Comb4P(SHA-1,RIPEMD-160) ... PASSED (all of 1 tests in 0 msecs)
D: CRC24 ... PASSED (all of 33 tests in 1 msecs)
D: CRC32 ... PASSED (all of 31 tests in 1 msecs)
D: GOST-34.11 ... PASSED (all of 10 tests in 2 msecs)
D: HAS-160 ... PASSED (all of 7 tests in 0 msecs)
D: Keccak-1600(224) ... PASSED (all of 268 tests in 12 msecs)
D: Keccak-1600(256) ... PASSED (all of 268 tests in 13 msecs)
D: Keccak-1600(384) ... PASSED (all of 268 tests in 12 msecs)
D: Keccak-1600(512) ... PASSED (all of 268 tests in 13 msecs)
D: MD2 ... PASSED (all of 75 tests in 5 msecs)
D: MD4 ... PASSED (all of 75 tests in 2 msecs)
D: MD5 ... PASSED (all of 76 tests in 3 msecs)
D: Parallel(MD5,SHA-1) ... PASSED (all of 2 tests in 0 msecs)
D: Parallel(SHA-1,RIPEMD-128,Tiger(24,3)) ... PASSED (all of 1 tests in 1 msecs)
D: RIPEMD-128 ... PASSED (all of 8 tests in 0 msecs)
D: RIPEMD-160 ... PASSED (all of 76 tests in 3 msecs)
D: SHA-1 ... PASSED (all of 76 tests in 6 msecs)
D: SHA-224 ... PASSED (all of 2 tests in 0 msecs)
D: SHA-256 ... PASSED (all of 262 tests in 9 msecs)
D: SHA-384 ... PASSED (all of 7 tests in 1 msecs)
D: SHA-512 ... PASSED (all of 7 tests in 0 msecs)
D: Skein-512(224) ... PASSED (all of 256 tests in 19 msecs)
D: Skein-512(256) ... PASSED (all of 256 tests in 19 msecs)
D: Skein-512(384) ... PASSED (all of 256 tests in 20 msecs)
D: Skein-512(512) ... PASSED (all of 268 tests in 22 msecs)
D: Tiger(16) ... PASSED (all of 2 tests in 1 msecs)
D: Tiger(20,3) ... PASSED (all of 2 tests in 0 msecs)
D: Tiger ... PASSED (all of 9 tests in 1 msecs)
D: Whirlpool ... PASSED (all of 8 tests in 0 msecs)
D: hash ... PASSED (all of 12096 tests in 0 msecs)
D: Testing tss.d ...
D: tss ... PASSED (all of 2 tests in 9 msecs)
D: Testing rfc3394.d ...
D: rfc3394 ... PASSED (all of 6 tests in 1 msecs)
D: Testing cryptobox.d ...
D: Cryptobox ... PASSED (all of 2 tests in 470 msecs)
D: Testing compress.d ...
D: Zlib ... PASSED
D: Deflate ... PASSED
D: Testing x509/test.d ...
D: NIST X.509 test #1
E: NIST X.509 test #1 :
E: unexpected failure: Certificate issuer not found
D: NIST X.509 test #2
E: NIST X.509 test #2 :
E: wrong error, got 'Certificate issuer not found' expected 'Signature error'
E: core.exception.AssertError@source\botan\cert\x509\test.d(263): Assertion failure
----------------
0x00007FF7AD6E2A6F in d_assert
0x00007FF7AD617DA3 in botan.cert.x509.test.__unittest_L174_C48 at C:\LDC\botan\source\botan\cert\x509\test.d(263)
0x00007FF7AD6F2599 in int core.runtime.runModuleUnitTests().__foreachbody1(object.ModuleInfo*)
0x00007FF7AD6F6408 in int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*))).__foreachbody2(ref rt.sections_win64.SectionGroup)
0x00007FF7AD6F639C in int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*)))
0x00007FF7AD6E969C in int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*))
0x00007FF7AD6F2487 in runModuleUnitTests
0x00007FF7AD6F1B18 in void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).runAll()
0x00007FF7AD6F19FC in d_run_main2
0x00007FF7AD6F17FF in d_run_main
0x00007FF7AD69DD67 in dub_test_root.main at C:\LDC\ldc\runtime\druntime\src\core\internal\entrypoint.d(35)
0x00007FF7AD70B1C4 in __scrt_common_main_seh at d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(288)
0x00007FFBC53E7BD4 in BaseThreadInitThunk
0x00007FFBC736CED1 in RtlUserThreadStart
E: NIST X.509 path validation ... 2 / 2 ************** FAILED ****************
D: Testing block_cipher.d ...
D: Testing file `../test_data/block\aes.vec ...
D: AES-128 ... PASSED (all of 385 tests in 17 msecs)
D: AES-192 ... PASSED (all of 449 tests in 19 msecs)
D: AES-256 ... PASSED (all of 513 tests in 23 msecs)
D: Testing file `../test_data/block\blowfish.vec ...
D: Blowfish ... PASSED (all of 60 tests in 8 msecs)
D: Testing file `../test_data/block\camellia.vec ...
D: Camellia-128 ... PASSED (all of 6 tests in 0 msecs)
D: Camellia-192 ... PASSED (all of 3 tests in 1 msecs)
D: Camellia-256 ... PASSED (all of 5 tests in 1 msecs)
D: Testing file `../test_data/block\cascade.vec ...
D: Cascade(Serpent,Twofish) ... PASSED (all of 3 tests in 0 msecs)
D: Cascade(Serpent,AES-256) ... PASSED (all of 2 tests in 1 msecs)
D: Cascade(Serpent,CAST-128) ... PASSED (all of 1 tests in 0 msecs)
D: Testing file `../test_data/block\cast128.vec ...
D: CAST-128 ... PASSED (all of 41 tests in 1 msecs)
D: Testing file `../test_data/block\cast256.vec ...
D: CAST-256 ... PASSED (all of 13 tests in 0 msecs)
D: Testing file `../test_data/block\des.vec ...
D: DES ... PASSED (all of 322 tests in 5 msecs)
D: DESX ... PASSED (all of 9 tests in 0 msecs)
D: TripleDES ... PASSED (all of 58 tests in 1 msecs)
D: Testing file `../test_data/block\gost_28147.vec ...
D: GOST-28147-89(R3411_94_TestParam) ... PASSED (all of 18 tests in 1 msecs)
D: GOST-28147-89(R3411_CryptoPro) ... PASSED (all of 10 tests in 1 msecs)
D: Testing file `../test_data/block\idea.vec ...
D: IDEA ... PASSED (all of 541 tests in 22 msecs)
D: Testing file `../test_data/block\kasumi.vec ...
D: KASUMI ... PASSED (all of 3 tests in 0 msecs)
D: Testing file `../test_data/block\lion.vec ...
D: Lion(SHA-1,ARC4,64) ... PASSED (all of 1 tests in 1 msecs)
D: Testing file `../test_data/block\mars.vec ...
D: MARS ... PASSED (all of 1084 tests in 29 msecs)
D: Testing file `../test_data/block\misty.vec ...
D: MISTY1 ... PASSED (all of 31 tests in 0 msecs)
D: Testing file `../test_data/block\noekeon.vec ...
D: Noekeon ... PASSED (all of 4 tests in 0 msecs)
D: Testing file `../test_data/block\rc2.vec ...
D: RC2 ... PASSED (all of 29 tests in 1 msecs)
D: Testing file `../test_data/block\rc5.vec ...
D: RC5(12) ... PASSED (all of 46 tests in 2 msecs)
D: RC5(16) ... PASSED (all of 41 tests in 1 msecs)
D: Testing file `../test_data/block\rc6.vec ...
D: RC6 ... PASSED (all of 1219 tests in 28 msecs)
D: Testing file `../test_data/block\safer.vec ...
D: SAFER-SK(10) ... PASSED (all of 12 tests in 1 msecs)
D: Testing file `../test_data/block\seed.vec ...
D: SEED ... PASSED (all of 4 tests in 0 msecs)
D: Testing file `../test_data/block\serpent.vec ...
D: Serpent ... PASSED (all of 1044 tests in 50 msecs)
D: Testing file `../test_data/block\tea.vec ...
D: TEA ... PASSED (all of 38 tests in 1 msecs)
D: Testing file `../test_data/block\threefish.vec ...
D: Threefish-512 ... PASSED (all of 4 tests in 0 msecs)
D: Testing file `../test_data/block\twofish.vec ...
D: Twofish ... PASSED (all of 1107 tests in 42 msecs)
D: Testing file `../test_data/block\xtea.vec ...
D: XTEA ... PASSED (all of 36 tests in 1 msecs)
D: block_cipher ... PASSED (all of 34383 tests in 0 msecs)
D: Testing transform.d ...
D: Transform ... PASSED (all of 0 tests in 0 msecs)
D: transform ... PASSED (all of 0 tests in 0 msecs)
37 unittests passed
Running .\build\botan-math-test-library.exe
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
bigint_comba_sqr4: 88
bigint_comba_mul4: 27
bigint_comba_sqr6: 180
bigint_comba_mul6: 50
bigint_comba_sqr8: 307
bigint_comba_mul8: 81
bigint_comba_sqr9: 384
bigint_comba_mul9: 110
bigint_comba_sqr16: 1147
bigint_comba_mul16: 310
1 unittests passed
Note that you can download prebuilt versions of #3301 at https://dev.azure.com/ldc-developers/ldc/_build/results?buildId=1100&view=artifacts&type=publishedArtifacts. They feature enabled LLVM/LDC assertions and are thus somewhat slower than normal release packages.
Everything looks great on my end, you can head here to click solve the issue and claim the $200
They still have the $2k one on hold it seems, I'm guessing you'd offer some support for the DMD assembly in exchange for it :-p you can feel free to claim it once they unblock it!
NB: You should really claim that bounty quickly – I had one LDC bounty claimed by some random non-contributor in the past, and Bountysource support weren't helpful in trying to recover it.
It looks like it'll take 7 days for the other one because it was considered echeck, tomorrow I can probably ask them to cancel it so I can re-do it properly
Alright will do, thanks a lot, much appreciated! :) - Wrt. the 2k, I'd rather have it redefined as DMD supporting GDC-style asm instead, for a long-term sane inline asm solution as mentioned earlier.
Wrt. the 2k, I'd rather have it redefined as DMD supporting GDC-style asm instead, for a long-term sane inline asm solution as mentioned earlier.
Great idea, that would greatly improve portability of existing code bases to D.
BTW, The GCC-style assembly parsing code is already part of DMD, see: https://github.com/dlang/dmd/blob/master/src/dmd/iasmgcc.d ;)
So, I think what remains is:
.sizeof
), etc.)Probably the best first step would be allowing dmd to parse, but ignore the GCC-style syntax, so it can be put in a version (LDC)
/version (GDC)
, without resorting to string mixins.
For GCC ASM support in DMD, we should start a tracking issue such as this one: https://github.com/ldc-developers/ldc/issues/2153
Thx Petar; I've known about iasmgcc.d.
Probably the best first step would be allowing dmd to parse, but ignore the GCC-style syntax, so it can be put in a version (LDC)/version (GDC), without resorting to string mixins.
They are already ignored; druntime (and potentially Phobos too) already includes GDC-style asm, e.g., here.
Connecting it to dmd backend's IR
Yeah that's probably going to be the bulk of the work.
Using the parsing code in LDC as well
Yep, including supporting both asm
syntaxes for backwards compatibility, and then translating to LLVM IR, analogous to __asm
, which should be straight-forward.
Closing this issue as fixed by #3301.
Wrt. GCC-style asm in LDC, I've started working on it in #3304. At the current stage, it might already be enough to replace most __asm
usages.
I'm trying to get Botan to run at its fastest with LDC support, and I think solving this
db
instruction would help with the lack of CPU instructions support for now.