summaryrefslogtreecommitdiff
path: root/test/CodeGen/AArch64/machine-sink-zr.mir
blob: 2cf2bc488237f2f2be94802cc0935e80a10332d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass machine-sink -o - %s | FileCheck %s
--- |
  define void @sinkwzr() { ret void }
...
---
name:            sinkwzr
tracksRegLiveness: true
registers:
  - { id: 0, class: gpr32 }
  - { id: 1, class: gpr32 }
  - { id: 2, class: gpr32sp }
  - { id: 3, class: gpr32 }
  - { id: 4, class: gpr32 }
body:             |
  ; Check that WZR copy is sunk into the loop preheader.
  ; CHECK-LABEL: name: sinkwzr
  ; CHECK-LABEL: bb.0:
  ; CHECK-NOT: COPY %wzr
  bb.0:
    liveins: %w0

    %0 = COPY %w0
    %1 = COPY %wzr
    CBZW %0, %bb.3

  ; CHECK-LABEL: bb.1:
  ; CHECK: COPY %wzr

  bb.1:
    B %bb.2

  bb.2:
    %2 = PHI %0, %bb.1, %4, %bb.2
    %w0 = COPY %1
    %3 = SUBSWri %2, 1, 0, implicit-def dead %nzcv
    %4 = COPY %3
    CBZW %3, %bb.3
    B %bb.2

  bb.3:
    RET_ReallyLR

...