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

    <tr>
        <th>Summary</th>
        <td>
            [AArch64][SVE] can improve vector constant generation with SVE's INDEX instruction
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    GCC has implemented this in a recent patch. Consider the following example.
https://godbolt.org/z/szzTesvKz
```cpp
#include <arm_sve.h>

typedef int v4si __attribute__ ((vector_size (16)));
v4si
f_v4si (void)
{
  return (v4si){ 0, 1, 2, 3 };
}
```

GCC:
```asm
f_v4si():
        index   z0.s, #0, #1
        ret
```

Clang:
```asm
.LCPI0_0:
 .word   0
        .word   1
        .word   2
        .word 3
f_v4si():
        adrp    x8, .LCPI0_0
        ldr     q0, [x8, :lo12:.LCPI0_0]
        ret
```

I referred to the following GCC patch.
[INDEX](https://github.com/gcc-mirror/gcc/commit/a92f54f580c37732a5de01e47aed56882231f196)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVN2OqzYQfhrnZrTIDDjABRf52RytWlWVWlW9ixwzBLdgp7ZJ9uTpKwPdPTlarXoQ8tjjb36-kWek9_psiGomtkzsV3IMnXX130_SOXvzq5NtvtZfdjvopAc9XHoayARqIHTagzYgwZEiE-Aig-oS2FnjdUMOQkfQ2r63N23OQK8yGieM7xnfdCFcPMs2DA8MD2fbnGwfEuvODA93hgd_v_9O_vrTfYazNZ9_dbksGsy0Uf3YELBsJ91w9FdKOpY9L_fTGr5eqKEWtAlwzb2G41GG4PRpDHQ8AsOSYXklFaw7en2nqEnXDKvlz7azn2g779rj5CeaWd1EzByuWJAAjsLozISIVlixYguc4Q7SuGBcMmDF_s173D_S_JbDl90uFuoRIP3wbT4TkeoNBsunTUOvAHDniY9hGWZ8kekj0lH4JIVdL835kySSn3e_vvAjf08guVnXAAB_DPOfOv1YjR-ps_9BVDbuEuVrGem9pfOA6Rs3yX_mEojtDGbZprcpsuydhdj_SHFewFFLzsWWsN89-tg3c1ssFmL78sv--c8YAsvvmkCHbjwlyg7xoNTToJ2zbj4wPCg7DDowPMgKW5G3ouQqK4oMpWiIp5QXkhqxLkvELG3TKj7jVVNnTZVVckV1WmAhygoLvurqvEAuyrxaU1kVJ8Ub2cpKCVWs21ZxLle6Ro45r7DiQuQZT7Ap01YJQSnPWpEjyzkNUvdJ31-H2Lkr7f1IdZryPOWrXp6o99NQQTR0g-mWIcYZ4-po9HQaz57lvNc--Hc3QYd-mkabjVPdOo-1Etvf_nhmYg9KmjiEnL0SzH0LyhofpAlwJkNOBm0N3HToIJpg4WGqOGjjgxtVvF6Nrq8_KX5MZRFPF2f_IhXLPhHwDA8Lw2uN_wYAAP__jAl1dg">