1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=aarch64-apple-ios -fast-isel -verify-machineinstrs | FileCheck %s
3
4; Check that the kill flag is cleared between CSE'd instructions on their
5; imp-def'd registers.
6; The verifier would complain otherwise.
7define i64 @csed_impdef_killflag(i64 %a) {
8; CHECK-LABEL: csed_impdef_killflag:
9; CHECK:       ; %bb.0:
10; CHECK-NEXT:    mov w8, #1
11; CHECK-NEXT:    cmp x0, #0
12; CHECK-NEXT:    csel w8, wzr, w8, ne
13; CHECK-NEXT:    mov x9, #2
14; CHECK-NEXT:    mov x10, #3
15; CHECK-NEXT:    ubfx x8, x8, #0, #32
16; CHECK-NEXT:    csel x9, x9, x10, ne
17; CHECK-NEXT:    add x0, x9, x8
18; CHECK-NEXT:    ret
19
20  %1 = icmp ne i64 %a, 0
21  %2 = select i1 %1, i32 0, i32 1
22  %3 = icmp ne i64 %a, 0
23  %4 = select i1 %3, i64 2, i64 3
24  %5 = zext i32 %2 to i64
25  %6 = add i64 %4, %5
26  ret i64 %6
27}
28