• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=aarch64-apple-ios -fast-isel -verify-machineinstrs | FileCheck %s
2
3; Check that the kill flag is cleared between CSE'd instructions on their
4; imp-def'd registers.
5; The verifier would complain otherwise.
6define i64 @csed-impdef-killflag(i64 %a) {
7; CHECK-LABEL: csed-impdef-killflag
8; CHECK-DAG:  mov    [[REG1:w[0-9]+]], #1
9; CHECK-DAG:  mov    [[REG2:x[0-9]+]], #2
10; CHECK-DAG:  mov    [[REG3:x[0-9]+]], #3
11; CHECK-DAG:  cmp    x0, #0
12; CHECK:  csel   w[[SELECT_WREG_1:[0-9]+]], wzr, [[REG1]], ne
13; CHECK-DAG:  csel   [[SELECT_XREG_2:x[0-9]+]], [[REG2]], [[REG3]], ne
14; CHECK:      ubfx   [[SELECT_XREG_1:x[0-9]+]], x[[SELECT_WREG_1]], #0, #32
15; CHECK-NEXT: add    x0, [[SELECT_XREG_2]], [[SELECT_XREG_1]]
16; CHECK-NEXT: ret
17
18  %1 = icmp ne i64 %a, 0
19  %2 = select i1 %1, i32 0, i32 1
20  %3 = icmp ne i64 %a, 0
21  %4 = select i1 %3, i64 2, i64 3
22  %5 = zext i32 %2 to i64
23  %6 = add i64 %4, %5
24  ret i64 %6
25}
26