aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AMDGPU/fix-wwm-vgpr-copy.ll
blob: 310f32ce8f83bc8e7fb745010ad4691d6d2e70fa (plain)
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s

; NOTE: llvm.amdgcn.wwm is deprecated, use llvm.amdgcn.strict.wwm instead.

define amdgpu_hs void @wwm(i32 inreg %arg, ptr addrspace(8) inreg %buffer) {
; GCN-LABEL: wwm:
; GCN:       ; %bb.0: ; %entry
; GCN-NEXT:    s_mov_b32 s6, s3
; GCN-NEXT:    s_mov_b32 s5, s2
; GCN-NEXT:    s_or_saveexec_b64 s[2:3], -1
; GCN-NEXT:    s_mov_b32 s7, s4
; GCN-NEXT:    s_mov_b32 s4, s1
; GCN-NEXT:    s_mov_b32 s1, 1
; GCN-NEXT:    v_cndmask_b32_e64 v0, 1, 4, s[2:3]
; GCN-NEXT:    v_lshlrev_b32_e32 v0, 2, v0
; GCN-NEXT:    s_mov_b64 exec, s[2:3]
; GCN-NEXT:    s_cmp_lg_u32 s0, 0
; GCN-NEXT:    v_mov_b32_e32 v1, v0
; GCN-NEXT:    s_cbranch_scc0 .LBB0_2
; GCN-NEXT:  ; %bb.1: ; %bb42
; GCN-NEXT:    s_mov_b32 s1, 0
; GCN-NEXT:  .LBB0_2: ; %bb602
; GCN-NEXT:    v_cmp_ne_u32_e32 vcc, s1, v1
; GCN-NEXT:    s_cbranch_vccnz .LBB0_4
; GCN-NEXT:  ; %bb.3: ; %bb49
; GCN-NEXT:    v_mov_b32_e32 v1, 1.0
; GCN-NEXT:    tbuffer_store_format_x v1, off, s[4:7], 1 format:[BUF_DATA_FORMAT_32,BUF_NUM_FORMAT_FLOAT] offset:4 glc
; GCN-NEXT:  .LBB0_4: ; %bb54
; GCN-NEXT:    s_endpgm
entry:
  br label %work

bb42:
  br label %bb602

bb602:
  %tmp603 = phi i32 [ 0, %bb42 ], [ 1, %work ]
  %tmp607 = icmp eq i32 %tmp603, %tmp1196
  br i1 %tmp607, label %bb49, label %bb54

bb49:
  call void @llvm.amdgcn.raw.ptr.tbuffer.store.f32(float 1.0, ptr addrspace(8) %buffer, i32 4, i32 1, i32 116, i32 1)
  ret void

bb54:
  ret void

work:
  %tmp1189 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 4, i32 1)

  %tmp1191 = mul i32 %tmp1189, 4

  %tmp1196 = tail call i32 @llvm.amdgcn.wwm.i32(i32 %tmp1191)

  %tmp34 = icmp eq i32 %arg, 0
  br i1 %tmp34, label %bb602, label %bb42
}

define amdgpu_hs void @strict_wwm(i32 inreg %arg, ptr addrspace(8) inreg %buffer) {
; GCN-LABEL: strict_wwm:
; GCN:       ; %bb.0: ; %entry
; GCN-NEXT:    s_mov_b32 s6, s3
; GCN-NEXT:    s_mov_b32 s5, s2
; GCN-NEXT:    s_or_saveexec_b64 s[2:3], -1
; GCN-NEXT:    s_mov_b32 s7, s4
; GCN-NEXT:    s_mov_b32 s4, s1
; GCN-NEXT:    s_mov_b32 s1, 1
; GCN-NEXT:    v_cndmask_b32_e64 v0, 1, 4, s[2:3]
; GCN-NEXT:    v_lshlrev_b32_e32 v0, 2, v0
; GCN-NEXT:    s_mov_b64 exec, s[2:3]
; GCN-NEXT:    s_cmp_lg_u32 s0, 0
; GCN-NEXT:    v_mov_b32_e32 v1, v0
; GCN-NEXT:    s_cbranch_scc0 .LBB1_2
; GCN-NEXT:  ; %bb.1: ; %bb42
; GCN-NEXT:    s_mov_b32 s1, 0
; GCN-NEXT:  .LBB1_2: ; %bb602
; GCN-NEXT:    v_cmp_ne_u32_e32 vcc, s1, v1
; GCN-NEXT:    s_cbranch_vccnz .LBB1_4
; GCN-NEXT:  ; %bb.3: ; %bb49
; GCN-NEXT:    v_mov_b32_e32 v1, 1.0
; GCN-NEXT:    tbuffer_store_format_x v1, off, s[4:7], 1 format:[BUF_DATA_FORMAT_32,BUF_NUM_FORMAT_FLOAT] offset:4 glc
; GCN-NEXT:  .LBB1_4: ; %bb54
; GCN-NEXT:    s_endpgm
entry:
  br label %work

bb42:
  br label %bb602

bb602:
  %tmp603 = phi i32 [ 0, %bb42 ], [ 1, %work ]
  %tmp607 = icmp eq i32 %tmp603, %tmp1196
  br i1 %tmp607, label %bb49, label %bb54

bb49:
  call void @llvm.amdgcn.raw.ptr.tbuffer.store.f32(float 1.0, ptr addrspace(8) %buffer, i32 4, i32 1, i32 116, i32 1)
  ret void

bb54:
  ret void

work:
  %tmp1189 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 4, i32 1)

  %tmp1191 = mul i32 %tmp1189, 4

  %tmp1196 = tail call i32 @llvm.amdgcn.strict.wwm.i32(i32 %tmp1191)

  %tmp34 = icmp eq i32 %arg, 0
  br i1 %tmp34, label %bb602, label %bb42
}

declare i32 @llvm.amdgcn.set.inactive.i32(i32, i32) #0
declare i32 @llvm.amdgcn.wwm.i32(i32) #1
declare i32 @llvm.amdgcn.strict.wwm.i32(i32) #1
declare void @llvm.amdgcn.raw.ptr.tbuffer.store.f32(float, ptr addrspace(8), i32, i32, i32 immarg, i32 immarg) #2

attributes #0 = { convergent nounwind readnone willreturn }
attributes #1 = { convergent nounwind readnone speculatable willreturn }
attributes #2 = { nounwind willreturn memory(argmem: write) }