Closed bladeFury closed 6 years ago
When you do cl ^= 12345;
you basically remove integer math entirely. Compiler sees that you don't use any results and removes it from the loop.
@SChernykh cl ^= 12345
still calculate cl = cl XOR 12345
, so compiler can't remove this from loop because it's changing cl
every loop, right?
And I checked the assembly code , movw r2, #12345
and eors r1, r2
is still there.
Compiler removes div and sqrt code completely if it sees that results are not used. This is why it gets faster.
@SChernykh ohh I got it, Compilers are really doing a lot work, Thanks for pointing it out.
Is there any optimization possibilities for this snippet? 30% hr drop seems a lot compared to other cpus.
I've done some test, found out that the hashrate loss is due to
VARIANT2_INTEGER_MATH
macro, this line : https://github.com/xmrig/xmrig/blob/2b0b71b9f695466f8b434fbbbcbfecfb3f9ecd60/src/crypto/CryptoNight_monero.h#L116 Seems "load"sqrt_result_0
is very slow. I did the following tests:change line 116 to
cl ^= sqrt_result_##part; \
-> slow change line 116 tocl ^= 12345;\
-> fastCould you do some optimization with this macro or give me some hint ? @SChernykh @xmrig