<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/101328>101328</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Support choosing assembly dialect per snippet in clang
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dzaima
</td>
</tr>
</table>
<pre>
Currently the primary way to change x86 inline assembly dialect (intel vs AT&T) is `-masm=intel` & `-masm=att`. This is a global change, undesired if some `#include`d code assumes AT&T.
Using `.intel_syntax` breaks on passing operands, as those still get generated with a leading `%` (https://github.com/llvm/llvm-project/issues/24606; https://godbolt.org/z/1xbfYsWh1). But, even if that were fixed, `"m"` operands would still likely remain broken due to having a completely different syntax.
A complete solution would be the ability to choose assembly dialect per assembly block. https://reviews.llvm.org/D113707 mentioned a potential option of `#pragma clang asm_dialect push "att"` & `#pragma clang asm_dialect pop`, but as far as I can tell nothing like that ever landed.
Motivating use-case is using inline intel assembly in a project which, for valgrind builds, uses `<valgrind/valgrind.h>` which in turn assumes AT&T assembly.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyclM1u6zYQhZ-G2gwiSJQt2wstkrgGuuiqKYquLkbiSGJDkQI5tOP79AVl2bdJiy668Y9Izpw5_I4wBD1YokZsX8T2mGHk0flGfUc9YdY6dW1eo_dk2VyBR4LZ6wn9FS54BXbQjWgHgo99DdoabQkwBJpacwWl0VDHIOReWyYD5wDPb0LWb0IeQAcQdfE0YZhEdVw2iLoAIeu_P0dmURc5vI06pCMIg3EtmrWvkK8QraKgPSnQPQQ3UTovZKVtZ6IiURcKOqcWYXGiu4ZcFEdRPN8-fwvaDulcvgj5Fq6W8SPpaT3hewBnYU5W2QHcTB6tCqk3BuDRBYLA2hgYiGEgSx6ZFFw0j4BgCNVaXcjtbcb9yDwHUT0LeRLyNGgeY5t3bhLyZMz5_vU0e_cndSzkSYcQ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