[cfe-dev] Inline assembly - multiple constraints and reloads.
Brett Hale
brettyhale at gmail.com
Wed Jun 5 14:50:02 PDT 2013
I recently submitted this question to
stackoverflow<http://stackoverflow.com/questions/16850309/clang-llvm-inline-assembly-multiple-constraints-with-useless-spills-reload>,
but it might need the attention of someone more familiar with clang / llvm
internals.
I am using *Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)*.
Inline assembly for a 64 x 64 = 128 bit (x86-64) multiply:
*__asm__ ("mulq %q3" : "=a" (rl), "=d" (rh) : "%0" (x), "rm" (y) : "cc")*
yields:
*movq %rcx, -8(%rbp)*
*## InlineAsm Start*
*mulq -8(%rbp)*
*## InlineAsm End*
which stores and reloads the value. *"r" (y)* appears to correct this,
yielding: *mulq %rcx*, but at the loss of the range of valid constraints,
which could be an issue in the event of register pressure. The optimization
level does not seem to affect the result. Furthermore, multiple alternative
constraint syntax, such as: *"r,m" (y)*, appears to work, but simply
ignores alternatives after the first, as evidenced by: *"m,r" (y)*. Have
these issues been resolved or under consideration in current revisions?
I apologize for the bold-type, hyperlinks, etc., in advance. I'm not sure
of the posting etiquette. The original stackoverflow question is more
concise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130606/62e75504/attachment.html>
More information about the cfe-dev
mailing list