1use rustc_abi::ExternAbi;
4use rustc_errors::DiagMessage;
5use rustc_hir::{self as hir, LangItem};
6use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
7use rustc_middle::ty::{self, Const, Ty, TyCtxt};
8use rustc_span::def_id::LocalDefId;
9use rustc_span::{Span, Symbol, sym};
10
11use crate::check::check_function_signature;
12use crate::errors::{UnrecognizedIntrinsicFunction, WrongNumberOfGenericArgumentsToIntrinsic};
13
14fn equate_intrinsic_type<'tcx>(
15 tcx: TyCtxt<'tcx>,
16 span: Span,
17 def_id: LocalDefId,
18 n_tps: usize,
19 n_lts: usize,
20 n_cts: usize,
21 sig: ty::PolyFnSig<'tcx>,
22) {
23 let (generics, span) = match tcx.hir_node_by_def_id(def_id) {
24 hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn { generics, .. }, .. }) => {
25 (tcx.generics_of(def_id), generics.span)
26 }
27 _ => tcx.dcx().span_bug(span, "intrinsic must be a function"),
28 };
29 let own_counts = generics.own_counts();
30
31 let gen_count_ok = |found: usize, expected: usize, descr: &str| -> bool {
32 if found != expected {
33 tcx.dcx().emit_err(WrongNumberOfGenericArgumentsToIntrinsic {
34 span,
35 found,
36 expected,
37 descr,
38 });
39 false
40 } else {
41 true
42 }
43 };
44
45 if gen_count_ok(own_counts.lifetimes, n_lts, "lifetime")
48 && gen_count_ok(own_counts.types, n_tps, "type")
49 && gen_count_ok(own_counts.consts, n_cts, "const")
50 {
51 let _ = check_function_signature(
52 tcx,
53 ObligationCause::new(span, def_id, ObligationCauseCode::IntrinsicType),
54 def_id.into(),
55 sig,
56 );
57 }
58}
59
60fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hir::Safety {
62 let is_in_list = match tcx.item_name(intrinsic_id) {
63 | sym::abort
70 | sym::add_with_overflow
71 | sym::aggregate_raw_ptr
72 | sym::align_of
73 | sym::amdgpu_dispatch_ptr
74 | sym::assert_inhabited
75 | sym::assert_mem_uninitialized_valid
76 | sym::assert_zero_valid
77 | sym::autodiff
78 | sym::bitreverse
79 | sym::black_box
80 | sym::box_new
81 | sym::breakpoint
82 | sym::bswap
83 | sym::caller_location
84 | sym::carrying_mul_add
85 | sym::ceilf16
86 | sym::ceilf32
87 | sym::ceilf64
88 | sym::ceilf128
89 | sym::cold_path
90 | sym::const_eval_select
91 | sym::contract_check_ensures
92 | sym::contract_check_requires
93 | sym::contract_checks
94 | sym::copysignf16
95 | sym::copysignf32
96 | sym::copysignf64
97 | sym::copysignf128
98 | sym::cosf16
99 | sym::cosf32
100 | sym::cosf64
101 | sym::cosf128
102 | sym::ctlz
103 | sym::ctpop
104 | sym::cttz
105 | sym::discriminant_value
106 | sym::exp2f16
107 | sym::exp2f32
108 | sym::exp2f64
109 | sym::exp2f128
110 | sym::expf16
111 | sym::expf32
112 | sym::expf64
113 | sym::expf128
114 | sym::fabsf16
115 | sym::fabsf32
116 | sym::fabsf64
117 | sym::fabsf128
118 | sym::fadd_algebraic
119 | sym::fdiv_algebraic
120 | sym::floorf16
121 | sym::floorf32
122 | sym::floorf64
123 | sym::floorf128
124 | sym::fmaf16
125 | sym::fmaf32
126 | sym::fmaf64
127 | sym::fmaf128
128 | sym::fmul_algebraic
129 | sym::fmuladdf16
130 | sym::fmuladdf32
131 | sym::fmuladdf64
132 | sym::fmuladdf128
133 | sym::forget
134 | sym::frem_algebraic
135 | sym::fsub_algebraic
136 | sym::is_val_statically_known
137 | sym::log2f16
138 | sym::log2f32
139 | sym::log2f64
140 | sym::log2f128
141 | sym::log10f16
142 | sym::log10f32
143 | sym::log10f64
144 | sym::log10f128
145 | sym::logf16
146 | sym::logf32
147 | sym::logf64
148 | sym::logf128
149 | sym::maximumf16
150 | sym::maximumf32
151 | sym::maximumf64
152 | sym::maximumf128
153 | sym::maxnumf16
154 | sym::maxnumf32
155 | sym::maxnumf64
156 | sym::maxnumf128
157 | sym::minimumf16
158 | sym::minimumf32
159 | sym::minimumf64
160 | sym::minimumf128
161 | sym::minnumf16
162 | sym::minnumf32
163 | sym::minnumf64
164 | sym::minnumf128
165 | sym::mul_with_overflow
166 | sym::needs_drop
167 | sym::offload
168 | sym::offset_of
169 | sym::overflow_checks
170 | sym::powf16
171 | sym::powf32
172 | sym::powf64
173 | sym::powf128
174 | sym::powif16
175 | sym::powif32
176 | sym::powif64
177 | sym::powif128
178 | sym::prefetch_read_data
179 | sym::prefetch_read_instruction
180 | sym::prefetch_write_data
181 | sym::prefetch_write_instruction
182 | sym::ptr_guaranteed_cmp
183 | sym::ptr_mask
184 | sym::ptr_metadata
185 | sym::rotate_left
186 | sym::rotate_right
187 | sym::round_ties_even_f16
188 | sym::round_ties_even_f32
189 | sym::round_ties_even_f64
190 | sym::round_ties_even_f128
191 | sym::roundf16
192 | sym::roundf32
193 | sym::roundf64
194 | sym::roundf128
195 | sym::rustc_peek
196 | sym::saturating_add
197 | sym::saturating_sub
198 | sym::select_unpredictable
199 | sym::sinf16
200 | sym::sinf32
201 | sym::sinf64
202 | sym::sinf128
203 | sym::size_of
204 | sym::sqrtf16
205 | sym::sqrtf32
206 | sym::sqrtf64
207 | sym::sqrtf128
208 | sym::sub_with_overflow
209 | sym::three_way_compare
210 | sym::truncf16
211 | sym::truncf32
212 | sym::truncf64
213 | sym::truncf128
214 | sym::type_id
215 | sym::type_id_eq
216 | sym::type_name
217 | sym::type_of
218 | sym::ub_checks
219 | sym::variant_count
220 | sym::vtable_for
221 | sym::wrapping_add
222 | sym::wrapping_mul
223 | sym::wrapping_sub
224 => hir::Safety::Safe,
226 _ => hir::Safety::Unsafe,
227 };
228
229 if tcx.fn_sig(intrinsic_id).skip_binder().safety() != is_in_list {
230 tcx.dcx().struct_span_err(
231 tcx.def_span(intrinsic_id),
232 DiagMessage::from(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `{0}`",
tcx.item_name(intrinsic_id)))
})format!(
233 "intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `{}`",
234 tcx.item_name(intrinsic_id)
235 )
236 )).emit();
237 }
238
239 is_in_list
240}
241
242pub(crate) fn check_intrinsic_type(
245 tcx: TyCtxt<'_>,
246 intrinsic_id: LocalDefId,
247 span: Span,
248 intrinsic_name: Symbol,
249) {
250 let generics = tcx.generics_of(intrinsic_id);
251 let param = |n| {
252 if let &ty::GenericParamDef { name, kind: ty::GenericParamDefKind::Type { .. }, .. } =
253 generics.param_at(n as usize, tcx)
254 {
255 Ty::new_param(tcx, n, name)
256 } else {
257 Ty::new_error_with_message(tcx, span, "expected param")
258 }
259 };
260
261 let bound_vars = tcx.mk_bound_variable_kinds(&[
262 ty::BoundVariableKind::Region(ty::BoundRegionKind::Anon),
263 ty::BoundVariableKind::Region(ty::BoundRegionKind::Anon),
264 ty::BoundVariableKind::Region(ty::BoundRegionKind::ClosureEnv),
265 ]);
266 let mk_va_list_ty = |mutbl| {
267 let did = tcx.require_lang_item(LangItem::VaList, span);
268 let region = ty::Region::new_bound(
269 tcx,
270 ty::INNERMOST,
271 ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BoundRegionKind::Anon },
272 );
273 let env_region = ty::Region::new_bound(
274 tcx,
275 ty::INNERMOST,
276 ty::BoundRegion {
277 var: ty::BoundVar::from_u32(2),
278 kind: ty::BoundRegionKind::ClosureEnv,
279 },
280 );
281 let va_list_ty = tcx.type_of(did).instantiate(tcx, &[region.into()]);
282 (Ty::new_ref(tcx, env_region, va_list_ty, mutbl), va_list_ty)
283 };
284
285 let safety = intrinsic_operation_unsafety(tcx, intrinsic_id);
286 let n_lts = 0;
287 let (n_tps, n_cts, inputs, output) = match intrinsic_name {
288 sym::autodiff => (4, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1), param(2)]))vec![param(0), param(1), param(2)], param(3)),
289 sym::abort => (0, 0, ::alloc::vec::Vec::new()vec![], tcx.types.never),
290 sym::amdgpu_dispatch_ptr => (0, 0, ::alloc::vec::Vec::new()vec![], Ty::new_imm_ptr(tcx, tcx.types.unit)),
291 sym::unreachable => (0, 0, ::alloc::vec::Vec::new()vec![], tcx.types.never),
292 sym::breakpoint => (0, 0, ::alloc::vec::Vec::new()vec![], tcx.types.unit),
293 sym::size_of | sym::align_of | sym::variant_count => (1, 0, ::alloc::vec::Vec::new()vec![], tcx.types.usize),
294 sym::size_of_val | sym::align_of_val => {
295 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0))]))vec![Ty::new_imm_ptr(tcx, param(0))], tcx.types.usize)
296 }
297 sym::offset_of => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.u32, tcx.types.u32]))vec![tcx.types.u32, tcx.types.u32], tcx.types.usize),
298 sym::rustc_peek => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], param(0)),
299 sym::caller_location => (0, 0, ::alloc::vec::Vec::new()vec![], tcx.caller_location_ty()),
300 sym::assert_inhabited | sym::assert_zero_valid | sym::assert_mem_uninitialized_valid => {
301 (1, 0, ::alloc::vec::Vec::new()vec![], tcx.types.unit)
302 }
303 sym::forget => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], tcx.types.unit),
304 sym::transmute | sym::transmute_unchecked => (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], param(1)),
305 sym::prefetch_read_data
306 | sym::prefetch_write_data
307 | sym::prefetch_read_instruction
308 | sym::prefetch_write_instruction => {
309 (1, 1, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0))]))vec![Ty::new_imm_ptr(tcx, param(0))], tcx.types.unit)
310 }
311 sym::needs_drop => (1, 0, ::alloc::vec::Vec::new()vec![], tcx.types.bool),
312
313 sym::type_name => (1, 0, ::alloc::vec::Vec::new()vec![], Ty::new_static_str(tcx)),
314 sym::type_id => (
315 1,
316 0,
317 ::alloc::vec::Vec::new()vec![],
318 tcx.type_of(tcx.lang_items().type_id().unwrap()).no_bound_vars().unwrap(),
319 ),
320 sym::type_id_eq => {
321 let type_id = tcx.type_of(tcx.lang_items().type_id().unwrap()).no_bound_vars().unwrap();
322 (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([type_id, type_id]))vec![type_id, type_id], tcx.types.bool)
323 }
324 sym::type_of => (
325 0,
326 0,
327 <[_]>::into_vec(::alloc::boxed::box_new([tcx.type_of(tcx.lang_items().type_id().unwrap()).no_bound_vars().unwrap()]))vec![tcx.type_of(tcx.lang_items().type_id().unwrap()).no_bound_vars().unwrap()],
328 tcx.type_of(tcx.lang_items().type_struct().unwrap()).no_bound_vars().unwrap(),
329 ),
330 sym::offload => (
331 3,
332 0,
333 <[_]>::into_vec(::alloc::boxed::box_new([param(0),
Ty::new_array_with_const_len(tcx, tcx.types.u32,
Const::from_target_usize(tcx, 3)),
Ty::new_array_with_const_len(tcx, tcx.types.u32,
Const::from_target_usize(tcx, 3)), param(1)]))vec![
334 param(0),
335 Ty::new_array_with_const_len(tcx, tcx.types.u32, Const::from_target_usize(tcx, 3)),
336 Ty::new_array_with_const_len(tcx, tcx.types.u32, Const::from_target_usize(tcx, 3)),
337 param(1),
338 ],
339 param(2),
340 ),
341 sym::offset => (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1)]))vec![param(0), param(1)], param(0)),
342 sym::arith_offset => (
343 1,
344 0,
345 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0)),
tcx.types.isize]))vec![Ty::new_imm_ptr(tcx, param(0)), tcx.types.isize],
346 Ty::new_imm_ptr(tcx, param(0)),
347 ),
348 sym::slice_get_unchecked => (3, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(1), tcx.types.usize]))vec![param(1), tcx.types.usize], param(0)),
349 sym::ptr_mask => (
350 1,
351 0,
352 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0)),
tcx.types.usize]))vec![Ty::new_imm_ptr(tcx, param(0)), tcx.types.usize],
353 Ty::new_imm_ptr(tcx, param(0)),
354 ),
355
356 sym::copy | sym::copy_nonoverlapping => (
357 1,
358 0,
359 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0)),
Ty::new_mut_ptr(tcx, param(0)), tcx.types.usize]))vec![Ty::new_imm_ptr(tcx, param(0)), Ty::new_mut_ptr(tcx, param(0)), tcx.types.usize],
360 tcx.types.unit,
361 ),
362 sym::volatile_copy_memory | sym::volatile_copy_nonoverlapping_memory => (
363 1,
364 0,
365 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, param(0)),
Ty::new_imm_ptr(tcx, param(0)), tcx.types.usize]))vec![Ty::new_mut_ptr(tcx, param(0)), Ty::new_imm_ptr(tcx, param(0)), tcx.types.usize],
366 tcx.types.unit,
367 ),
368 sym::compare_bytes => {
369 let byte_ptr = Ty::new_imm_ptr(tcx, tcx.types.u8);
370 (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([byte_ptr, byte_ptr,
tcx.types.usize]))vec![byte_ptr, byte_ptr, tcx.types.usize], tcx.types.i32)
371 }
372 sym::write_bytes | sym::volatile_set_memory => (
373 1,
374 0,
375 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, param(0)),
tcx.types.u8, tcx.types.usize]))vec![Ty::new_mut_ptr(tcx, param(0)), tcx.types.u8, tcx.types.usize],
376 tcx.types.unit,
377 ),
378
379 sym::sqrtf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
380 sym::sqrtf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
381 sym::sqrtf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
382 sym::sqrtf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
383
384 sym::powif16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16, tcx.types.i32]))vec![tcx.types.f16, tcx.types.i32], tcx.types.f16),
385 sym::powif32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32, tcx.types.i32]))vec![tcx.types.f32, tcx.types.i32], tcx.types.f32),
386 sym::powif64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64, tcx.types.i32]))vec![tcx.types.f64, tcx.types.i32], tcx.types.f64),
387 sym::powif128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128, tcx.types.i32]))vec![tcx.types.f128, tcx.types.i32], tcx.types.f128),
388
389 sym::sinf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
390 sym::sinf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
391 sym::sinf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
392 sym::sinf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
393
394 sym::cosf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
395 sym::cosf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
396 sym::cosf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
397 sym::cosf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
398
399 sym::powf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16, tcx.types.f16]))vec![tcx.types.f16, tcx.types.f16], tcx.types.f16),
400 sym::powf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32, tcx.types.f32]))vec![tcx.types.f32, tcx.types.f32], tcx.types.f32),
401 sym::powf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64, tcx.types.f64]))vec![tcx.types.f64, tcx.types.f64], tcx.types.f64),
402 sym::powf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128, tcx.types.f128]))vec![tcx.types.f128, tcx.types.f128], tcx.types.f128),
403
404 sym::expf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
405 sym::expf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
406 sym::expf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
407 sym::expf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
408
409 sym::exp2f16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
410 sym::exp2f32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
411 sym::exp2f64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
412 sym::exp2f128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
413
414 sym::logf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
415 sym::logf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
416 sym::logf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
417 sym::logf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
418
419 sym::log10f16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
420 sym::log10f32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
421 sym::log10f64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
422 sym::log10f128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
423
424 sym::log2f16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
425 sym::log2f32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
426 sym::log2f64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
427 sym::log2f128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
428
429 sym::fmaf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16, tcx.types.f16,
tcx.types.f16]))vec![tcx.types.f16, tcx.types.f16, tcx.types.f16], tcx.types.f16),
430 sym::fmaf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32, tcx.types.f32,
tcx.types.f32]))vec![tcx.types.f32, tcx.types.f32, tcx.types.f32], tcx.types.f32),
431 sym::fmaf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64, tcx.types.f64,
tcx.types.f64]))vec![tcx.types.f64, tcx.types.f64, tcx.types.f64], tcx.types.f64),
432 sym::fmaf128 => {
433 (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128, tcx.types.f128,
tcx.types.f128]))vec![tcx.types.f128, tcx.types.f128, tcx.types.f128], tcx.types.f128)
434 }
435
436 sym::fmuladdf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16, tcx.types.f16,
tcx.types.f16]))vec![tcx.types.f16, tcx.types.f16, tcx.types.f16], tcx.types.f16),
437 sym::fmuladdf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32, tcx.types.f32,
tcx.types.f32]))vec![tcx.types.f32, tcx.types.f32, tcx.types.f32], tcx.types.f32),
438 sym::fmuladdf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64, tcx.types.f64,
tcx.types.f64]))vec![tcx.types.f64, tcx.types.f64, tcx.types.f64], tcx.types.f64),
439 sym::fmuladdf128 => {
440 (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128, tcx.types.f128,
tcx.types.f128]))vec![tcx.types.f128, tcx.types.f128, tcx.types.f128], tcx.types.f128)
441 }
442
443 sym::fabsf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
444 sym::fabsf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
445 sym::fabsf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
446 sym::fabsf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
447
448 sym::minnumf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16, tcx.types.f16]))vec![tcx.types.f16, tcx.types.f16], tcx.types.f16),
449 sym::minnumf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32, tcx.types.f32]))vec![tcx.types.f32, tcx.types.f32], tcx.types.f32),
450 sym::minnumf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64, tcx.types.f64]))vec![tcx.types.f64, tcx.types.f64], tcx.types.f64),
451 sym::minnumf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128, tcx.types.f128]))vec![tcx.types.f128, tcx.types.f128], tcx.types.f128),
452
453 sym::minimumf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16, tcx.types.f16]))vec![tcx.types.f16, tcx.types.f16], tcx.types.f16),
454 sym::minimumf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32, tcx.types.f32]))vec![tcx.types.f32, tcx.types.f32], tcx.types.f32),
455 sym::minimumf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64, tcx.types.f64]))vec![tcx.types.f64, tcx.types.f64], tcx.types.f64),
456 sym::minimumf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128, tcx.types.f128]))vec![tcx.types.f128, tcx.types.f128], tcx.types.f128),
457
458 sym::maxnumf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16, tcx.types.f16]))vec![tcx.types.f16, tcx.types.f16], tcx.types.f16),
459 sym::maxnumf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32, tcx.types.f32]))vec![tcx.types.f32, tcx.types.f32], tcx.types.f32),
460 sym::maxnumf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64, tcx.types.f64]))vec![tcx.types.f64, tcx.types.f64], tcx.types.f64),
461 sym::maxnumf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128, tcx.types.f128]))vec![tcx.types.f128, tcx.types.f128], tcx.types.f128),
462
463 sym::maximumf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16, tcx.types.f16]))vec![tcx.types.f16, tcx.types.f16], tcx.types.f16),
464 sym::maximumf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32, tcx.types.f32]))vec![tcx.types.f32, tcx.types.f32], tcx.types.f32),
465 sym::maximumf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64, tcx.types.f64]))vec![tcx.types.f64, tcx.types.f64], tcx.types.f64),
466 sym::maximumf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128, tcx.types.f128]))vec![tcx.types.f128, tcx.types.f128], tcx.types.f128),
467
468 sym::copysignf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16, tcx.types.f16]))vec![tcx.types.f16, tcx.types.f16], tcx.types.f16),
469 sym::copysignf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32, tcx.types.f32]))vec![tcx.types.f32, tcx.types.f32], tcx.types.f32),
470 sym::copysignf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64, tcx.types.f64]))vec![tcx.types.f64, tcx.types.f64], tcx.types.f64),
471 sym::copysignf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128, tcx.types.f128]))vec![tcx.types.f128, tcx.types.f128], tcx.types.f128),
472
473 sym::floorf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
474 sym::floorf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
475 sym::floorf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
476 sym::floorf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
477
478 sym::ceilf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
479 sym::ceilf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
480 sym::ceilf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
481 sym::ceilf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
482
483 sym::truncf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
484 sym::truncf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
485 sym::truncf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
486 sym::truncf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
487
488 sym::round_ties_even_f16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
489 sym::round_ties_even_f32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
490 sym::round_ties_even_f64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
491 sym::round_ties_even_f128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
492
493 sym::roundf16 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f16]))vec![tcx.types.f16], tcx.types.f16),
494 sym::roundf32 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f32]))vec![tcx.types.f32], tcx.types.f32),
495 sym::roundf64 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f64]))vec![tcx.types.f64], tcx.types.f64),
496 sym::roundf128 => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.f128]))vec![tcx.types.f128], tcx.types.f128),
497
498 sym::volatile_load | sym::unaligned_volatile_load => {
499 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0))]))vec![Ty::new_imm_ptr(tcx, param(0))], param(0))
500 }
501 sym::volatile_store | sym::unaligned_volatile_store => {
502 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, param(0)),
param(0)]))vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
503 }
504
505 sym::ctpop | sym::ctlz | sym::ctlz_nonzero | sym::cttz | sym::cttz_nonzero => {
506 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], tcx.types.u32)
507 }
508
509 sym::bswap | sym::bitreverse => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], param(0)),
510
511 sym::three_way_compare => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], tcx.ty_ordering_enum(span)),
512
513 sym::add_with_overflow | sym::sub_with_overflow | sym::mul_with_overflow => {
514 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], Ty::new_tup(tcx, &[param(0), tcx.types.bool]))
515 }
516
517 sym::carrying_mul_add => (2, 0, ::alloc::vec::from_elem(param(0), 4)vec![param(0); 4], Ty::new_tup(tcx, &[param(1), param(0)])),
518
519 sym::ptr_guaranteed_cmp => (
520 1,
521 0,
522 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0)),
Ty::new_imm_ptr(tcx, param(0))]))vec![Ty::new_imm_ptr(tcx, param(0)), Ty::new_imm_ptr(tcx, param(0))],
523 tcx.types.u8,
524 ),
525
526 sym::const_allocate => {
527 (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.usize, tcx.types.usize]))vec![tcx.types.usize, tcx.types.usize], Ty::new_mut_ptr(tcx, tcx.types.u8))
528 }
529 sym::const_deallocate => (
530 0,
531 0,
532 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, tcx.types.u8),
tcx.types.usize, tcx.types.usize]))vec![Ty::new_mut_ptr(tcx, tcx.types.u8), tcx.types.usize, tcx.types.usize],
533 tcx.types.unit,
534 ),
535 sym::const_make_global => {
536 (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, tcx.types.u8)]))vec![Ty::new_mut_ptr(tcx, tcx.types.u8)], Ty::new_imm_ptr(tcx, tcx.types.u8))
537 }
538
539 sym::ptr_offset_from => (
540 1,
541 0,
542 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0)),
Ty::new_imm_ptr(tcx, param(0))]))vec![Ty::new_imm_ptr(tcx, param(0)), Ty::new_imm_ptr(tcx, param(0))],
543 tcx.types.isize,
544 ),
545 sym::ptr_offset_from_unsigned => (
546 1,
547 0,
548 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0)),
Ty::new_imm_ptr(tcx, param(0))]))vec![Ty::new_imm_ptr(tcx, param(0)), Ty::new_imm_ptr(tcx, param(0))],
549 tcx.types.usize,
550 ),
551 sym::unchecked_div | sym::unchecked_rem | sym::exact_div | sym::disjoint_bitor => {
552 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], param(0))
553 }
554 sym::unchecked_shl | sym::unchecked_shr => (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1)]))vec![param(0), param(1)], param(0)),
555 sym::rotate_left | sym::rotate_right => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), tcx.types.u32]))vec![param(0), tcx.types.u32], param(0)),
556 sym::unchecked_funnel_shl | sym::unchecked_funnel_shr => {
557 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0), tcx.types.u32]))vec![param(0), param(0), tcx.types.u32], param(0))
558 }
559 sym::unchecked_add | sym::unchecked_sub | sym::unchecked_mul => {
560 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], param(0))
561 }
562 sym::wrapping_add | sym::wrapping_sub | sym::wrapping_mul => {
563 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], param(0))
564 }
565 sym::saturating_add | sym::saturating_sub => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], param(0)),
566 sym::fadd_fast | sym::fsub_fast | sym::fmul_fast | sym::fdiv_fast | sym::frem_fast => {
567 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], param(0))
568 }
569 sym::fadd_algebraic
570 | sym::fsub_algebraic
571 | sym::fmul_algebraic
572 | sym::fdiv_algebraic
573 | sym::frem_algebraic => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], param(0)),
574 sym::float_to_int_unchecked => (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], param(1)),
575
576 sym::assume => (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.bool]))vec![tcx.types.bool], tcx.types.unit),
577 sym::select_unpredictable => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([tcx.types.bool, param(0), param(0)]))vec![tcx.types.bool, param(0), param(0)], param(0)),
578 sym::cold_path => (0, 0, ::alloc::vec::Vec::new()vec![], tcx.types.unit),
579
580 sym::read_via_copy => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0))]))vec![Ty::new_imm_ptr(tcx, param(0))], param(0)),
581 sym::write_via_move => {
582 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, param(0)),
param(0)]))vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
583 }
584
585 sym::typed_swap_nonoverlapping => {
586 (1, 0, ::alloc::vec::from_elem(Ty::new_mut_ptr(tcx, param(0)), 2)vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit)
587 }
588
589 sym::discriminant_value => {
590 let assoc_items = tcx.associated_item_def_ids(
591 tcx.require_lang_item(hir::LangItem::DiscriminantKind, span),
592 );
593 let discriminant_def_id = assoc_items[0];
594
595 let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BoundRegionKind::Anon };
596 (
597 1,
598 0,
599 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ref(tcx,
ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0))]))vec![Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0))],
600 Ty::new_projection_from_args(
601 tcx,
602 discriminant_def_id,
603 tcx.mk_args(&[param(0).into()]),
604 ),
605 )
606 }
607
608 sym::catch_unwind => {
609 let mut_u8 = Ty::new_mut_ptr(tcx, tcx.types.u8);
610 let try_fn_ty = ty::Binder::dummy(tcx.mk_fn_sig(
611 [mut_u8],
612 tcx.types.unit,
613 false,
614 hir::Safety::Safe,
615 ExternAbi::Rust,
616 ));
617 let catch_fn_ty = ty::Binder::dummy(tcx.mk_fn_sig(
618 [mut_u8, mut_u8],
619 tcx.types.unit,
620 false,
621 hir::Safety::Safe,
622 ExternAbi::Rust,
623 ));
624 (
625 0,
626 0,
627 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_fn_ptr(tcx, try_fn_ty),
mut_u8, Ty::new_fn_ptr(tcx, catch_fn_ty)]))vec![Ty::new_fn_ptr(tcx, try_fn_ty), mut_u8, Ty::new_fn_ptr(tcx, catch_fn_ty)],
628 tcx.types.i32,
629 )
630 }
631
632 sym::va_start | sym::va_end => {
633 (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([mk_va_list_ty(hir::Mutability::Mut).0]))vec![mk_va_list_ty(hir::Mutability::Mut).0], tcx.types.unit)
634 }
635
636 sym::va_copy => {
637 let (va_list_ref_ty, va_list_ty) = mk_va_list_ty(hir::Mutability::Not);
638 let va_list_ptr_ty = Ty::new_mut_ptr(tcx, va_list_ty);
639 (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([va_list_ptr_ty, va_list_ref_ty]))vec![va_list_ptr_ty, va_list_ref_ty], tcx.types.unit)
640 }
641
642 sym::va_arg => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([mk_va_list_ty(hir::Mutability::Mut).0]))vec![mk_va_list_ty(hir::Mutability::Mut).0], param(0)),
643
644 sym::nontemporal_store => {
645 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, param(0)),
param(0)]))vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
646 }
647
648 sym::raw_eq => {
649 let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BoundRegionKind::Anon };
650 let param_ty_lhs =
651 Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0));
652 let br =
653 ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BoundRegionKind::Anon };
654 let param_ty_rhs =
655 Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0));
656 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param_ty_lhs, param_ty_rhs]))vec![param_ty_lhs, param_ty_rhs], tcx.types.bool)
657 }
658
659 sym::black_box => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], param(0)),
660
661 sym::is_val_statically_known => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], tcx.types.bool),
662
663 sym::const_eval_select => (4, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1), param(2)]))vec![param(0), param(1), param(2)], param(3)),
664
665 sym::vtable_size | sym::vtable_align => {
666 (0, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx,
tcx.types.unit)]))vec![Ty::new_imm_ptr(tcx, tcx.types.unit)], tcx.types.usize)
667 }
668
669 sym::vtable_for => {
670 let dyn_metadata = tcx.require_lang_item(LangItem::DynMetadata, span);
671 let dyn_metadata_adt_ref = tcx.adt_def(dyn_metadata);
672 let dyn_metadata_args = tcx.mk_args(&[param(1).into()]);
673 let dyn_ty = Ty::new_adt(tcx, dyn_metadata_adt_ref, dyn_metadata_args);
674
675 let option_did = tcx.require_lang_item(LangItem::Option, span);
676 let option_adt_ref = tcx.adt_def(option_did);
677 let option_args = tcx.mk_args(&[dyn_ty.into()]);
678 let ret_ty = Ty::new_adt(tcx, option_adt_ref, option_args);
679
680 (2, 0, ::alloc::vec::Vec::new()vec![], ret_ty)
681 }
682
683 sym::aggregate_raw_ptr => (3, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(1), param(2)]))vec![param(1), param(2)], param(0)),
686 sym::ptr_metadata => (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0))]))vec![Ty::new_imm_ptr(tcx, param(0))], param(1)),
687
688 sym::ub_checks | sym::overflow_checks => (0, 0, Vec::new(), tcx.types.bool),
689
690 sym::box_new => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], Ty::new_box(tcx, param(0))),
691
692 sym::contract_check_requires => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], tcx.types.unit),
694 sym::contract_check_ensures => {
695 (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_option(tcx, param(0)),
param(1)]))vec![Ty::new_option(tcx, param(0)), param(1)], param(1))
696 }
697
698 sym::simd_eq | sym::simd_ne | sym::simd_lt | sym::simd_le | sym::simd_gt | sym::simd_ge => {
699 (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], param(1))
700 }
701 sym::simd_add
702 | sym::simd_sub
703 | sym::simd_mul
704 | sym::simd_rem
705 | sym::simd_div
706 | sym::simd_shl
707 | sym::simd_shr
708 | sym::simd_and
709 | sym::simd_or
710 | sym::simd_xor
711 | sym::simd_fmin
712 | sym::simd_fmax
713 | sym::simd_saturating_add
714 | sym::simd_saturating_sub => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], param(0)),
715 sym::simd_arith_offset => (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1)]))vec![param(0), param(1)], param(0)),
716 sym::simd_neg
717 | sym::simd_bswap
718 | sym::simd_bitreverse
719 | sym::simd_ctlz
720 | sym::simd_cttz
721 | sym::simd_ctpop
722 | sym::simd_fsqrt
723 | sym::simd_fsin
724 | sym::simd_fcos
725 | sym::simd_fexp
726 | sym::simd_fexp2
727 | sym::simd_flog2
728 | sym::simd_flog10
729 | sym::simd_flog
730 | sym::simd_fabs
731 | sym::simd_ceil
732 | sym::simd_floor
733 | sym::simd_round
734 | sym::simd_round_ties_even
735 | sym::simd_trunc => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], param(0)),
736 sym::simd_fma | sym::simd_relaxed_fma | sym::simd_funnel_shl | sym::simd_funnel_shr => {
737 (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0), param(0)]))vec![param(0), param(0), param(0)], param(0))
738 }
739 sym::simd_gather => (3, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1), param(2)]))vec![param(0), param(1), param(2)], param(0)),
740 sym::simd_masked_load => (3, 1, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1), param(2)]))vec![param(0), param(1), param(2)], param(2)),
741 sym::simd_masked_store => (3, 1, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1), param(2)]))vec![param(0), param(1), param(2)], tcx.types.unit),
742 sym::simd_scatter => (3, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1), param(2)]))vec![param(0), param(1), param(2)], tcx.types.unit),
743 sym::simd_insert | sym::simd_insert_dyn => {
744 (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), tcx.types.u32, param(1)]))vec![param(0), tcx.types.u32, param(1)], param(0))
745 }
746 sym::simd_extract | sym::simd_extract_dyn => {
747 (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), tcx.types.u32]))vec![param(0), tcx.types.u32], param(1))
748 }
749 sym::simd_cast
750 | sym::simd_as
751 | sym::simd_cast_ptr
752 | sym::simd_expose_provenance
753 | sym::simd_with_exposed_provenance => (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], param(1)),
754 sym::simd_bitmask => (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], param(1)),
755 sym::simd_select | sym::simd_select_bitmask => {
756 (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1), param(1)]))vec![param(0), param(1), param(1)], param(1))
757 }
758 sym::simd_reduce_all | sym::simd_reduce_any => (1, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], tcx.types.bool),
759 sym::simd_reduce_add_ordered | sym::simd_reduce_mul_ordered => {
760 (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(1)]))vec![param(0), param(1)], param(1))
761 }
762 sym::simd_reduce_add_unordered
763 | sym::simd_reduce_mul_unordered
764 | sym::simd_reduce_and
765 | sym::simd_reduce_or
766 | sym::simd_reduce_xor
767 | sym::simd_reduce_min
768 | sym::simd_reduce_max => (2, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0)]))vec![param(0)], param(1)),
769 sym::simd_shuffle => (3, 0, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0), param(1)]))vec![param(0), param(0), param(1)], param(2)),
770 sym::simd_shuffle_const_generic => (2, 1, <[_]>::into_vec(::alloc::boxed::box_new([param(0), param(0)]))vec![param(0), param(0)], param(1)),
771
772 sym::atomic_cxchg | sym::atomic_cxchgweak => (
773 1,
774 2,
775 <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, param(0)),
param(0), param(0)]))vec![Ty::new_mut_ptr(tcx, param(0)), param(0), param(0)],
776 Ty::new_tup(tcx, &[param(0), tcx.types.bool]),
777 ),
778 sym::atomic_load => (1, 1, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_imm_ptr(tcx, param(0))]))vec![Ty::new_imm_ptr(tcx, param(0))], param(0)),
779 sym::atomic_store => (1, 1, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, param(0)),
param(0)]))vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit),
780
781 sym::atomic_xchg
782 | sym::atomic_max
783 | sym::atomic_min
784 | sym::atomic_umax
785 | sym::atomic_umin => (1, 1, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, param(0)),
param(0)]))vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], param(0)),
786 sym::atomic_xadd
787 | sym::atomic_xsub
788 | sym::atomic_and
789 | sym::atomic_nand
790 | sym::atomic_or
791 | sym::atomic_xor => (2, 1, <[_]>::into_vec(::alloc::boxed::box_new([Ty::new_mut_ptr(tcx, param(0)),
param(1)]))vec![Ty::new_mut_ptr(tcx, param(0)), param(1)], param(0)),
792 sym::atomic_fence | sym::atomic_singlethreadfence => (0, 1, Vec::new(), tcx.types.unit),
793
794 other => {
795 tcx.dcx().emit_err(UnrecognizedIntrinsicFunction { span, name: other });
796 return;
797 }
798 };
799 let sig = tcx.mk_fn_sig(inputs, output, false, safety, ExternAbi::Rust);
800 let sig = ty::Binder::bind_with_vars(sig, bound_vars);
801 equate_intrinsic_type(tcx, span, intrinsic_id, n_tps, n_lts, n_cts, sig)
802}