inline asm (Fasm) with C++

Good morning everyone,

Kindly be of some form of assistance to me. Here is what I wanted to know.
I know some c++, done some win32, and some normal projects, now here is an issue bothering me, can you do _asm (inline Asm) in c++ using FASM?

This has been an issue I have been working / thinking on. Can you be of assistance of some sort.

Waiting for your Replies.
can you do [...] inline Asm
Yes. However it is compiler dependend. I believe Intel compiler can use FASM. Gcc uses gas and can switch between AT&T and Intel syntax. MSVS uses Microsoft assembler and Intel syntax.

Example of GCC inline assembler with AT&T syntax and resulting code (with ((noinline)) attribute on for testing):
1
2
3
4
5
6
7
8
9
10
11
12
13
inline uint64_t processorTicks()
{
    uint64_t tt;
    asm volatile (
        "rdtsc;"
        "shl $32, %%rdx;"
        "or %%rdx, %%rax;"
        :"=a"(tt)
        :
        :"%rdx"
    );
    return tt;
}
0x00401640	rdtsc
0x00401642	shl    $0x20,%rdx
0x00401646	or     %rdx,%rax
0x00401649	retq
Topic archived. No new replies allowed.