File: preserve-only-inactive-lane.mir

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (39 lines) | stat: -rw-r--r-- 2,193 bytes parent folder | download | duplicates (4)
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
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 -verify-machineinstrs -run-pass=prologepilog -o - %s | FileCheck -check-prefix=GCN %s

# The scratch register vgpr0 is used here to spill sgpr35 register.
# The function also returns a value that goes via. vgpr0.
# This test is to ensure the vgpr0 store/restore inserted at the prolog/epilog
# preserves only its inactive lanes to ensure the outgoing value will not be overwritten.

---
name: preserve_scratch_vgpr_inactive_lanes
tracksRegLiveness: true
machineFunctionInfo:
  scratchRSrcReg:  $sgpr0_sgpr1_sgpr2_sgpr3
  frameOffsetReg:  $sgpr33
  stackPtrOffsetReg:  $sgpr32

body:             |
  bb.0:
    liveins: $sgpr35, $vgpr0, $sgpr30_sgpr31
    ; GCN-LABEL: name: preserve_scratch_vgpr_inactive_lanes
    ; GCN: liveins: $sgpr35, $vgpr0, $sgpr30_sgpr31
    ; GCN-NEXT: {{  $}}
    ; GCN-NEXT: $sgpr4_sgpr5 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
    ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5)
    ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr4_sgpr5
    ; GCN-NEXT: renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr0
    ; GCN-NEXT: $sgpr35 = S_MOV_B32 5
    ; GCN-NEXT: $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0
    ; GCN-NEXT: renamable $vgpr0 = V_MOV_B32_e32 10, implicit $exec
    ; GCN-NEXT: $sgpr4_sgpr5 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
    ; GCN-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec, implicit $vgpr0(tied-def 0) :: (load (s32) from %stack.0, addrspace 5)
    ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr4_sgpr5
    ; GCN-NEXT: S_SETPC_B64_return killed renamable $sgpr30_sgpr31, implicit $vgpr0
    renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr0
    $sgpr35 = S_MOV_B32 5
    $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0
    renamable $vgpr0 = V_MOV_B32_e32 10, implicit $exec
    S_SETPC_B64_return killed renamable $sgpr30_sgpr31, implicit $vgpr0
...