<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/117221>117221</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MC] Assembly emission removes `.arch`/`.arch_extension` directives
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zyedidia
</td>
</tr>
</table>
<pre>
Here is an example program that uses `.arch` in inline assembly to enable LSE instructions:
```c
int main() {
asm volatile (
".arch armv8-a+lse\n"
"casal x0, x1, [x2]\n"
);
return 0;
}
```
If compiled with `clang -c test.c` it works fine, but if I first emit to assembly and then attempt to compile, it no longer succeeds:
```
$ clang -S test.c
$ clang -c test.s
test.s:14:2: error: instruction requires: lse
casal x0, x1, [x2]
^
```
The generated assembly does not include the `.arch` directive, causing the instruction to be illegal.
```
//APP
casal x0, x1, [x2]
//NO_APP
```
A similar issue exists for `.arch_directive`
Example:
```c
asm volatile (
".arch_extension lse\n"
"casal x0, x1, [x2]\n"
);
```
Thanks!
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVNuO4zYM_Rr5hUhgy3EuD35IJhN0gV4W2L4PZJmx2ZWlVKIzmX59ITvX2Zltg8AxRTHiOYdHKgRqLGIpio0otonquXW-_OcNa6pJJZWr38pf0CNQAGUBT6o7GISDd41XHXCrGPqAAcQ8nSqvWzFPgSyQNWQRVAjYVeYN2AFaVRmEX789A9nAvtdMzgaRr0W6FenlOU_Hrx5jsgydIivkUsgViMVmXAcVOjg6o5gMQsyOy-ePkHJoB5TvjsuJEnJjAoriyQopf9iqVVAGTqmQT3DK4lMUm5MUxfaHCiFXIt_cYo_cewvpdVEstu-Q3MP7sgftugMZrOGVuI28aaNsAxMNjIGnemCQ4dX57wH2ZDH2U_UMtIcvsCcfGLAjjpxe-VW2Bm7RgmLG7jAkzwfFcmKwDoyzDXoIvdaI9afMn0M5g3Nn3y6dvU-cWw5j4vyer7OZyNdS5GtA752PL3eKg8e_e_IYd0IU5UGNUQr4WIxH3YrnnxD9Z4vQoEWvGOsbT7XDANYxkNWmrzGS9jC7NXnUTMeBNq36QLYZNt0jYAcVAhmDjTLTn5K4E3K3_vp1DP8b3H3Z73-8XCs_xLiGQB0Z5YFC6BHwRIED7J2_Qnq54XmsfR6dfJuBd777xF4XX73gidGGSMZHvvr_nrr30ydCKvs9CJkldZnXq3ylEiyzRS5ltlgWy6QtUc6WMk_TTM2XcpHN8my-1MW8SLGY14VUCZUylbMsk1m2yhf5cqpVVqRFPVP7RVGn80rMUuwUmakxx27qfJMMhJZZtpAyS4yq0IThjpTS4utId4RQbBNfxqJJ1TdBzFITFbj9DROb4XL97UkUW1hfxhA7CmH0QueOj9dnFP-i3pXlh9EMSe9N2TIfBg8Pw9IQt3011a4TchfPP_9MDt79hZqF3A1dByF3Z1jHUv4bAAD__wcuuss">