[PowerPC] Recommit r314244 with refactoring and off by default
[llvm-core.git] / test / CodeGen / AMDGPU / rename-independent-subregs.mir
blob31ad26e76979699689568e31d5abc588fccd11ed
1 # RUN: llc -march=amdgcn -verify-machineinstrs -run-pass simple-register-coalescing,rename-independent-subregs -o - %s | FileCheck %s
2 --- |
3   define amdgpu_kernel void @test0() { ret void }
4   define amdgpu_kernel void @test1() { ret void }
5 ...
6 ---
7 # In the test below we have two independent def+use pairs of subregister1 which
8 # can be moved to a new virtual register. The third def of sub1 however is used
9 # in combination with sub0 and needs to stay with the original vreg.
10 # CHECK-LABEL: name: test0
11 # CHECK: S_NOP 0, implicit-def undef %0.sub0
12 # CHECK: S_NOP 0, implicit-def undef %2.sub1
13 # CHECK: S_NOP 0, implicit %2.sub1
14 # CHECK: S_NOP 0, implicit-def undef %1.sub1
15 # CHECK: S_NOP 0, implicit %1.sub1
16 # CHECK: S_NOP 0, implicit-def %0.sub1
17 # CHECK: S_NOP 0, implicit %0
18 name: test0
19 registers:
20   - { id: 0, class: sreg_128 }
21 body: |
22   bb.0:
23     S_NOP 0, implicit-def undef %0.sub0
24     S_NOP 0, implicit-def %0.sub1
25     S_NOP 0, implicit %0.sub1
26     S_NOP 0, implicit-def %0.sub1
27     S_NOP 0, implicit %0.sub1
28     S_NOP 0, implicit-def %0.sub1
29     S_NOP 0, implicit %0
30 ...
31 ---
32 # Test for a bug where we would incorrectly query liveness at the instruction
33 # index in rewriteOperands(). This should pass the verifier afterwards.
34 # CHECK-LABEL: test1
35 # CHECK: bb.0
36 # CHECK: S_NOP 0, implicit-def undef %2.sub2
37 # CHECK: bb.1
38 # CHECK: S_NOP 0, implicit-def %2.sub1
39 # CHECK-NEXT: S_NOP 0, implicit-def %2.sub3
40 # CHECK-NEXT: S_NOP 0, implicit %2
41 # CHECK-NEXT: S_NOP 0, implicit-def undef %0.sub0
42 # CHECK-NEXT: S_NOP 0, implicit %2.sub1
43 # CHECK-NEXT: S_NOP 0, implicit %0.sub0
44 # CHECK: bb.2
45 # CHECK: S_NOP 0, implicit %2.sub
46 name: test1
47 registers:
48   - { id: 0, class: sreg_128 }
49   - { id: 1, class: sreg_128 }
50 body: |
51   bb.0:
52     S_NOP 0, implicit-def undef %0.sub2
53     S_CBRANCH_VCCNZ %bb.1, implicit undef %vcc
54     S_BRANCH %bb.2
56   bb.1:
57     S_NOP 0, implicit-def %0.sub1
58     S_NOP 0, implicit-def %0.sub3
59     %1 = COPY %0
60     S_NOP 0, implicit %1
62     S_NOP 0, implicit-def %1.sub0
63     S_NOP 0, implicit %1.sub1
64     S_NOP 0, implicit %1.sub0
66   bb.2:
67     S_NOP 0, implicit %0.sub2
69 ...