<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57753>57753</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            AArch32 Clang doesn't allow using FP16 floating-point instructions in inline assembly
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Maratyszcza
      </td>
    </tr>
</table>

<pre>
    Floating-point (i.e. non-NEON) FP16 arithmetic instructions use `s0-s31` registers in AArch32, corresponding to inline assembly constraint `"t"`. However, attempting to pass either `__fp16` or `_Float16` variable in a `"t"`-constraint register into inline assembly results in an error "couldn't allocate output register for constraint 't'".

Reproducer (build with `-march=armv8.2-a+fp16 -mfpu=fp-armv8`):
```c
// This one works in GCC
__fp16 f(__fp16 x) {
    __fp16 y;
    __asm__ ("vsqrt.f16 %[y], %[x]"
      : [y] "=t" (y)
      : [x] "t" (x));
    return y;
}

// Using Clang-specific _Float16 type doesn't work either
_Float16 g(_Float16 x) {
    _Float16 y;
    __asm__ ("vsqrt.f16 %[y], %[x]"
      : [y] "=t" (y)
      : [x] "t" (x));
    return y;
}
```

Godbolt: [link](https://gcc.godbolt.org/z/MxEadTTPa)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVMFymzAQ_Rpx0cBgYbA5cEjiOL0k7XTSs0eIxVYjEJWEHefruxJ44qT5gXqMrWVXu--9XanWzbnaKs2d7PfxoGXvKGFrmUBCe93HT_ffnwgr6fbHoqDcSHfowElBZW-dGYWTurd0tEBJkdo0ttkCF9TAXloHxmIcvbkx4pAxwu6o0MaAHXTfYDXqNLqV7IFya6Gr1RkDfF4eUBQpYczhg6uEftMnOILxWbhz0A1uTjHgZgoIDIzfs9u1w6LwIPRkB3LTmyMS4LUCj4p_LBBfVb6gx7AvICKBUbnAjPcUjPF1GBN6VE1P2MpRrpQW3AHVoxvGq3wthl4zxGB8cHNC0g1Jb6bfnzAY3YzC82HrepSqoSfk5wHHHUcxSbbhpjuuExZzwm49YRp37TCiox3i4AvsSpLNSb0ZvmK22Ra_9PkgLdVI76TNS-D0cHc3RUxC0hYxzMtXPwhkdTv5KX5mx5lkH15y2-12HjxSO9o_xiUtRhGWk_z2TPKNb-JkvQaLvW-mFCHTOc7ripR8i3y2syf0b-TrHHkJ8zAD9StMBtxo-iugZLW51nyW45f1Q3WnOJ4FO4CQLY76ZYKoOw9AGw12arOXbB68WbFL4N5rdjG-UO3i-q91uwzUtYwPuqm1cnMBPDcvAef64Nxg_SwGmfdCJPspMtEGxdq-4fP4es-b5-cfONFlBNWiKDKWlqt1HjVV1pRZySMnnYJqvk-mNl31wx-7E95FvoXhumo_Xmsfriyc9E8HOxqNqj4BxeaOdSJ0h4ZSx8tfjAf0NwgUbiutHcHiIl-t8iw6VKKsC8ZTqJd5msKiEXndZG1Rr_mClaxsIsVrULZCfVD3Hk40pPAdyzeRrFjKkPYiT9kyS_OkyJalWK-XBa-zFlDtZQodlyrxOLx6kakCpHrcW3QqvGnsuxPJyX0PEMphfj66gzbVIzfcne2beONRKF8F-H8B4JnGRw">