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

    <tr>
        <th>Summary</th>
        <td>
            amdgpu_gfx functions do not use s0-s3 for inreg SGPR arguments on targets using scratch instructions for stack 
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AMDGPU
      </td>
    </tr>

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

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

<pre>
    Unlike compute functions, amdgpu_gfx does not attempt to claim s[0:3] for inreg SGPR argument space. They are simply dropped from the list of argument registers. 
```

; RUN: llc -march=amdgcn -mcpu=gfx940 -o - < %s

declare void @compute(i32 inreg)
declare amdgpu_gfx void @gfx(i32 inreg)

define amdgpu_kernel void @call_compute() {
  call void @compute(i32 inreg 123)
  ret void
}

define amdgpu_cs void @call_gfx() {
  call amdgpu_gfx void @gfx(i32 inreg 123)
  ret void
}

```

compute copies 123 to $sgpr0, and amdgpu_gfx copies to $sgpr4




</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU01v6zYQ_DWry8IGTeojOuhgP8Pv1OIhbc4BTa0k1hQpcKkg-feFbCd2gKTFAwQKAnd2ZlY7mtn2nqiBYgfFPtNzGkJsdGTyY3YM7Vvz5J09EZowTnMi7GZvkg2eQf5APbb9ND_33Su2gRh9SKhTonFKmAIap-2IDMVOgNoqKPbYhYjWR-rxr5-_HlHHfh7JJ-RJG1rj3wO9oY6EbMfJvWEbwzRRi10MI6aB0FlOGLobMFJvOVHkNYLYg9hCKa7P5fNyqh0-Pv0JaovOGVyNOpoB1H4xYDyuRjPNoPZ991rnAlcBVwjqB4Is-L5NS8Yt6l6CbRFycR0KyAer5MUXyPpz7d2M3mF99_ol5B3YWf-BO1H05G6M2rnnGy3IGqHaXYCIy-1_icONVB9siJHSufrKXu2_l2H4s4SLha_o_9_v76j48m--76IJkyVe2i3bBjLnforivJi-vRdyLbwV5Z847s6sbVRbq1pn1GwqUahK1WWZDY3WpaqLXJuurupaFpXIu4roITeiJlEcM9tIIXOx2ZRCFrUs12K52tR5mRemMvUGckGjtm7t3Mu4DrHPLPNMTfUgZZk5fSTH5xxKedTmRL4Ftd3-sf_56wmkXNIZmwW6Os49Qy6WKPCtWbLJUXNn-iOp2IZzMmcmZLFi9V0KGYPHpGNPiXFm63tkE3UyA1rPKc7XfguckzYnzObomiGliUFtQR5AHnqbhvm4NmEEeVjUXV-rKYZ_yCSQh7NvBnk4W_83AAD__6ggZpo">