# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O3 -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown \
# RUN: -mcpu=pwr9 -simplify-mir -run-pass=machine-cp %s -o - | FileCheck %s
# Normal case
---
name: test0
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
; CHECK-LABEL: name: test0
; CHECK: $x3 = LI8 1024
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x4 = LI8 1024
$x3 = COPY renamable killed $x4
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
# Not in terminal BBs
---
name: test1
alignment: 4
tracksRegLiveness: true
body: |
; CHECK-LABEL: name: test1
; CHECK: bb.0.entry:
; CHECK: renamable $x4 = LI8 42
; CHECK: B %bb.1
; CHECK: bb.1:
; CHECK: liveins: $x4
; CHECK: $x3 = COPY killed renamable $x4
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
bb.0.entry:
successors: %bb.1
renamable $x5 = LI8 42
renamable $x4 = COPY renamable killed $x5
B %bb.1
bb.1:
liveins: $x4
$x3 = COPY renamable killed $x4
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
# Use reserved register
---
name: test2
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
; CHECK-LABEL: name: test2
; CHECK: renamable $x4 = LI8 1024
; CHECK: $x13 = COPY killed renamable $x4
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit undef $x3
renamable $x4 = LI8 1024
$x13 = COPY renamable killed $x4
BLR8 implicit $lr8, implicit undef $rm, implicit undef $x3
...
# Intermediate read of copy's src
---
name: test3
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
; CHECK-LABEL: name: test3
; CHECK: renamable $x4 = LI8 0
; CHECK: renamable $x5 = ADDI8 $x4, 1
; CHECK: $x3 = COPY killed renamable $x4
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x4 = LI8 0
renamable $x5 = ADDI8 $x4, 1
$x3 = COPY renamable killed $x4
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
# Intermediate read of copy's def
---
name: test4
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
; CHECK-LABEL: name: test4
; CHECK: liveins: $x3
; CHECK: renamable $x4 = LI8 0
; CHECK: renamable $x5 = ADDI8 $x3, 1
; CHECK: $x3 = COPY killed renamable $x4
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x4 = LI8 0
renamable $x5 = ADDI8 $x3, 1
$x3 = COPY renamable killed $x4
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
# Intermiediate clobber of copy's def
---
name: test5
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $x5
; CHECK-LABEL: name: test5
; CHECK: liveins: $x3, $x5
; CHECK: renamable $x4 = LI8 0
; CHECK: renamable $x3 = ADDI8 $x5, 1
; CHECK: $x3 = COPY killed renamable $x4
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x4 = LI8 0
renamable $x3 = ADDI8 $x5, 1
$x3 = COPY renamable killed $x4
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
---
name: iterative_deletion
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x5
; CHECK-LABEL: name: iterative_deletion
; CHECK: liveins: $x5
; CHECK: renamable $x4 = ADDI8 killed renamable $x5, 1
; CHECK: $x3 = COPY $x4
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x6 = ADDI8 renamable killed $x5, 1
renamable $x4 = COPY renamable killed $x6
renamable $x7 = COPY renamable killed $x4
$x3 = COPY renamable killed $x7
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
---
name: Enter
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x4, $x7
; CHECK-LABEL: name: Enter
; CHECK: liveins: $x4, $x7
; CHECK: renamable $x5 = COPY killed renamable $x7
; CHECK: renamable $x7 = ADDI8 killed renamable $x4, 1
; CHECK: $x3 = ADD8 killed renamable $x5, killed renamable $x7
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x5 = COPY killed renamable $x7
renamable $x6 = ADDI8 killed renamable $x4, 1
renamable $x7 = COPY killed renamable $x6
$x3 = ADD8 renamable killed $x5, renamable killed $x7
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
---
name: foo
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x4, $x7
; CHECK-LABEL: name: foo
; CHECK: liveins: $x4, $x7
; CHECK: renamable $x5 = COPY killed renamable $x7
; CHECK: renamable $x7 = ADDI8 renamable $x4, 1
; CHECK: renamable $x6 = ADDI8 killed $x4, 2
; CHECK: $x3 = ADD8 killed renamable $x5, killed renamable $x6
; CHECK: $x3 = ADD8 $x3, killed renamable $x7
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x5 = COPY killed renamable $x7
renamable $x6 = ADDI8 renamable $x4, 1
renamable $x7 = COPY killed renamable $x6
renamable $x8 = ADDI8 killed $x4, 2
renamable $x6 = COPY killed renamable $x8
$x3 = ADD8 renamable killed $x5, renamable killed $x6
$x3 = ADD8 $x3, renamable killed $x7
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
---
name: bar
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x4, $x7
; CHECK-LABEL: name: bar
; CHECK: liveins: $x4, $x7
; CHECK: renamable $x5 = COPY killed renamable $x7
; CHECK: renamable $x7 = ADDI8 renamable $x4, 1
; CHECK: renamable $x8 = COPY killed renamable $x7
; CHECK: renamable $x7 = ADDI8 renamable $x5, 2
; CHECK: $x3 = ADD8 killed renamable $x5, killed renamable $x7
; CHECK: $x3 = ADD8 $x3, killed renamable $x8
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x5 = COPY killed renamable $x7
renamable $x6 = ADDI8 renamable $x4, 1
renamable $x7 = COPY killed renamable $x6
renamable $x8 = COPY killed renamable $x7
renamable $x6 = ADDI8 renamable $x5, 2
renamable $x7 = COPY killed renamable $x6
$x3 = ADD8 renamable killed $x5, renamable killed $x7
$x3 = ADD8 $x3, renamable killed $x8
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
---
name: bogus
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x7
; CHECK-LABEL: name: bogus
; CHECK: liveins: $x7
; CHECK: renamable $x5 = COPY renamable $x7
; CHECK: renamable $x4 = ADDI8 $x7, 1
; CHECK: renamable $x6 = ADDI8 renamable $x5, 2
; CHECK: $x3 = ADD8 killed renamable $x4, killed renamable $x5
; CHECK: $x3 = ADD8 $x3, killed renamable $x6
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x5 = COPY killed renamable $x7
renamable $x6 = ADDI8 renamable $x5, 1
renamable $x4 = COPY killed renamable $x6
renamable $x7 = COPY killed renamable $x4
renamable $x6 = ADDI8 renamable $x5, 2
renamable $x4 = COPY killed renamable $x7
$x3 = ADD8 renamable killed $x4, renamable killed $x5
$x3 = ADD8 $x3, renamable killed $x6
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
---
name: foobar
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x7
; CHECK-LABEL: name: foobar
; CHECK: liveins: $x7
; CHECK: renamable $x4 = ADDI8 $x7, 1
; CHECK: renamable $x8 = COPY killed renamable $x4
; CHECK: renamable $x4 = ADDI8 $x7, 2
; CHECK: $x3 = ADD8 killed renamable $x4, $x7
; CHECK: $x3 = ADD8 $x3, killed renamable $x8
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x5 = COPY killed renamable $x7
renamable $x6 = ADDI8 renamable $x5, 1
renamable $x4 = COPY killed renamable $x6
renamable $x8 = COPY killed renamable $x4
renamable $x6 = ADDI8 renamable $x5, 2
renamable $x4 = COPY killed renamable $x6
$x3 = ADD8 renamable killed $x4, renamable killed $x5
$x3 = ADD8 $x3, renamable killed $x8
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...
---
name: cross_call
alignment: 4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x2, $x3, $x20
; CHECK-LABEL: name: cross_call
; CHECK: liveins: $x2, $x3, $x20
; CHECK: renamable $x20 = LI8 1024
; CHECK: BL8_NOP @foo, csr_ppc64_altivec, implicit-def $lr8, implicit $rm, implicit $x3, implicit-def $x3, implicit $x2
; CHECK: $x3 = COPY killed renamable $x20
; CHECK: BLR8 implicit $lr8, implicit undef $rm, implicit $x3
renamable $x20 = LI8 1024
BL8_NOP @foo, csr_ppc64_altivec, implicit-def $lr8, implicit $rm, implicit $x3, implicit-def $x3, implicit $x2
$x3 = COPY renamable killed $x20
BLR8 implicit $lr8, implicit undef $rm, implicit $x3
...