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

    <tr>
        <th>Summary</th>
        <td>
            RISCV: suboptimal trucation of int to short
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:RISC-V
      </td>
    </tr>

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

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

<pre>
    test case:

``` c
short foo(short i, short j) {
    return i + j;
}
```

$ rv64gc-clang -O3 -S -o -

```asm
foo(short, short):                               # @foo(short, short)
        add a0, a0, a1
        slli    a0, a0, 48
        srai    a0, a0, 48
 ret
```

link: https://godbolt.org/z/o5jYEzeT9
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8Us1u2zAMfhr6QjiQKcWODzr0ZwZ2GrAOBXaUJcVWqliBJBdon35wnHVtsFYwaIL8SH78USm5YbJWwvYWtveFmvMYohxdVMblF1X0wbzIbFNGrZIFfgPsHthfWbP1Q70a0hhixn0IQLtVd0B3uKoHoBahuV2hiIjR5jlO6BDoFg_ALy5o7q_yfyhKAuNzLQZdaq-mAcsfHMsHLAOW_yWn0nG1vOP1xgqoBX4m88UD4giCfRb_1s_ylDGo2OK_yOqjP3nvzrh3GLG7wkT1OSba_MV0vJuelobGnE9pWRd1QN0QTB983oQ4AHWvQF3YHn5_e7W_2sJIblreqsLKqm54va14zYpR7lS_J7Mzgre9YY2tqG10L2rSXBllbOEkMeKsqjhx1hLbVC2rGqsF7RthiO1BMHtUzm-8fz4utQuX0mxlzVglCq9669P58Ih6pZ_sZIDf_Pz-cFc-AtFyjlEuoWU_DwkE8y7l9C9ZdtlbueAfl47T3IdTdkflMcdZq-zChGGPbsqYw7qtYo5eXo3G5XHuNzocgbol9-VXnmI4WJ2BujPrBNSdif8JAAD__2VS4s8">