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

    <tr>
        <th>Summary</th>
        <td>
            [AArch64] [CodeView] unknown codeview register Z0
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AArch64,
            debuginfo,
            platform:windows
      </td>
    </tr>

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

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

<pre>
    If trying to compile code that uses SVE, with CodeView debug info enabled, one easily hits this error.

To reproduce:
```c
#include <arm_neon_sve_bridge.h>

uint64_t aom_sum_squares_2d_i16_wxh_sve() {
  svint64_t sum_squares = svdup_n_s64(0);
  return svaddv_s64(svptrue_b64(), sum_squares);
}
```

```console
$ clang -target aarch64-windows-gnu -c sve-debuginfo.c -march=armv8.2-a+sve -O2 -g -gcodeview
fatal error: error in backend: unknown codeview register Z0
```

Fixing this requires MS to define how the SVE registers are to be expressed in codeview debug info.

CC @pmsjt @dpaoliello 

(This issue was mentioned in https://github.com/llvm/llvm-project/issues/64278#issuecomment-2081507917, but splitting this out to a separate issue, as it's unrelated to the previous one.)

If not compiling with `-O2`, one hits #80009 instead. But once that is implemented correctly, we still need codeview definitions for these registers.

Also as a side note, if trying to build with `-target aarch64-windows-msvc`, one hits these errors instead:
```
In file included from <prefix>/lib/clang/19/include/arm_neon_sve_bridge.h:15:
<prefix>/lib/clang/19/include/arm_sve.h:271:1: error: cannot mangle this built-in __SVInt8_t type yet
  271 | __aio __attribute__((target("sve"))) svint8_t svreinterpret_s8(svint8_t op) __arm_streaming_compatible {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 272 |   return __builtin_sve_reinterpret_s8_s8(op);
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  273 | }
      | ~
<prefix>/lib/clang/19/include/arm_sve.h:125:15: note: expanded from macro '__aio'
  125 | #define __aio static __inline__ __attribute__((__always_inline__, __nodebug__, __overloadable__))
      | ^
<prefix>/lib/clang/19/include/arm_sve.h:271:1: error: cannot mangle this built-in __SVInt8_t type yet
  271 | __aio __attribute__((target("sve"))) svint8_t svreinterpret_s8(svint8_t op) __arm_streaming_compatible {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 272 |   return __builtin_sve_reinterpret_s8_s8(op);
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  273 | }
      | ~
<prefix>/lib/clang/19/include/arm_sve.h:125:15: note: expanded from macro '__aio'
  125 | #define __aio static __inline__ __attribute__((__always_inline__, __nodebug__, __overloadable__))
      | ^
2 errors generated.
```
But that's also a separate issue that probably should be tracked separately.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVz2P2zwS_jV0M7AhUZIlFS52vTGQ4vAWeZHiGoKSxjITilRISl4399sPQ9leby4JkDvgqhiGLVHD-Xzm4Uh6r3qDuGPFMyteVnIKJ-t2gw_W-S921djusvt4hOAuyvQQLLR2GJVGaG2HEE4ywOTRw6fPHxjfw1mFE-xth58VnqHDZupBmaMFNLLR2JGMNQgovdIXOKngIZyUB3TOug1LXljytPz-bcHh6Gw3tciy6yLbJsu3vd7zTJlWTx0Cy_bSDcKgNcLPKBqnuh43J5Z9eFQ7KRO2uQgg7SD8NAj_bZIOveCdUOlWnF9PtJ3xivEaWPm8bAPw823nwy5g2Qv4uZtGYYTf5oxXCeM1y-7bHIbJGfCz7Lr5KuLnMbgJRRPvSJ7vH7U-amDly3ehP0bzlg9rvNV4y0oOrZamh3WQrscAUrr2tM3XZ2U6e_br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