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

    <tr>
        <th>Summary</th>
        <td>
            Global ISel 64 bit left-shift+add results in 32 bit adds
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:globalisel,
            mlir:amdgpu
      </td>
    </tr>

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

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

<pre>
    I'm seeing instructions like

```
%i12 = sext i32 %i11 to i64
%i62 = shl i64 %i12, 1
%i64 = add i64 0, %i62
%i65 = add i64 %i64, 1
```

resulting in a sequence of 32 bit adds with global isel, while without results in a 64 bit shl+add. I assume this is worse performance. Is there a reason to prefer this or expect the same performance?

I'm using `llc -O3 -march=amdgcn -mcpu=gfx942  -mtriple amdgcn-amd-hmcsa ./reduced.ll -global-isel={true,false} -o -` in looking at this.

[reduced.gisel.txt](https://github.com/user-attachments/files/18396831/reduced.gisel.txt)
[reduced.sdisel.txt](https://github.com/user-attachments/files/18396830/reduced.sdisel.txt)
[reduced.txt](https://github.com/user-attachments/files/18396829/reduced.txt)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVMGOpDYQ_RpzKYFMGejhwKFnWx3NKYd8gTEFOGswcZmdyd9H4OlsTw45rWTJkv3qvaqHH5rZTitRJ-pXUd8yvcfZhy5uftuy3g9_d28CLwswkV0nsCvHsJto_crg7HcS8nqsRn4ueRVY2xJBqBswfUSwCuE8KyF6sE31iWk-MbM7DhMEBX6D8gGoToAehhMgj7tU-ADUXwCp5l-G55bkNRDvLqYRQAPTXzuthsCPoBB6Gw8ahncbZ5ic77UDy-QOtvfZOjpv_B4hEXGiaaqzlGcn8FUPQwFvoJn3hSDOlsEyvPvABBuF0YdFr4YKeGOIMwUCDYE0-_UwZgs0UkhlPgB9bGTigQPWyxcCoe5ppvRldj6mEo10zkD-u4J80cHMQt30MkxmhXwx2y7UbRo_2goB8iUGuzmCdJ_rZcjnxbCGQuA90LAbGgrnIE9G5KcR6iYurzHsJPDbqB2TuNwg95CLRh5mOO-_H43oeM5QfD6M-vVBOB00RfyIor4JfJlj3Fioq8C7wPtk47z3hfGLwPvOFHIdozbzQmtkgffROjr28kW1zYsqnxr9yYvtV0UefqGkfJJ8Iv6v5i8Rw_ZJLKlkQ6eGVrU6o668qOZyQdnKbO6kHttmQDTtIE07vFx6Zeq21djUTdWUmNkOJdayLFWJVYltIftKNq3R2JSN6cdGVJIWbV3h3I-l8GHKLPNOXYl4kVXmdE-Oz_8D4gER6poeRgrIkVmBuDgbhLoeb2rbj9P6loXuwOf9PrGopLMc-adItNFR91vK2tsf5B5pcjTGnGc7xhSq58g9ZTXbg-v-x-Wz1bTlW_B_kokC7-dop9Npuh8d_hMAAP__ICiRiA">