invalid instruction mnemonic with Clang-Cl and FA flag

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

invalid instruction mnemonic with Clang-Cl and FA flag

Dimitry Andric via cfe-dev

Hello Clang-Devs,

 

I run into a strange error with Clang-Cl - I hope I can explain it. We use Clang-Cl via the LLVM extension in Visual Studio and use it to compile our source code. One of the flags we set for the compiler is "/FA" which gives us assembly output. Everything fine so far, no problems.

 

I then add a simple copy loop to our code, that is copying int32 values from one address to another one. When compiling this construct Clang-Cl suddenly exited with: "error: invalid instruction mnemonic 'movsdi'".

However, when I remove the "/FA" flag everything compiles fine and runs fine in the end... Strangely, I couldn't figure out what the "movsdi" mnemonic is...

 

The Assembly code looks like this:

.LBB15_31:                              #   in Loop: Header=BB15_17 Depth=1

                mov       ecx, 32

                mov       edx, 4

                call         calloc

                mov       qword ptr [r12 + rbp + 96], rax

                mov       qword ptr [r12 + rbp + 88], rax

                mov       ecx, 32

                mov       rdi, rax

                rep movsdi es:[rdi], [rsi]

                jmp        .LBB15_33

 

My Clang-Cl version is:

clang version 11.0.0 (https://github.com/llvm/llvm-project.git 176249bd6732a8044d457092ed932768724a6f06)

Target: x86_64-pc-windows-msvc

Thread model: posix

 

The target is the same as in the version (x86_64-pc-windows-msvc).

 

Does anyone know what is going on?

 

Kind greetings

Björn

Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Takashi Nagano, Junichi Tajika, Ergin Cansiz.
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: invalid instruction mnemonic with Clang-Cl and FA flag

Dimitry Andric via cfe-dev
Clang's Intel assembler parser isn't as robustly tested as the GNU assembler parser. This has been a recurring issue ever since we switched clang-cl's assembly output to the Intel dialect:

I see the string repmovsdi here:

I think it's just a typo, let me see if I can fix it...

On Wed, Mar 24, 2021 at 4:06 AM Gaier, Bjoern via cfe-dev <[hidden email]> wrote:

Hello Clang-Devs,

 

I run into a strange error with Clang-Cl - I hope I can explain it. We use Clang-Cl via the LLVM extension in Visual Studio and use it to compile our source code. One of the flags we set for the compiler is "/FA" which gives us assembly output. Everything fine so far, no problems.

 

I then add a simple copy loop to our code, that is copying int32 values from one address to another one. When compiling this construct Clang-Cl suddenly exited with: "error: invalid instruction mnemonic 'movsdi'".

However, when I remove the "/FA" flag everything compiles fine and runs fine in the end... Strangely, I couldn't figure out what the "movsdi" mnemonic is...

 

The Assembly code looks like this:

.LBB15_31:                              #   in Loop: Header=BB15_17 Depth=1

                mov       ecx, 32

                mov       edx, 4

                call         calloc

                mov       qword ptr [r12 + rbp + 96], rax

                mov       qword ptr [r12 + rbp + 88], rax

                mov       ecx, 32

                mov       rdi, rax

                rep movsdi es:[rdi], [rsi]

                jmp        .LBB15_33

 

My Clang-Cl version is:

clang version 11.0.0 (https://github.com/llvm/llvm-project.git 176249bd6732a8044d457092ed932768724a6f06)

Target: x86_64-pc-windows-msvc

Thread model: posix

 

The target is the same as in the version (x86_64-pc-windows-msvc).

 

Does anyone know what is going on?

 

Kind greetings

Björn

Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Takashi Nagano, Junichi Tajika, Ergin Cansiz.
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev