File: reassociate-geps-and-slsr-addrspace.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (92 lines) | stat: -rw-r--r-- 4,022 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
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
; RUN: opt -S -mtriple=amdgcn-- -passes=separate-const-offset-from-gep,slsr,gvn < %s | FileCheck %s
; RUN: opt -S -mtriple=amdgcn-- -passes="separate-const-offset-from-gep,slsr,gvn" < %s | FileCheck %s

target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"


; CHECK-LABEL: @slsr_after_reassociate_global_geps_mubuf_max_offset(
; CHECK: [[b1:%[0-9]+]] = getelementptr float, ptr addrspace(1) %arr, i64 [[bump:%[0-9]+]]
; CHECK: [[b2:%[0-9]+]] = getelementptr float, ptr addrspace(1) [[b1]], i64 [[bump]]
define amdgpu_kernel void @slsr_after_reassociate_global_geps_mubuf_max_offset(ptr addrspace(1) %out, ptr addrspace(1) noalias %arr, i32 %i) {
bb:
  %i2 = shl nsw i32 %i, 1
  %j1 = add nsw i32 %i, 1023
  %tmp = sext i32 %j1 to i64
  %p1 = getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp
  %v11 = load i32, ptr addrspace(1) %p1, align 4
  store i32 %v11, ptr addrspace(1) %out, align 4

  %j2 = add nsw i32 %i2, 1023
  %tmp5 = sext i32 %j2 to i64
  %p2 = getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp5
  %v22 = load i32, ptr addrspace(1) %p2, align 4
  store i32 %v22, ptr addrspace(1) %out, align 4

  ret void
}

; CHECK-LABEL: @slsr_after_reassociate_global_geps_over_mubuf_max_offset(
; CHECK: %j1 = add nsw i32 %i, 1024
; CHECK: %tmp = sext i32 %j1 to i64
; CHECK: getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp
; CHECK: getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp5
define amdgpu_kernel void @slsr_after_reassociate_global_geps_over_mubuf_max_offset(ptr addrspace(1) %out, ptr addrspace(1) noalias %arr, i32 %i) {
bb:
  %i2 = shl nsw i32 %i, 1
  %j1 = add nsw i32 %i, 1024
  %tmp = sext i32 %j1 to i64
  %p1 = getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp
  %v11 = load i32, ptr addrspace(1) %p1, align 4
  store i32 %v11, ptr addrspace(1) %out, align 4

  %j2 = add nsw i32 %i2, 1024
  %tmp5 = sext i32 %j2 to i64
  %p2 = getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp5
  %v22 = load i32, ptr addrspace(1) %p2, align 4
  store i32 %v22, ptr addrspace(1) %out, align 4

  ret void
}

; CHECK-LABEL: @slsr_after_reassociate_lds_geps_ds_max_offset(
; CHECK: [[B1:%[0-9]+]] = getelementptr float, ptr addrspace(3) %arr, i32 %i
; CHECK: getelementptr inbounds float, ptr addrspace(3) [[B1]], i32 16383

; CHECK: [[B2:%[0-9]+]] = getelementptr float, ptr addrspace(3) [[B1]], i32 %i
; CHECK: getelementptr inbounds float, ptr addrspace(3) [[B2]], i32 16383
define amdgpu_kernel void @slsr_after_reassociate_lds_geps_ds_max_offset(ptr addrspace(1) %out, ptr addrspace(3) noalias %arr, i32 %i) {
bb:
  %i2 = shl nsw i32 %i, 1
  %j1 = add nsw i32 %i, 16383
  %p1 = getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j1
  %v11 = load i32, ptr addrspace(3) %p1, align 4
  store i32 %v11, ptr addrspace(1) %out, align 4

  %j2 = add nsw i32 %i2, 16383
  %p2 = getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j2
  %v22 = load i32, ptr addrspace(3) %p2, align 4
  store i32 %v22, ptr addrspace(1) %out, align 4

  ret void
}

; CHECK-LABEL: @slsr_after_reassociate_lds_geps_over_ds_max_offset(
; CHECK: %j1 = add nsw i32 %i, 16384
; CHECK: getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j1
; CHECK: %j2 = add i32 %j1, %i
; CHECK: getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j2
define amdgpu_kernel void @slsr_after_reassociate_lds_geps_over_ds_max_offset(ptr addrspace(1) %out, ptr addrspace(3) noalias %arr, i32 %i) {
bb:
  %i2 = shl nsw i32 %i, 1
  %j1 = add nsw i32 %i, 16384
  %p1 = getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j1
  %v11 = load i32, ptr addrspace(3) %p1, align 4
  store i32 %v11, ptr addrspace(1) %out, align 4

  %j2 = add nsw i32 %i2, 16384
  %p2 = getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j2
  %v22 = load i32, ptr addrspace(3) %p2, align 4
  store i32 %v22, ptr addrspace(1) %out, align 4

  ret void
}