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

    <tr>
        <th>Summary</th>
        <td>
            [AArch64] LLVM 16 regression: poor codegen for vcgez intrinsics
        </td>
    </tr>

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

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

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

<pre>
    ```c
#include <arm_neon.h>

int8x8_t foo(int8x8_t a) {
    return vcgez_s8(a);
}
```

## LLVM 15

```llvm
define dso_local noundef <8 x i8> @_Z3foo10__Int8x8_t(<8 x i8> noundef %0) local_unnamed_addr #0 {
  %2 = ashr <8 x i8> %0, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
  %3 = xor <8 x i8> %2, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
  ret <8 x i8> %3
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable "frame-pointer"="non-leaf" "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon,+outline-atomics,+v8a" }
```

```asm
foo(__Int8x8_t):                     // @foo(__Int8x8_t)
        cmge    v0.8b, v0.8b, #0
 ret
```

## LLVM 16

```llvm
define dso_local noundef <8 x i8> @_Z3foo10__Int8x8_t(<8 x i8> noundef %0) local_unnamed_addr #0 {
  %2 = icmp sgt <8 x i8> %0, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
  %3 = sext <8 x i1> %2 to <8 x i8>
  ret <8 x i8> %3
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a,-fmv" }
```

```asm
foo(__Int8x8_t):                     // @foo(__Int8x8_t)
        movi    v1.2d, #0xffffffffffffffff
 cmgt    v0.8b, v0.8b, v1.8b
        ret
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUllGP4yYQxz_N-AU5sgc7sR_8sLu5lSpdX_vQlwjjsUNrgwU4m7tPX2E72WRzUq8nVb2iKIzhDwPM_BDCOdVpogryZ8j3kZj80djqaRBa0RTVpvlSwTZZfhKSPSRPgFxp2U8NMeAvwg4HTUZvjsA_rYL5X2lfnIuDZ60xgMX1UwCWDHbPi4oxxiz5yWp2kh19PbgCsAga4KsEdvvVuCzk1g0gB-Ts8-fffmVpftdzkff9aViaGmqVJtY4c-iNFD3TZtINtWEjBTszVQD_xCBLDr_z1pg0ORx-WdcNWNyJriMxT8KO5vkOk9ZioOYgmsYyQJ7c7hQwRwZ8z4Q72g8u51leQqMq2C6YP1RfQjA747Ozs3n0he--4nQd_MPGu09L_sEV_xjE-V94b1U9eXLrKfF9OCk2TM6P1nSWnGPatJaIaWNJTtYFy33Rcj76N6UbZkk02mhib6rv1yya3ryoe2KA2FoxUDwapT1ZQAS-B0RtdNyTaAExiAYVPjvRxyeS3tj4TTX-eFVvs1WnTeytGEelu3gQNwpvJ1o1zgv5Zzxa45ep6qltycZOfaWrvFi1XtiOfCzH6drVkSar5L2gJeEnS-6qAnwOvAG-AD6byfdKUyy8GZR0S-Mp8IPsb7i5NAq3wrFwepvxJfAZ0IcC-Ar4GkD51qAr2KHIoaNQn5JNUYekuRoh8KvWkv9exLf_D8SVHEbmukcekn8HvSvujs7vTtML78ybu5X8V8TegDrQYOwXwCIQHI73n5L7MxHZjrGww6lYAPwePl_idjj9PJgO5qRmTNMNNhc6z-2Hso6RQ-e_zfQpDcbdzI9sR03Fm5KXIqIq3RZJuiszXkbHKm-KYpcniLKum4walDmVoqR0u9ulPM0iVWGCPOE8SUNVbjKUmSxrKdJUbNM2gyyhQah-Ey6EjbFdpJybqNqmBd9Gvaipd_NbB1HTG5s7QwTzfWSrMCaup85BlvTKefc-i1e-nx9JT09WHrcZ5PvLfcQszcmvjA5xGI2xTJqGOtKsNXZ51jClvVXaKemiyfbV0fvRAX9aItQpf5zqjTQD4Ot8lS1VSNw_SHrA13mlDvB13slfAQAA__-LgbDI">