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

    <tr>
        <th>Summary</th>
        <td>
            ccmp should adjust for cases where it is checking for -32
        </td>
    </tr>

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

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

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

<pre>
    We can adjust this by one and do a ccmn, but that would involve changing the cmp, which we do not adjust except in rare cases.

https://godbolt.org/z/r5q9v83EE

        cmp     w0, w2
 mov     w8, #-32
        ccmp    w1, w8, #4, lt
        csel    w0, w1, w0, gt
        ret

we can do
        cmp     w0, w2
        ccmn    w1, #31, 1, lt
        csel    w0, w0, w1, lt
        ret
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEksFu3CAQhp8GX0a7woMd2wcO2zZ-hUq9ASaGFMMW8Lrp01fYG2WVS3wZxPzzzyfzi5Ts7LXmpP1G2h-VWLMJkV9-6RhqVskwvfGfGpTwIKbXNWXIxiaQbxC8BuEnmAIIUGrxBL-DXItAZNjC6iaw_hbcTYMyws_Wz5CNBrVci3QzVhnYdDHwIb_b679KXzNYD1HEsjjpdCb0QujF5HxNhF0IjgTHOUwyuHwOcSY4_iM4xvbPcOvZ8_Mhh_unluteN7qvxdJawu2468sdQXZi-Dhyn9nqfeRd1JTq8qMwaffgfcj38_woizofTNvxK6fwBd8Hh__gIMjYfqi_4nigcZ84qomzaWCDqDSvu6brhrbtu8rwhjaDekJUrO9Zo7Dr-6Zm2LZyaKXqRGU5UmxpizXF5gm7M2X1hLWUA6NqepE1aahehHVn525LeZfKprRqXje0Z6xyQmqX9qAher3B3iWIJXeRl6GTXOdEGupsyunDJtvsNN8fJZk9WPewvIR4JAQ2o6MGm8EmUEar3yVtpX1iWK3R8U_hsdms8qzCQnAse-7ldI3hVatMcNzpEsHxjn_j-D8AAP__96DtEQ">