Jeremy Fitzhardinge
2013-Feb-08 18:53 UTC
[LLVMdev] Asm syntax of Mips m[tf]cX coprocessor instructions
Hi all, I'm experimenting with compiling some Mips code which is normally built with a gcc cross toolchain with clang instead. This code targets the Cavium Octeon, and uses some of that CPU's crypto engine features which are implemented in coprocessor 2. The inline asm for the crypto code uses instructions of the form "dmtc2 %0, 0xNNNN" - that is the coprocessor register is represented as a constant, which is the only syntax that gas seems to accept (specifically, an expression which evaluates to a constant). Clang's integrated-as, however, only accepts "dmtc2 %0, $0xNNNN", that is, a coprocessor register number. I think clang is correct here, but for cross-tool compatibility it would be useful if it could also accept the same syntax as gas. I could hack up the Octeon SDK headers to switch syntax depending on the compiler, but I'd really prefer to avoid that (esp since it really depends on the assembler in use, and I'm not sure if there's preprocessor symbols to detect whether integrated-as is enabled). I've had a look at Mips(64)InstrInfo.td which seems to be where the syntax is defined, but since this is my first encounter with clang/llvm's internals, I'm not sure how to go about making the change. Could someone give me some pointers? Is this something that InstAlias can handle? An alternative workaround would be to just use gas as-is, but it gets upset by the .cfi_section directives that clang emits. Is there some way to suppress those (while keeping the rest of the cfi directives that this version of gas does understand)? Thanks, J
Seemingly Similar Threads
- [LLVMdev] Asm syntax of Mips m[tf]cX coprocessor instructions
- [LLVMdev] MIPS asm backend emitting weird symbols into object file?
- [v3,11/41] mips: reuse asm-generic/barrier.h
- [v3,11/41] mips: reuse asm-generic/barrier.h
- [LLVMdev] [PATCH] x86: disambiguate unqualified btr, bts