Closed xor2003 closed 2 years ago
I am emulating assembler instructions using C++ inline functions like: template<class D, class S> MYINLINE void ADD_(D &dest, const S &src, m2c::eflags &m2cflags) { D result = dest + (D) src; AFFECT_CF(result < dest); const D highestbitset = (1 << (m2c::bitsizeof(dest) - 1)); AFFECT_OF(((dest ^ src ^ highestbitset) & (result ^ src)) & highestbitset); dest = result; AFFECT_ZFifz(dest); AFFECTSF(dest, dest); } You have experience with LLVM and LR. Is it possible to tell compiler to use frow away the above flag emulation and use hardware flags results? So we could use 32 decompiler on it.
Is it possible to tell compiler to use frow away the above flag emulation and use hardware flags results?
No, to use hardware flags results you would have to emit assembler instructions instead of c/c++ code.
Thank you. Trying it already https://godbolt.org/z/fdcza8E7f
Thank you. Trying it already https://godbolt.org/z/fdcza8E7f
Hello, I have wrote a tool for source to source translation for 16 bit games with segment model into C++ fake-asm. https://github.com/xor2003/masm2c And for each 16 bit assembler instruction I have precise copy implemented in C++. The instructions are checked while running game in dosbox. https://github.com/xor2003/libdosbox We are thinking of binary translation of 16 bit instructions into 32 bit to use usual decompilers. https://www.youtube.com/watch?v=MzK9RVgeWGM Do you know some information which can help?