File: promote-alloca-stored-pointer-value.ll

package info (click to toggle)
llvm-toolchain-3.8 1%3A3.8.1-24
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 379,280 kB
  • ctags: 388,501
  • sloc: cpp: 2,309,705; ansic: 477,070; objc: 100,918; asm: 97,974; python: 95,911; sh: 18,634; makefile: 7,294; perl: 5,584; ml: 5,460; pascal: 4,661; lisp: 2,548; xml: 686; cs: 350; php: 212; csh: 117
file content (52 lines) | stat: -rw-r--r-- 1,795 bytes parent folder | download | duplicates (3)
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
; RUN: llc -march=amdgcn < %s | FileCheck -check-prefix=GCN %s

; Pointer value is stored in a candidate for LDS usage.

; GCN-LABEL: {{^}}stored_lds_pointer_value:
; GCN: buffer_store_dword v
define void @stored_lds_pointer_value(float* addrspace(1)* %ptr) #0 {
  %tmp = alloca float
  store float 0.0, float *%tmp
  store float* %tmp, float* addrspace(1)* %ptr
  ret void
}

; GCN-LABEL: {{^}}stored_lds_pointer_value_gep:
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1
; GCN: buffer_store_dword v
; GCN: buffer_store_dword v
define void @stored_lds_pointer_value_gep(float* addrspace(1)* %ptr, i32 %idx) #0 {
bb:
  %tmp = alloca float, i32 16
  store float 0.0, float* %tmp
  %tmp2 = getelementptr inbounds float, float* %tmp, i32 %idx
  store float* %tmp2, float* addrspace(1)* %ptr
  ret void
}

; Pointer value is stored in a candidate for vector usage
; GCN-LABEL: {{^}}stored_vector_pointer_value:
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD0
; GCN-DAG: s_mov_b32 s{{[0-9]+}}, SCRATCH_RSRC_DWORD1
; GCN: buffer_store_dword
; GCN: buffer_store_dword
; GCN: buffer_store_dword
; GCN: buffer_store_dword
define void @stored_vector_pointer_value(i32* addrspace(1)* %out, i32 %index) {
entry:
  %tmp0 = alloca [4 x i32]
  %x = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 0
  %y = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 1
  %z = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 2
  %w = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 3
  store i32 0, i32* %x
  store i32 1, i32* %y
  store i32 2, i32* %z
  store i32 3, i32* %w
  %tmp1 = getelementptr [4 x i32], [4 x i32]* %tmp0, i32 0, i32 %index
  store i32* %tmp1, i32* addrspace(1)* %out
  ret void
}

attributes #0 = { nounwind }