File: arg_promotion.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (190 lines) | stat: -rw-r--r-- 7,217 bytes parent folder | download | duplicates (10)
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
188
189
190
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py

; RUN: opt -S -passes=argpromotion -mtriple=aarch64-unknwon-linux-gnu < %s | FileCheck %s

target triple = "aarch64-unknown-linux-gnu"

; Don't promote a vector pointer argument when the pointee type size is greater
; than 128 bits.

define dso_local void @caller_8xi32(ptr noalias %src, ptr noalias %dst) #0 {
; CHECK-LABEL: define dso_local void @caller_8xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    call fastcc void @callee_8xi32(ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]])
; CHECK-NEXT:    ret void
;
entry:
  call fastcc void @callee_8xi32(ptr noalias %src, ptr noalias %dst)
  ret void
}

define internal fastcc void @callee_8xi32(ptr noalias %src, ptr noalias %dst) #0 {
; CHECK-LABEL: define internal fastcc void @callee_8xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = load <8 x i32>, ptr [[SRC:%.*]], align 16
; CHECK-NEXT:    store <8 x i32> [[TMP0]], ptr [[DST:%.*]], align 16
; CHECK-NEXT:    ret void
;
entry:
  %0 = load <8 x i32>, ptr %src, align 16
  store <8 x i32> %0, ptr %dst, align 16
  ret void
}

; Promote a vector pointer argument when the pointee type size is 128 bits or
; less.

define dso_local void @caller_4xi32(ptr noalias %src, ptr noalias %dst) #1 {
; CHECK-LABEL: define dso_local void @caller_4xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[SRC_VAL:%.*]] = load <4 x i32>, ptr [[SRC:%.*]], align 16
; CHECK-NEXT:    call fastcc void @callee_4xi32(<4 x i32> [[SRC_VAL]], ptr noalias [[DST:%.*]])
; CHECK-NEXT:    ret void
;
entry:
  call fastcc void @callee_4xi32(ptr noalias %src, ptr noalias %dst)
  ret void
}

define internal fastcc void @callee_4xi32(ptr noalias %src, ptr noalias %dst) #1 {
; CHECK-LABEL: define internal fastcc void @callee_4xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    store <4 x i32> [[SRC_0_VAL:%.*]], ptr [[DST:%.*]], align 16
; CHECK-NEXT:    ret void
;
entry:
  %0 = load <4 x i32>, ptr %src, align 16
  store <4 x i32> %0, ptr %dst, align 16
  ret void
}

; A scalar pointer argument is promoted even when the pointee type size is
; greater than 128 bits.

define dso_local void @caller_i256(ptr noalias %src, ptr noalias %dst) #0 {
; CHECK-LABEL: define dso_local void @caller_i256(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[SRC_VAL:%.*]] = load i256, ptr [[SRC:%.*]], align 16
; CHECK-NEXT:    call fastcc void @callee_i256(i256 [[SRC_VAL]], ptr noalias [[DST:%.*]])
; CHECK-NEXT:    ret void
;
entry:
  call fastcc void @callee_i256(ptr noalias %src, ptr noalias %dst)
  ret void
}

define internal fastcc void @callee_i256(ptr noalias %src, ptr noalias %dst) #0 {
; CHECK-LABEL: define internal fastcc void @callee_i256(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    store i256 [[SRC_0_VAL:%.*]], ptr [[DST:%.*]], align 16
; CHECK-NEXT:    ret void
;
entry:
  %0 = load i256, ptr %src, align 16
  store i256 %0, ptr %dst, align 16
  ret void
}

; A scalable vector pointer argument is not a target of ArgumentPromotionPass.

define dso_local void @caller_nx4xi32(ptr noalias %src, ptr noalias %dst) #2 {
; CHECK-LABEL: define dso_local void @caller_nx4xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    call fastcc void @callee_nx4xi32(ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]])
; CHECK-NEXT:    ret void
;
entry:
  call fastcc void @callee_nx4xi32(ptr noalias %src, ptr noalias %dst)
  ret void
}

define internal fastcc void @callee_nx4xi32(ptr noalias %src, ptr noalias %dst) #2 {
; CHECK-LABEL: define internal fastcc void @callee_nx4xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = load <vscale x 4 x i32>, ptr [[SRC:%.*]], align 16
; CHECK-NEXT:    store <vscale x 4 x i32> [[TMP0]], ptr [[DST:%.*]], align 16
; CHECK-NEXT:    ret void
;
entry:
  %0 = load <vscale x 4 x i32>, ptr %src, align 16
  store <vscale x 4 x i32> %0, ptr %dst, align 16
  ret void
}

; Don't promote a structure pointer argument when the pointee vector member
; type size is greater than 128 bits.

%struct_8xi32 = type { <8 x i32>, <8 x i32> }

define dso_local void @caller_struct8xi32(ptr noalias %src, ptr noalias %dst) #0 {
; CHECK-LABEL: define dso_local void @caller_struct8xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    call fastcc void @callee_struct8xi32(ptr noalias [[SRC:%.*]], ptr noalias [[DST:%.*]])
; CHECK-NEXT:    ret void
;
entry:
  call fastcc void @callee_struct8xi32(ptr noalias %src, ptr noalias %dst)
  ret void
}

define internal fastcc void @callee_struct8xi32(ptr noalias %src, ptr noalias %dst) #0 {
; CHECK-LABEL: define internal fastcc void @callee_struct8xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = load <8 x i32>, ptr [[SRC:%.*]], align 16
; CHECK-NEXT:    store <8 x i32> [[TMP0]], ptr [[DST:%.*]], align 16
; CHECK-NEXT:    [[SRC2:%.*]] = getelementptr inbounds [[STRUCT_8XI32:%.*]], ptr [[SRC]], i64 0, i32 1
; CHECK-NEXT:    [[TMP1:%.*]] = load <8 x i32>, ptr [[SRC2]], align 16
; CHECK-NEXT:    [[DST2:%.*]] = getelementptr inbounds [[STRUCT_8XI32]], ptr [[DST]], i64 0, i32 1
; CHECK-NEXT:    store <8 x i32> [[TMP1]], ptr [[DST2]], align 16
; CHECK-NEXT:    ret void
;
entry:
  %0 = load <8 x i32>, ptr %src, align 16
  store <8 x i32> %0, ptr %dst, align 16
  %src2 = getelementptr inbounds %struct_8xi32, ptr %src, i64 0, i32 1
  %1 = load <8 x i32>, ptr %src2, align 16
  %dst2 = getelementptr inbounds %struct_8xi32, ptr %dst, i64 0, i32 1
  store <8 x i32> %1, ptr %dst2, align 16
  ret void
}

; Promote a structure pointer argument when the pointee vector member type size
; is 128 bits or less.

%struct_4xi32 = type { <4 x i32>, <4 x i32> }

define dso_local void @caller_struct4xi32(ptr noalias %src, ptr noalias %dst) #1 {
; CHECK-LABEL: define dso_local void @caller_struct4xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[SRC_VAL:%.*]] = load <4 x i32>, ptr [[SRC:%.*]], align 16
; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr i8, ptr [[SRC]], i64 16
; CHECK-NEXT:    [[SRC_VAL1:%.*]] = load <4 x i32>, ptr [[TMP0]], align 16
; CHECK-NEXT:    call fastcc void @callee_struct4xi32(<4 x i32> [[SRC_VAL]], <4 x i32> [[SRC_VAL1]], ptr noalias [[DST:%.*]])
; CHECK-NEXT:    ret void
;
entry:
  call fastcc void @callee_struct4xi32(ptr noalias %src, ptr noalias %dst)
  ret void
}

define internal fastcc void @callee_struct4xi32(ptr noalias %src, ptr noalias %dst) #1 {
; CHECK-LABEL: define internal fastcc void @callee_struct4xi32(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    store <4 x i32> [[SRC_0_VAL:%.*]], ptr [[DST:%.*]], align 16
; CHECK-NEXT:    [[DST2:%.*]] = getelementptr inbounds [[STRUCT_4XI32:%.*]], ptr [[DST]], i64 0, i32 1
; CHECK-NEXT:    store <4 x i32> [[SRC_16_VAL:%.*]], ptr [[DST2]], align 16
; CHECK-NEXT:    ret void
;
entry:
  %0 = load <4 x i32>, ptr %src, align 16
  store <4 x i32> %0, ptr %dst, align 16
  %src2 = getelementptr inbounds %struct_4xi32, ptr %src, i64 0, i32 1
  %1 = load <4 x i32>, ptr %src2, align 16
  %dst2 = getelementptr inbounds %struct_4xi32, ptr %dst, i64 0, i32 1
  store <4 x i32> %1, ptr %dst2, align 16
  ret void
}

attributes #0 = { noinline vscale_range(2,2) "target-features"="+v8.2a,+neon,+sve" }
attributes #1 = { noinline vscale_range(1,1) "target-features"="+v8.2a,+neon,+sve" }
attributes #2 = { noinline "target-features"="+v8.2a,+neon,+sve" }