|
1 | 1 | use std::assert_matches::assert_matches;
|
2 | 2 | use std::cmp::Ordering;
|
3 | 3 |
|
4 |
| -use rustc_abi::{Align, BackendRepr, ExternAbi, Float, HasDataLayout, Primitive, Size}; |
| 4 | +use rustc_abi::{ |
| 5 | + AddressSpace, Align, BackendRepr, ExternAbi, Float, HasDataLayout, Primitive, Size, |
| 6 | +}; |
5 | 7 | use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh, wants_wasm_eh};
|
6 | 8 | use rustc_codegen_ssa::codegen_attrs::autodiff_attrs;
|
7 | 9 | use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
|
@@ -532,6 +534,22 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
|
532 | 534 | return Ok(());
|
533 | 535 | }
|
534 | 536 |
|
| 537 | + sym::dynamic_shared_memory => { |
| 538 | + let global = self.declare_global_in_addrspace( |
| 539 | + "dynamic_shared_memory", |
| 540 | + self.type_array(self.type_i8(), 0), |
| 541 | + AddressSpace::SHARED, |
| 542 | + ); |
| 543 | + let ty::RawPtr(inner_ty, _) = result.layout.ty.kind() else { unreachable!() }; |
| 544 | + let alignment = self.align_of(*inner_ty).bytes() as u32; |
| 545 | + unsafe { |
| 546 | + if alignment > llvm::LLVMGetAlignment(global) { |
| 547 | + llvm::LLVMSetAlignment(global, alignment); |
| 548 | + } |
| 549 | + } |
| 550 | + self.cx().const_pointercast(global, self.type_ptr()) |
| 551 | + } |
| 552 | + |
535 | 553 | _ if name.as_str().starts_with("simd_") => {
|
536 | 554 | // Unpack non-power-of-2 #[repr(packed, simd)] arguments.
|
537 | 555 | // This gives them the expected layout of a regular #[repr(simd)] vector.
|
|
0 commit comments