xref: /llvm-project/llvm/test/Analysis/CostModel/X86/load-bswap.ll (revision 68c50b111d74afb9489cf97770fa917d0a1c7f77)
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output                           | FileCheck %s --check-prefixes=ALL,X64
3; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe             | FileCheck %s --check-prefixes=ALL,X64-MOVBE
4; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X64-FASTMOVBE
5
6; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output                           | FileCheck %s --check-prefixes=ALL,X32
7; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe             | FileCheck %s --check-prefixes=ALL,X32-MOVBE
8; RUN: opt < %s -mtriple=i686-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -mattr=+movbe,+fast-movbe | FileCheck %s --check-prefixes=ALL,X32-FASTMOVBE
9
10declare i16 @llvm.bswap.i16(i16)
11declare i32 @llvm.bswap.i32(i32)
12declare i64 @llvm.bswap.i64(i64)
13declare i128 @llvm.bswap.i128(i128)
14
15define i16 @var_load_bswap_i16(ptr %src) {
16; X64-LABEL: 'var_load_bswap_i16'
17; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
18; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
19; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
20;
21; X64-MOVBE-LABEL: 'var_load_bswap_i16'
22; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
23; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
24; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
25;
26; X64-FASTMOVBE-LABEL: 'var_load_bswap_i16'
27; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
28; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
29; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
30;
31; X32-LABEL: 'var_load_bswap_i16'
32; X32-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
33; X32-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
34; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
35;
36; X32-MOVBE-LABEL: 'var_load_bswap_i16'
37; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
38; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
39; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
40;
41; X32-FASTMOVBE-LABEL: 'var_load_bswap_i16'
42; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
43; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
44; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
45;
46  %a = load i16, ptr %src, align 1
47  %bswap = call i16 @llvm.bswap.i16(i16 %a)
48
49  ret i16 %bswap
50}
51define i16 @var_load_bswap_i16_extrause(ptr %src, ptr %clobberdst) {
52; ALL-LABEL: 'var_load_bswap_i16_extrause'
53; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %src, align 1
54; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i16 @llvm.bswap.i16(i16 %a)
55; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i16 %a, 2
56; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i16 %a2, ptr %clobberdst, align 1
57; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %bswap
58;
59  %a = load i16, ptr %src, align 1
60  %bswap = call i16 @llvm.bswap.i16(i16 %a)
61
62  %a2 = shl i16 %a, 2 ; incur an extra use to the load
63  store i16 %a2, ptr %clobberdst, align 1
64
65  ret i16 %bswap
66}
67
68define i32 @var_load_bswap_i32(ptr %src) {
69; X64-LABEL: 'var_load_bswap_i32'
70; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
71; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
72; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
73;
74; X64-MOVBE-LABEL: 'var_load_bswap_i32'
75; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
76; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
77; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
78;
79; X64-FASTMOVBE-LABEL: 'var_load_bswap_i32'
80; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
81; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
82; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
83;
84; X32-LABEL: 'var_load_bswap_i32'
85; X32-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
86; X32-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
87; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
88;
89; X32-MOVBE-LABEL: 'var_load_bswap_i32'
90; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
91; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
92; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
93;
94; X32-FASTMOVBE-LABEL: 'var_load_bswap_i32'
95; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
96; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
97; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
98;
99  %a = load i32, ptr %src, align 1
100  %bswap = call i32 @llvm.bswap.i32(i32 %a)
101
102  ret i32 %bswap
103}
104define i32 @var_load_bswap_i32_extrause(ptr %src, ptr %clobberdst) {
105; ALL-LABEL: 'var_load_bswap_i32_extrause'
106; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i32, ptr %src, align 1
107; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i32 @llvm.bswap.i32(i32 %a)
108; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i32 %a, 2
109; ALL-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i32 %a2, ptr %clobberdst, align 1
110; ALL-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %bswap
111;
112  %a = load i32, ptr %src, align 1
113  %bswap = call i32 @llvm.bswap.i32(i32 %a)
114
115  %a2 = shl i32 %a, 2 ; incur an extra use to the load
116  store i32 %a2, ptr %clobberdst, align 1
117
118  ret i32 %bswap
119}
120
121define i64 @var_load_bswap_i64(ptr %src) {
122; X64-LABEL: 'var_load_bswap_i64'
123; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
124; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
125; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
126;
127; X64-MOVBE-LABEL: 'var_load_bswap_i64'
128; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
129; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
130; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
131;
132; X64-FASTMOVBE-LABEL: 'var_load_bswap_i64'
133; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
134; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
135; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
136;
137; X32-LABEL: 'var_load_bswap_i64'
138; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
139; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
140; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
141;
142; X32-MOVBE-LABEL: 'var_load_bswap_i64'
143; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
144; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
145; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
146;
147; X32-FASTMOVBE-LABEL: 'var_load_bswap_i64'
148; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
149; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
150; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
151;
152  %a = load i64, ptr %src, align 1
153  %bswap = call i64 @llvm.bswap.i64(i64 %a)
154
155  ret i64 %bswap
156}
157define i64 @var_load_bswap_i64_extrause(ptr %src, ptr %clobberdst) {
158; X64-LABEL: 'var_load_bswap_i64_extrause'
159; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
160; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
161; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i64 %a, 2
162; X64-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i64 %a2, ptr %clobberdst, align 1
163; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
164;
165; X64-MOVBE-LABEL: 'var_load_bswap_i64_extrause'
166; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
167; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
168; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i64 %a, 2
169; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i64 %a2, ptr %clobberdst, align 1
170; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
171;
172; X64-FASTMOVBE-LABEL: 'var_load_bswap_i64_extrause'
173; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a = load i64, ptr %src, align 1
174; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
175; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %a2 = shl i64 %a, 2
176; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: store i64 %a2, ptr %clobberdst, align 1
177; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
178;
179; X32-LABEL: 'var_load_bswap_i64_extrause'
180; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
181; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
182; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
183; X32-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, ptr %clobberdst, align 1
184; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
185;
186; X32-MOVBE-LABEL: 'var_load_bswap_i64_extrause'
187; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
188; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
189; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
190; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, ptr %clobberdst, align 1
191; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
192;
193; X32-FASTMOVBE-LABEL: 'var_load_bswap_i64_extrause'
194; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i64, ptr %src, align 1
195; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i64 @llvm.bswap.i64(i64 %a)
196; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i64 %a, 2
197; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i64 %a2, ptr %clobberdst, align 1
198; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %bswap
199;
200  %a = load i64, ptr %src, align 1
201  %bswap = call i64 @llvm.bswap.i64(i64 %a)
202
203  %a2 = shl i64 %a, 2 ; incur an extra use to the load
204  store i64 %a2, ptr %clobberdst, align 1
205
206  ret i64 %bswap
207}
208
209define i128 @var_load_bswap_i128(ptr %src) {
210; X64-LABEL: 'var_load_bswap_i128'
211; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
212; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
213; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
214;
215; X64-MOVBE-LABEL: 'var_load_bswap_i128'
216; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
217; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
218; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
219;
220; X64-FASTMOVBE-LABEL: 'var_load_bswap_i128'
221; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
222; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
223; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
224;
225; X32-LABEL: 'var_load_bswap_i128'
226; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
227; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
228; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
229;
230; X32-MOVBE-LABEL: 'var_load_bswap_i128'
231; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
232; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
233; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
234;
235; X32-FASTMOVBE-LABEL: 'var_load_bswap_i128'
236; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
237; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
238; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
239;
240  %a = load i128, ptr %src, align 1
241  %bswap = call i128 @llvm.bswap.i128(i128 %a)
242
243  ret i128 %bswap
244}
245define i128 @var_load_bswap_i128_extrause(ptr %src, ptr %clobberdst) {
246; X64-LABEL: 'var_load_bswap_i128_extrause'
247; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
248; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
249; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i128 %a, 2
250; X64-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i128 %a2, ptr %clobberdst, align 1
251; X64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
252;
253; X64-MOVBE-LABEL: 'var_load_bswap_i128_extrause'
254; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
255; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
256; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i128 %a, 2
257; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i128 %a2, ptr %clobberdst, align 1
258; X64-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
259;
260; X64-FASTMOVBE-LABEL: 'var_load_bswap_i128_extrause'
261; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a = load i128, ptr %src, align 1
262; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
263; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %a2 = shl i128 %a, 2
264; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: store i128 %a2, ptr %clobberdst, align 1
265; X64-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
266;
267; X32-LABEL: 'var_load_bswap_i128_extrause'
268; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
269; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
270; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
271; X32-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, ptr %clobberdst, align 1
272; X32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
273;
274; X32-MOVBE-LABEL: 'var_load_bswap_i128_extrause'
275; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
276; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
277; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
278; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, ptr %clobberdst, align 1
279; X32-MOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
280;
281; X32-FASTMOVBE-LABEL: 'var_load_bswap_i128_extrause'
282; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a = load i128, ptr %src, align 1
283; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %bswap = call i128 @llvm.bswap.i128(i128 %a)
284; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %a2 = shl i128 %a, 2
285; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: store i128 %a2, ptr %clobberdst, align 1
286; X32-FASTMOVBE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i128 %bswap
287;
288  %a = load i128, ptr %src, align 1
289  %bswap = call i128 @llvm.bswap.i128(i128 %a)
290
291  %a2 = shl i128 %a, 2 ; incur an extra use to the load
292  store i128 %a2, ptr %clobberdst, align 1
293
294  ret i128 %bswap
295}
296