File: fix-sgpr-copies.mir

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (128 lines) | stat: -rw-r--r-- 3,106 bytes parent folder | download | duplicates (11)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# RUN: llc -march=amdgcn -run-pass=si-fix-sgpr-copies -verify-machineinstrs -o - %s | FileCheck --check-prefix=GCN %s

# GCN-LABEL: name: fix-sgpr-copies
# GCN: V_ADD_CO_U32_e32
# GCN: V_ADDC_U32_e32
---
name: fix-sgpr-copies
body:               |
  bb.0:
    %0:vgpr_32 = IMPLICIT_DEF
    %1:sreg_32 = IMPLICIT_DEF
    %2:sreg_32 = IMPLICIT_DEF
    %3:sreg_32 = IMPLICIT_DEF
    %4:vgpr_32 = V_CVT_U32_F32_e64 0, %0:vgpr_32, 0, 0, implicit $mode, implicit $exec
    %5:sreg_32 = COPY %4:vgpr_32
    %6:sreg_32 = S_ADD_I32 %2:sreg_32, %5:sreg_32, implicit-def $scc
    %7:sreg_32 = S_ADDC_U32 %3:sreg_32, %1:sreg_32, implicit-def $scc, implicit $scc
...

# Test to ensure i1 phi copies from scalar registers through another phi won't
# be promoted into vector ones.
# GCN-LABEL: name: fix-sgpr-i1-phi-copies
# GCN: .8:
# GCN-NOT: vreg_64 = PHI
---
name: fix-sgpr-i1-phi-copies
tracksRegLiveness: true
body:               |
  bb.9:
    S_BRANCH %bb.0

  bb.4:
    S_CBRANCH_SCC1 %bb.6, implicit undef $scc

  bb.5:
    %3:vreg_1 = IMPLICIT_DEF

  bb.6:
    %4:vreg_1 = PHI %2:sreg_64, %bb.4, %3:vreg_1, %bb.5

  bb.7:
    %5:vreg_1 = PHI %2:sreg_64, %bb.3, %4:vreg_1, %bb.6
    S_BRANCH %bb.8

  bb.0:
    S_CBRANCH_SCC1 %bb.2, implicit undef $scc

  bb.1:
    %0:sreg_64 = S_MOV_B64 0
    S_BRANCH %bb.3

  bb.2:
    %1:sreg_64 = S_MOV_B64 -1
    S_BRANCH %bb.3

  bb.3:
    %2:sreg_64 = PHI %0:sreg_64, %bb.1, %1:sreg_64, %bb.2
    S_CBRANCH_SCC1 %bb.7, implicit undef $scc
    S_BRANCH %bb.4

  bb.8:
...

# Avoid infinite loop in SIInstrInfo::legalizeGenericOperand when checking for ImpDef.
# GCN-LABEL: name: legalize-operand-search-each-def-once
# GCN-NOT: sreg_64 PHI
---
name: legalize-operand-search-each-def-once
tracksRegLiveness: true
body:               |
  bb.0:
    successors: %bb.1, %bb.2
    liveins: $sgpr0_sgpr1

    %0:sgpr_64 = COPY $sgpr0_sgpr1
    S_CBRANCH_VCCZ %bb.2, implicit undef $vcc
    S_BRANCH %bb.1

  bb.1:
    %1:vreg_64 = IMPLICIT_DEF
    S_BRANCH %bb.2

  bb.2:
    %2:sgpr_64 = PHI %0, %bb.0, %1, %bb.1
    $sgpr0_sgpr1 = COPY %0
...

# A REG_SEQUENCE that uses registers defined by both a PHI and a COPY could
# result in an endless search.
# GCN-LABEL: name: process-phi-search-each-use-once
# GCN-NOT: sreg_32 PHI
---
name: process-phi-search-each-use-once
tracksRegLiveness: true
body:               |
  bb.0:
    successors: %bb.1, %bb.2
    liveins: $vgpr3

    %0:vgpr_32 = COPY $vgpr3
    S_CBRANCH_VCCZ %bb.2, implicit undef $vcc
    S_BRANCH %bb.1

  bb.1:
    %1:sgpr_32 = IMPLICIT_DEF
    S_BRANCH %bb.2

  bb.2:
    %2:sgpr_32 = PHI %0, %bb.0, %1, %bb.1
    %3:vreg_64 = REG_SEQUENCE %2, %subreg.sub0, %0, %subreg.sub1
    $vgpr3 = COPY %3.sub0
...

# Test to ensure that undef SCC gets properly propagated.
# GCN-LABEL: name: scc_undef
# GCN: S_CSELECT_B64 -1, 0, implicit undef $scc
# GCN: V_CNDMASK
---
name: scc_undef
tracksRegLiveness: true

body:               |
  bb.0:
  %1:vgpr_32 = IMPLICIT_DEF
  %2:sreg_32 = S_MOV_B32 1
  %3:sreg_32 = COPY %1:vgpr_32
  %4:sreg_32 = S_CSELECT_B32 killed %2:sreg_32, killed %3:sreg_32, implicit undef $scc
---