reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
# RUN: llc -march=amdgcn -run-pass si-insert-waitcnts %s -o - | FileCheck %s

--- |
  define amdgpu_kernel void @basic_insert_dcache_wb() {
    ret void
  }

  define amdgpu_kernel void @explicit_flush_after() {
    ret void
  }

  define amdgpu_kernel void @explicit_flush_before() {
    ret void
  }

  define amdgpu_kernel void @no_scalar_store() {
    ret void
  }

  define amdgpu_kernel void @multi_block_store() {
  bb0:
    br i1 undef, label %bb1, label %bb2

   bb1:
     ret void

   bb2:
    ret void
  }

  define amdgpu_kernel void @one_block_store() {
  bb0:
    br i1 undef, label %bb1, label %bb2

   bb1:
     ret void

   bb2:
    ret void
  }

  define amdgpu_ps float @si_return() {
    ret float undef
  }

...
---
# CHECK-LABEL: name: basic_insert_dcache_wb
# CHECK: bb.0:
# CHECK-NEXT: S_STORE_DWORD
# CHECK-NEXT: S_DCACHE_WB
# CHECK-NEXT: S_ENDPGM 0

name: basic_insert_dcache_wb
tracksRegLiveness: false
machineFunctionInfo:
  isEntryFunction: true

body: |
  bb.0:
    S_STORE_DWORD_SGPR undef $sgpr2, undef $sgpr0_sgpr1, undef $m0, 0, 0
    S_ENDPGM 0
...
---
# Already has an explicitly requested flush after the last store.
# CHECK-LABEL: name: explicit_flush_after
# CHECK: bb.0:
# CHECK-NEXT: S_STORE_DWORD
# CHECK-NEXT: S_DCACHE_WB
# CHECK-NEXT: S_ENDPGM 0

name: explicit_flush_after
tracksRegLiveness: false
machineFunctionInfo:
  isEntryFunction: true

body: |
  bb.0:
    S_STORE_DWORD_SGPR undef $sgpr2, undef $sgpr0_sgpr1, undef $m0, 0, 0
    S_DCACHE_WB
    S_ENDPGM 0
...
---
# Already has an explicitly requested flush before the last store.
# CHECK-LABEL: name: explicit_flush_before
# CHECK: bb.0:
# CHECK-NEXT: S_DCACHE_WB
# CHECK-NEXT: S_STORE_DWORD
# CHECK-NEXT: S_DCACHE_WB
# CHECK-NEXT: S_ENDPGM 0

name: explicit_flush_before
tracksRegLiveness: false
machineFunctionInfo:
  isEntryFunction: true

body: |
  bb.0:
    S_DCACHE_WB
    S_STORE_DWORD_SGPR undef $sgpr2, undef $sgpr0_sgpr1, undef $m0, 0, 0
    S_ENDPGM 0
...
---
# CHECK-LABEL: no_scalar_store
# CHECK: bb.0
# CHECK-NEXT: S_ENDPGM 0
name: no_scalar_store
tracksRegLiveness: false
machineFunctionInfo:
  isEntryFunction: true

body: |
  bb.0:
    S_ENDPGM 0
...

# CHECK-LABEL: name: multi_block_store
# CHECK: bb.0:
# CHECK-NEXT: S_STORE_DWORD
# CHECK-NEXT: S_DCACHE_WB
# CHECK-NEXT: S_ENDPGM 0

# CHECK: bb.1:
# CHECK-NEXT: S_STORE_DWORD
# CHECK-NEXT: S_DCACHE_WB
# CHECK-NEXT: S_ENDPGM 0

name: multi_block_store
tracksRegLiveness: false
machineFunctionInfo:
  isEntryFunction: true

body: |
  bb.0:
    S_STORE_DWORD_SGPR undef $sgpr2, undef $sgpr0_sgpr1, undef $m0, 0, 0
    S_ENDPGM 0

  bb.1:
    S_STORE_DWORD_SGPR undef $sgpr4, undef $sgpr6_sgpr7, undef $m0, 0, 0
    S_ENDPGM 0
...
...

# This one should be able to omit the flush in the storeless block but
# this isn't handled now.

# CHECK-LABEL: name: one_block_store
# CHECK: bb.0:
# CHECK-NEXT: S_DCACHE_WB
# CHECK-NEXT: S_ENDPGM 0

# CHECK: bb.1:
# CHECK-NEXT: S_STORE_DWORD
# CHECK-NEXT: S_DCACHE_WB
# CHECK-NEXT: S_ENDPGM 0

name: one_block_store
tracksRegLiveness: false
machineFunctionInfo:
  isEntryFunction: true

body: |
  bb.0:
    S_ENDPGM 0

  bb.1:
    S_STORE_DWORD_SGPR undef $sgpr4, undef $sgpr6_sgpr7, undef $m0, 0, 0
    S_ENDPGM 0
...
---
# CHECK-LABEL: name: si_return
# CHECK: bb.0:
# CHECK-NEXT: S_STORE_DWORD
# CHECK-NEXT: S_WAITCNT
# CHECK-NEXT: S_DCACHE_WB
# CHECK-NEXT: SI_RETURN

name: si_return
tracksRegLiveness: false
machineFunctionInfo:
  isEntryFunction: true

body: |
  bb.0:
    S_STORE_DWORD_SGPR undef $sgpr2, undef $sgpr0_sgpr1, undef $m0, 0, 0
    SI_RETURN_TO_EPILOG undef $vgpr0
...