diff --git a/crates/rustc_codegen_spirv/src/abi.rs b/crates/rustc_codegen_spirv/src/abi.rs index f1453a8c5f8..4d322ce7c9f 100644 --- a/crates/rustc_codegen_spirv/src/abi.rs +++ b/crates/rustc_codegen_spirv/src/abi.rs @@ -3,7 +3,7 @@ use crate::attr::{AggregatedSpirvAttributes, IntrinsicType}; use crate::codegen_cx::CodegenCx; -use crate::spirv_type::SpirvType; +use crate::spirv_type::{SpirvType, name_type_id}; use itertools::Itertools; use rspirv::spirv::{Dim, ImageFormat, StorageClass, Word}; use rustc_abi::ExternAbi as Abi; @@ -321,6 +321,33 @@ impl<'tcx> ConvSpirvType<'tcx> for FnAbi<'tcx, Ty<'tcx>> { } } +/// If `layout` has exactly one non-ZST field positioned at offset 0 with size and +/// alignment matching the outer layout, returns that field. +/// +/// This captures the structural shape of a "newtype wrapper" — a single meaningful +/// field padded out to the outer type, which can be substituted for the outer type +/// in a SPIR-V type graph as long as the caller has *independently* verified that +/// the ABIs match (either via `BackendRepr::eq_up_to_validity`, or via +/// `#[repr(transparent)]`, which guarantees full ABI identity by construction). +fn sole_structural_newtype_field<'tcx>( + cx: &CodegenCx<'tcx>, + layout: TyAndLayout<'tcx>, +) -> Option> { + let mut non_zst = (0..layout.fields.count()).filter(|&i| !layout.field(cx, i).is_zst()); + let i = non_zst.next()?; + if non_zst.next().is_some() { + return None; + } + let field = layout.field(cx, i); + // Only unpack a newtype if the field and the newtype line up + // perfectly, in every way that could potentially affect ABI. + (layout.fields.offset(i) == Size::ZERO + && field.size == layout.size + && field.align.abi == layout.align.abi + && field.backend_repr.eq_up_to_validity(&layout.backend_repr)) + .then_some(field) +} + impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> { fn spirv_type(&self, mut span: Span, cx: &CodegenCx<'tcx>) -> Word { if let TyKind::Adt(adt, args) = *self.ty.kind() { @@ -379,23 +406,8 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> { // a new one, offering the `(a, b)` shape `rustc_codegen_ssa` // expects, while letting noop pointercasts access the sole // `BackendRepr::ScalarPair` field - this is the approach taken here - let mut non_zst_fields = (0..self.fields.count()) - .map(|i| (i, self.field(cx, i))) - .filter(|(_, field)| !field.is_zst()); - let sole_non_zst_field = match (non_zst_fields.next(), non_zst_fields.next()) { - (Some(field), None) => Some(field), - _ => None, - }; - if let Some((i, field)) = sole_non_zst_field { - // Only unpack a newtype if the field and the newtype line up - // perfectly, in every way that could potentially affect ABI. - if self.fields.offset(i) == Size::ZERO - && field.size == self.size - && field.align.abi == self.align.abi - && field.backend_repr.eq_up_to_validity(&self.backend_repr) - { - return field.spirv_type(span, cx); - } + if let Some(field) = sole_structural_newtype_field(cx, *self) { + return field.spirv_type(span, cx); } // Note: We can't use auto_struct_layout here because the spirv types here might be undefined due to @@ -447,7 +459,24 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> { .tcx .dcx() .fatal("scalable vectors are not supported in SPIR-V backend"), - BackendRepr::Memory { sized: _ } => trans_aggregate(cx, span, *self), + BackendRepr::Memory { sized: _ } => { + // For `#[repr(transparent)]` newtypes, reuse the single non-ZST + // field's SPIR-V type directly instead of wrapping it in an + // `OpTypeStruct`, if the type is `#[repr(transparent)]`. + // Otherwise, we're manipulating the abi too much and the + // format args decompiler fails. + if let TyKind::Adt(adt, _) = self.ty.kind() + && adt.repr().transparent() + && let Some(field) = sole_structural_newtype_field(cx, *self) + { + let inner_id = field.spirv_type(span, cx); + // Preserve the wrapper's name as an `OpName` alias on the + // inner SPIR-V type so disassembly still shows it. + name_type_id(cx, inner_id, TyLayoutNameKey::from(*self)); + return inner_id; + } + trans_aggregate(cx, span, *self) + } } } } diff --git a/crates/rustc_codegen_spirv/src/spirv_type.rs b/crates/rustc_codegen_spirv/src/spirv_type.rs index e5ab302dc13..ca3c97061de 100644 --- a/crates/rustc_codegen_spirv/src/spirv_type.rs +++ b/crates/rustc_codegen_spirv/src/spirv_type.rs @@ -92,6 +92,17 @@ pub enum SpirvType<'tcx> { RayQueryKhr, } +/// Emit an `OpName` for a type `id`, deduplicated per `(id, name_key)` pair. +/// Unlike [`SpirvType::def_with_name`], this operates on an existing `id` - useful +/// for types reused across multiple Rust types (e.g. `#[repr(transparent)]` +/// newtype collapse, where the wrapper's name is attached to the inner's id). +pub fn name_type_id<'tcx>(cx: &CodegenCx<'tcx>, id: Word, name_key: TyLayoutNameKey<'tcx>) { + let mut type_names = cx.type_cache.type_names.borrow_mut(); + if type_names.entry(id).or_default().insert(name_key) { + cx.emit_global().name(id, name_key.to_string()); + } +} + impl SpirvType<'_> { /// Note: `Builder::type_*` should be called *nowhere else* but here, to ensure /// `CodegenCx::type_defs` stays up-to-date @@ -266,13 +277,7 @@ impl SpirvType<'_> { name_key: TyLayoutNameKey<'tcx>, ) -> Word { let id = self.def(def_span, cx); - - // Only emit `OpName` if this is the first time we see this name. - let mut type_names = cx.type_cache.type_names.borrow_mut(); - if type_names.entry(id).or_default().insert(name_key) { - cx.emit_global().name(id, name_key.to_string()); - } - + name_type_id(cx, id, name_key); id } diff --git a/tests/compiletests/README.md b/tests/compiletests/README.md index 374bb0130ba..0f6c6ff65c9 100644 --- a/tests/compiletests/README.md +++ b/tests/compiletests/README.md @@ -79,7 +79,7 @@ contents of `path/to/test.rs.stderr`. * `// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""` remove the vulkan memory model *capability*, only used by `vulkan` targets * `// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""` remove the vulkan memory model *extension*, only used by `vulkan` targets * `// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"` replace the `Vulkan` memory model with `Simple`, which `spv` targets use - * `// normalize-stderr-test "; .*\n" -> ""` remove comments on spirv version by rspirv + * `// normalize-stderr-test "^(; .*\n)*" -> ""` remove comments on spirv version by rspirv * remove rustc error src paths: * `// normalize-stderr-test "\S*/lib/rustlib/" -> "$$SYSROOT/lib/rustlib/"` normalize path to crates delivered with rustc, such as `core` * `// normalize-stderr-test "\S*/crates/spirv-std/src/" -> "$$SPIRV_STD_SRC/"` normalize path to the `spirv-std` crate diff --git a/tests/compiletests/ui/dis/spec_constant_array.rs b/tests/compiletests/ui/dis/spec_constant_array.rs index 8c700030512..a0ae8b28a68 100644 --- a/tests/compiletests/ui/dis/spec_constant_array.rs +++ b/tests/compiletests/ui/dis/spec_constant_array.rs @@ -9,7 +9,7 @@ // ignore-vulkan1.1 // compile-flags: -C llvm-args=--disassemble -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" diff --git a/tests/compiletests/ui/dis/spec_constant_array.stderr b/tests/compiletests/ui/dis/spec_constant_array.stderr index 9533cdb38ab..5c066dc2c9d 100644 --- a/tests/compiletests/ui/dis/spec_constant_array.stderr +++ b/tests/compiletests/ui/dis/spec_constant_array.stderr @@ -3,6 +3,7 @@ OpMemoryModel Logical Simple OpEntryPoint GLCompute %1 "main" %2 OpExecutionMode %1 LocalSize 1 1 1 %3 = OpString "$DIR/spec_constant_array.rs" +OpName %2 "out" OpDecorate %4 Block OpMemberDecorate %4 0 Offset 0 OpDecorate %2 Binding 0 diff --git a/tests/compiletests/ui/entry/asm/entry1_global_asm.rs b/tests/compiletests/ui/entry/asm/entry1_global_asm.rs index 43149bf28d0..8030f57910f 100644 --- a/tests/compiletests/ui/entry/asm/entry1_global_asm.rs +++ b/tests/compiletests/ui/entry/asm/entry1_global_asm.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/entry/asm/entry1_reference.rs b/tests/compiletests/ui/entry/asm/entry1_reference.rs index b8d3a483e29..6ad5dc3942c 100644 --- a/tests/compiletests/ui/entry/asm/entry1_reference.rs +++ b/tests/compiletests/ui/entry/asm/entry1_reference.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/entry/asm/entry2_global_asm.rs b/tests/compiletests/ui/entry/asm/entry2_global_asm.rs index 92cca43c4c5..50cb0957fe4 100644 --- a/tests/compiletests/ui/entry/asm/entry2_global_asm.rs +++ b/tests/compiletests/ui/entry/asm/entry2_global_asm.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/entry/asm/entry2_reference.rs b/tests/compiletests/ui/entry/asm/entry2_reference.rs index 39e6b0cfe04..4b73baffba8 100644 --- a/tests/compiletests/ui/entry/asm/entry2_reference.rs +++ b/tests/compiletests/ui/entry/asm/entry2_reference.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/entry/asm/entry3_generic_asm.rs b/tests/compiletests/ui/entry/asm/entry3_generic_asm.rs index 2c5711cb455..f13a3266a54 100644 --- a/tests/compiletests/ui/entry/asm/entry3_generic_asm.rs +++ b/tests/compiletests/ui/entry/asm/entry3_generic_asm.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/entry/asm/entry3_global_asm.rs b/tests/compiletests/ui/entry/asm/entry3_global_asm.rs index 3b5d66d5fba..365556be2f4 100644 --- a/tests/compiletests/ui/entry/asm/entry3_global_asm.rs +++ b/tests/compiletests/ui/entry/asm/entry3_global_asm.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/entry/asm/entry3_reference.rs b/tests/compiletests/ui/entry/asm/entry3_reference.rs index 6263dcd28db..bc1a590d5b4 100644 --- a/tests/compiletests/ui/entry/asm/entry3_reference.rs +++ b/tests/compiletests/ui/entry/asm/entry3_reference.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/entry/asm/entry_fragment_global_asm.rs b/tests/compiletests/ui/entry/asm/entry_fragment_global_asm.rs index 981d271e251..0093e6854c4 100644 --- a/tests/compiletests/ui/entry/asm/entry_fragment_global_asm.rs +++ b/tests/compiletests/ui/entry/asm/entry_fragment_global_asm.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/entry/asm/entry_fragment_reference.rs b/tests/compiletests/ui/entry/asm/entry_fragment_reference.rs index e4bb8593fa2..c8f80bcae40 100644 --- a/tests/compiletests/ui/entry/asm/entry_fragment_reference.rs +++ b/tests/compiletests/ui/entry/asm/entry_fragment_reference.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/glam/offsets_vec3_vec3a.rs b/tests/compiletests/ui/glam/offsets_vec3_vec3a.rs index 6d1e56cf843..26ec8bb0b29 100644 --- a/tests/compiletests/ui/glam/offsets_vec3_vec3a.rs +++ b/tests/compiletests/ui/glam/offsets_vec3_vec3a.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-vulkan1.0 diff --git a/tests/compiletests/ui/image/write_comp.rs b/tests/compiletests/ui/image/write_comp.rs index 067734de806..a2eefd7e495 100644 --- a/tests/compiletests/ui/image/write_comp.rs +++ b/tests/compiletests/ui/image/write_comp.rs @@ -4,7 +4,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-vulkan1.0 diff --git a/tests/compiletests/ui/image/write_comp_format.rs b/tests/compiletests/ui/image/write_comp_format.rs index a3bbf6d9da5..f8bb8df8b6f 100644 --- a/tests/compiletests/ui/image/write_comp_format.rs +++ b/tests/compiletests/ui/image/write_comp_format.rs @@ -4,7 +4,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-vulkan1.0 diff --git a/tests/compiletests/ui/lang/abi/transparent_array.rs b/tests/compiletests/ui/lang/abi/transparent_array.rs new file mode 100644 index 00000000000..65e098e15fa --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_array.rs @@ -0,0 +1,34 @@ +// build-pass +// compile-flags: -C llvm-args=--disassemble +// normalize-stderr-test "OpSource .*\n" -> "" +// normalize-stderr-test "OpLine .*\n" -> "" +// normalize-stderr-test "%\d+ = OpString .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" +// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" +// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" +// ignore-spv1.0 +// ignore-spv1.1 +// ignore-spv1.2 +// ignore-spv1.3 +// ignore-vulkan1.0 +// ignore-vulkan1.1 + +use core::marker::PhantomData; +use spirv_std::glam::*; +use spirv_std::spirv; + +#[derive(Default)] +pub struct A([u32; 3]); +#[repr(transparent)] +#[derive(Default)] +pub struct AT([u32; 3]); + +#[spirv(vertex)] +pub fn main(a: &mut A, at: &mut AT, #[spirv(local_invocation_index)] tid: u32) { + *a = A([tid, 1, 2]); + a.0 = [tid, 1, 2]; + a.0[2] += 4; + *at = AT([tid, 1, 2]); + at.0 = [tid, 1, 2]; + at.0[2] += 5; +} diff --git a/tests/compiletests/ui/lang/abi/transparent_array.stderr b/tests/compiletests/ui/lang/abi/transparent_array.stderr new file mode 100644 index 00000000000..93a6cf29898 --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_array.stderr @@ -0,0 +1,74 @@ +OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint Vertex %1 "main" %2 %3 %4 +OpName %6 "AT" +OpName %7 "A" +OpMemberName %7 0 "0" +OpName %2 "tid" +OpName %8 "AT" +OpName %3 "a" +OpName %4 "at" +OpDecorate %2 BuiltIn LocalInvocationIndex +OpDecorate %8 ArrayStride 4 +OpDecorate %3 Location 0 +OpDecorate %4 Location 3 +%9 = OpTypeInt 32 0 +%10 = OpConstant %9 3 +%6 = OpTypeArray %9 %10 +%7 = OpTypeStruct %6 +%11 = OpTypePointer Output %7 +%12 = OpTypePointer Output %6 +%13 = OpTypePointer Input %9 +%14 = OpTypeVoid +%15 = OpTypeFunction %14 +%2 = OpVariable %13 Input +%8 = OpTypeArray %9 %10 +%16 = OpConstant %9 1 +%17 = OpConstant %9 2 +%3 = OpVariable %11 Output +%18 = OpConstant %9 0 +%19 = OpTypePointer Output %9 +%20 = OpConstant %9 4 +%4 = OpVariable %12 Output +%21 = OpConstant %9 5 +%1 = OpFunction %14 None %15 +%22 = OpLabel +%23 = OpLoad %9 %2 +%24 = OpCompositeConstruct %8 %23 %16 %17 +%25 = OpInBoundsAccessChain %12 %3 %18 +%26 = OpCompositeExtract %9 %24 0 +%27 = OpCompositeExtract %9 %24 1 +%28 = OpCompositeExtract %9 %24 2 +%29 = OpCompositeConstruct %6 %26 %27 %28 +OpStore %25 %29 +%30 = OpInBoundsAccessChain %19 %3 %18 %18 +OpStore %30 %23 +%31 = OpInBoundsAccessChain %19 %3 %18 %16 +OpStore %31 %16 +%32 = OpInBoundsAccessChain %19 %3 %18 %17 +OpStore %32 %17 +%33 = OpInBoundsAccessChain %19 %3 %18 %17 +%34 = OpInBoundsAccessChain %19 %3 %18 %17 +%35 = OpLoad %9 %34 +%36 = OpIAdd %9 %35 %20 +OpStore %33 %36 +%37 = OpCompositeConstruct %8 %23 %16 %17 +%38 = OpCompositeExtract %9 %37 0 +%39 = OpCompositeExtract %9 %37 1 +%40 = OpCompositeExtract %9 %37 2 +%41 = OpCompositeConstruct %6 %38 %39 %40 +OpStore %4 %41 +%42 = OpInBoundsAccessChain %19 %4 %18 +OpStore %42 %23 +%43 = OpInBoundsAccessChain %19 %4 %16 +OpStore %43 %16 +%44 = OpInBoundsAccessChain %19 %4 %17 +OpStore %44 %17 +%45 = OpInBoundsAccessChain %19 %4 %17 +%46 = OpInBoundsAccessChain %19 %4 %17 +%47 = OpLoad %9 %46 +%48 = OpIAdd %9 %47 %21 +OpStore %45 %48 +OpNoLine +OpReturn +OpFunctionEnd diff --git a/tests/compiletests/ui/lang/abi/transparent_nested.rs b/tests/compiletests/ui/lang/abi/transparent_nested.rs new file mode 100644 index 00000000000..51884146337 --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_nested.rs @@ -0,0 +1,44 @@ +// build-pass +// compile-flags: -C llvm-args=--disassemble +// normalize-stderr-test "OpSource .*\n" -> "" +// normalize-stderr-test "OpLine .*\n" -> "" +// normalize-stderr-test "%\d+ = OpString .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" +// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" +// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" +// ignore-spv1.0 +// ignore-spv1.1 +// ignore-spv1.2 +// ignore-spv1.3 +// ignore-vulkan1.0 +// ignore-vulkan1.1 + +use core::marker::PhantomData; +use spirv_std::glam::*; +use spirv_std::spirv; + +#[repr(C)] +#[derive(Default)] +pub struct A(UVec3); + +#[repr(C)] +#[derive(Default)] +pub struct B(A); + +#[repr(transparent)] +#[derive(Default)] +pub struct AT(UVec3); + +#[repr(transparent)] +#[derive(Default)] +pub struct BT(AT); + +#[spirv(vertex)] +pub fn main(a: &mut B, at: &mut BT, #[spirv(local_invocation_index)] tid: u32) { + *a = B(A(UVec3::new(tid, 1, 2))); + a.0.0.y = tid + 1; + a.0.0.x += 4; + *at = BT(AT(UVec3::new(tid, 1, 2))); + at.0.0.y = tid + 2; + at.0.0.x += 5; +} diff --git a/tests/compiletests/ui/lang/abi/transparent_nested.stderr b/tests/compiletests/ui/lang/abi/transparent_nested.stderr new file mode 100644 index 00000000000..d3076f30b02 --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_nested.stderr @@ -0,0 +1,70 @@ +OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint Vertex %1 "main" %2 %3 %4 +OpName %7 "AT" +OpName %8 "A" +OpMemberName %8 0 "0" +OpName %9 "B" +OpMemberName %9 0 "0" +OpName %2 "tid" +OpName %10 "A" +OpMemberName %10 0 "0" +OpName %11 "B" +OpMemberName %11 0 "0" +OpName %3 "a" +OpName %4 "at" +OpDecorate %2 BuiltIn LocalInvocationIndex +OpMemberDecorate %10 0 Offset 0 +OpMemberDecorate %11 0 Offset 0 +OpDecorate %3 Location 0 +OpDecorate %4 Location 1 +%12 = OpTypeInt 32 0 +%7 = OpTypeVector %12 3 +%8 = OpTypeStruct %7 +%9 = OpTypeStruct %8 +%13 = OpTypePointer Output %9 +%14 = OpTypePointer Output %7 +%15 = OpTypePointer Input %12 +%16 = OpTypeVoid +%17 = OpTypeFunction %16 +%2 = OpVariable %15 Input +%18 = OpConstant %12 1 +%19 = OpConstant %12 2 +%10 = OpTypeStruct %7 +%11 = OpTypeStruct %10 +%20 = OpUndef %11 +%3 = OpVariable %13 Output +%21 = OpConstant %12 0 +%22 = OpTypePointer Output %12 +%23 = OpConstant %12 4 +%4 = OpVariable %14 Output +%24 = OpConstant %12 5 +%1 = OpFunction %16 None %17 +%25 = OpLabel +%26 = OpLoad %12 %2 +%27 = OpCompositeConstruct %7 %26 %18 %19 +%28 = OpCompositeInsert %11 %27 %20 0 0 +%29 = OpInBoundsAccessChain %14 %3 %21 %21 +%30 = OpCompositeExtract %7 %28 0 0 +OpStore %29 %30 +%31 = OpInBoundsAccessChain %22 %3 %21 %21 %18 +%32 = OpIAdd %12 %26 %18 +OpStore %31 %32 +%33 = OpInBoundsAccessChain %22 %3 %21 %21 %21 +%34 = OpLoad %12 %33 +%35 = OpIAdd %12 %34 %23 +%36 = OpInBoundsAccessChain %22 %3 %21 %21 %21 +OpStore %36 %35 +%37 = OpCompositeConstruct %7 %26 %18 %19 +OpStore %4 %37 +%38 = OpInBoundsAccessChain %22 %4 %18 +%39 = OpIAdd %12 %26 %19 +OpStore %38 %39 +%40 = OpInBoundsAccessChain %22 %4 %21 +%41 = OpLoad %12 %40 +%42 = OpIAdd %12 %41 %24 +%43 = OpInBoundsAccessChain %22 %4 %21 +OpStore %43 %42 +OpNoLine +OpReturn +OpFunctionEnd diff --git a/tests/compiletests/ui/lang/abi/transparent_u32.rs b/tests/compiletests/ui/lang/abi/transparent_u32.rs new file mode 100644 index 00000000000..4916f3bc043 --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_u32.rs @@ -0,0 +1,36 @@ +// build-pass +// compile-flags: -C llvm-args=--disassemble +// normalize-stderr-test "OpSource .*\n" -> "" +// normalize-stderr-test "OpLine .*\n" -> "" +// normalize-stderr-test "%\d+ = OpString .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" +// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" +// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" +// ignore-spv1.0 +// ignore-spv1.1 +// ignore-spv1.2 +// ignore-spv1.3 +// ignore-vulkan1.0 +// ignore-vulkan1.1 + +use core::marker::PhantomData; +use spirv_std::glam::*; +use spirv_std::spirv; + +#[repr(C)] +#[derive(Default)] +pub struct A(u32); + +#[repr(transparent)] +#[derive(Default)] +pub struct AT(u32); + +#[spirv(vertex)] +pub fn main(a: &mut A, at: &mut AT, #[spirv(local_invocation_index)] tid: u32) { + *a = A(tid); + a.0 = tid + 1; + a.0 += 4; + *at = AT(tid); + at.0 = tid + 2; + at.0 += 5; +} diff --git a/tests/compiletests/ui/lang/abi/transparent_u32.stderr b/tests/compiletests/ui/lang/abi/transparent_u32.stderr new file mode 100644 index 00000000000..dec8e6e7ccc --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_u32.stderr @@ -0,0 +1,48 @@ +OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint Vertex %1 "main" %2 %3 %4 +OpName %6 "A" +OpMemberName %6 0 "0" +OpName %2 "tid" +OpName %3 "a" +OpName %4 "at" +OpDecorate %2 BuiltIn LocalInvocationIndex +OpDecorate %3 Location 0 +OpDecorate %4 Location 1 +%7 = OpTypeInt 32 0 +%6 = OpTypeStruct %7 +%8 = OpTypePointer Output %6 +%9 = OpTypePointer Output %7 +%10 = OpTypePointer Input %7 +%11 = OpTypeVoid +%12 = OpTypeFunction %11 +%2 = OpVariable %10 Input +%3 = OpVariable %8 Output +%13 = OpConstant %7 0 +%14 = OpConstant %7 1 +%15 = OpConstant %7 4 +%4 = OpVariable %9 Output +%16 = OpConstant %7 2 +%17 = OpConstant %7 5 +%1 = OpFunction %11 None %12 +%18 = OpLabel +%19 = OpLoad %7 %2 +%20 = OpInBoundsAccessChain %9 %3 %13 +OpStore %20 %19 +%21 = OpIAdd %7 %19 %14 +%22 = OpInBoundsAccessChain %9 %3 %13 +OpStore %22 %21 +%23 = OpInBoundsAccessChain %9 %3 %13 +%24 = OpLoad %7 %23 +%25 = OpIAdd %7 %24 %15 +%26 = OpInBoundsAccessChain %9 %3 %13 +OpStore %26 %25 +OpStore %4 %19 +%27 = OpIAdd %7 %19 %16 +OpStore %4 %27 +%28 = OpLoad %7 %4 +%29 = OpIAdd %7 %28 %17 +OpStore %4 %29 +OpNoLine +OpReturn +OpFunctionEnd diff --git a/tests/compiletests/ui/lang/abi/transparent_vec.rs b/tests/compiletests/ui/lang/abi/transparent_vec.rs new file mode 100644 index 00000000000..3720663af08 --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_vec.rs @@ -0,0 +1,36 @@ +// build-pass +// compile-flags: -C llvm-args=--disassemble +// normalize-stderr-test "OpSource .*\n" -> "" +// normalize-stderr-test "OpLine .*\n" -> "" +// normalize-stderr-test "%\d+ = OpString .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" +// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" +// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" +// ignore-spv1.0 +// ignore-spv1.1 +// ignore-spv1.2 +// ignore-spv1.3 +// ignore-vulkan1.0 +// ignore-vulkan1.1 + +use core::marker::PhantomData; +use spirv_std::glam::*; +use spirv_std::spirv; + +#[repr(C)] +#[derive(Default)] +pub struct A(UVec3); + +#[repr(transparent)] +#[derive(Default)] +pub struct AT(UVec3); + +#[spirv(vertex)] +pub fn main(a: &mut A, at: &mut AT, #[spirv(local_invocation_index)] tid: u32) { + *a = A(UVec3::new(tid, 1, 2)); + a.0 = UVec3::new(tid, 1, 3); + a.0.y += 10; + *at = AT(UVec3::new(tid, 1, 4)); + at.0 = UVec3::new(tid, 1, 5); + at.0.y += 11; +} diff --git a/tests/compiletests/ui/lang/abi/transparent_vec.stderr b/tests/compiletests/ui/lang/abi/transparent_vec.stderr new file mode 100644 index 00000000000..4c6ec237b65 --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_vec.stderr @@ -0,0 +1,58 @@ +OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint Vertex %1 "main" %2 %3 %4 +OpName %7 "AT" +OpName %8 "A" +OpMemberName %8 0 "0" +OpName %2 "tid" +OpName %3 "a" +OpName %4 "at" +OpDecorate %2 BuiltIn LocalInvocationIndex +OpDecorate %3 Location 0 +OpDecorate %4 Location 1 +%9 = OpTypeInt 32 0 +%7 = OpTypeVector %9 3 +%8 = OpTypeStruct %7 +%10 = OpTypePointer Output %8 +%11 = OpTypePointer Output %7 +%12 = OpTypePointer Input %9 +%13 = OpTypeVoid +%14 = OpTypeFunction %13 +%2 = OpVariable %12 Input +%15 = OpConstant %9 1 +%16 = OpConstant %9 2 +%3 = OpVariable %10 Output +%17 = OpConstant %9 0 +%18 = OpConstant %9 3 +%19 = OpTypePointer Output %9 +%20 = OpConstant %9 10 +%21 = OpConstant %9 4 +%4 = OpVariable %11 Output +%22 = OpConstant %9 5 +%23 = OpConstant %9 11 +%1 = OpFunction %13 None %14 +%24 = OpLabel +%25 = OpLoad %9 %2 +%26 = OpCompositeConstruct %7 %25 %15 %16 +%27 = OpInBoundsAccessChain %11 %3 %17 +OpStore %27 %26 +%28 = OpCompositeConstruct %7 %25 %15 %18 +%29 = OpInBoundsAccessChain %11 %3 %17 +OpStore %29 %28 +%30 = OpInBoundsAccessChain %19 %3 %17 %15 +%31 = OpInBoundsAccessChain %19 %3 %17 %15 +%32 = OpLoad %9 %31 +%33 = OpIAdd %9 %32 %20 +OpStore %30 %33 +%34 = OpCompositeConstruct %7 %25 %15 %21 +OpStore %4 %34 +%35 = OpCompositeConstruct %7 %25 %15 %22 +OpStore %4 %35 +%36 = OpInBoundsAccessChain %19 %4 %15 +%37 = OpInBoundsAccessChain %19 %4 %15 +%38 = OpLoad %9 %37 +%39 = OpIAdd %9 %38 %23 +OpStore %36 %39 +OpNoLine +OpReturn +OpFunctionEnd diff --git a/tests/compiletests/ui/lang/abi/transparent_zst.rs b/tests/compiletests/ui/lang/abi/transparent_zst.rs new file mode 100644 index 00000000000..ce65addc43c --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_zst.rs @@ -0,0 +1,32 @@ +// build-pass +// compile-flags: -C llvm-args=--disassemble +// normalize-stderr-test "OpSource .*\n" -> "" +// normalize-stderr-test "OpLine .*\n" -> "" +// normalize-stderr-test "%\d+ = OpString .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" +// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" +// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" +// ignore-spv1.0 +// ignore-spv1.1 +// ignore-spv1.2 +// ignore-spv1.3 +// ignore-vulkan1.0 +// ignore-vulkan1.1 + +use core::marker::PhantomData; +use spirv_std::glam::*; +use spirv_std::spirv; + +#[derive(Default)] +pub struct A(()); +#[repr(transparent)] +#[derive(Default)] +pub struct AT(()); + +#[spirv(vertex)] +pub fn main(a: &mut A, at: &mut AT) { + *a = A(()); + a.0 = (); + *at = AT(()); + at.0 = (); +} diff --git a/tests/compiletests/ui/lang/abi/transparent_zst.stderr b/tests/compiletests/ui/lang/abi/transparent_zst.stderr new file mode 100644 index 00000000000..94ed2a35874 --- /dev/null +++ b/tests/compiletests/ui/lang/abi/transparent_zst.stderr @@ -0,0 +1,9 @@ +OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint Vertex %1 "main" +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%1 = OpFunction %2 None %3 +%4 = OpLabel +OpReturn +OpFunctionEnd diff --git a/tests/compiletests/ui/lang/asm/fn_ptr_call_float.rs b/tests/compiletests/ui/lang/asm/fn_ptr_call_float.rs index 968b1655eb8..7b8be39cac6 100644 --- a/tests/compiletests/ui/lang/asm/fn_ptr_call_float.rs +++ b/tests/compiletests/ui/lang/asm/fn_ptr_call_float.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/lang/asm/fn_ptr_call_vec.rs b/tests/compiletests/ui/lang/asm/fn_ptr_call_vec.rs index b94d3d5cc20..3627d08cc71 100644 --- a/tests/compiletests/ui/lang/asm/fn_ptr_call_vec.rs +++ b/tests/compiletests/ui/lang/asm/fn_ptr_call_vec.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/lang/asm/fn_ptr_call_void.rs b/tests/compiletests/ui/lang/asm/fn_ptr_call_void.rs index 833819a13b6..ff8cdc37686 100644 --- a/tests/compiletests/ui/lang/asm/fn_ptr_call_void.rs +++ b/tests/compiletests/ui/lang/asm/fn_ptr_call_void.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/array_f32.rs b/tests/compiletests/ui/spirv-attr/location_assignment/array_f32.rs index c643a45e4ba..8ed15fd8ff3 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/array_f32.rs +++ b/tests/compiletests/ui/spirv-attr/location_assignment/array_f32.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/array_f32.stderr b/tests/compiletests/ui/spirv-attr/location_assignment/array_f32.stderr index c73ab9c004d..1b43c99c9f2 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/array_f32.stderr +++ b/tests/compiletests/ui/spirv-attr/location_assignment/array_f32.stderr @@ -3,7 +3,8 @@ OpMemoryModel Logical Simple OpEntryPoint Vertex %1 "main" %2 %3 OpName %2 "out1" OpName %3 "out2" -OpName %6 "<[f32OpDecorate %7 ArrayStride 4 +OpName %6 "<[f32; 3] as core::default::Default>::default" +OpDecorate %7 ArrayStride 4 OpDecorate %2 Location 0 OpDecorate %3 Location 3 %8 = OpTypeFloat 32 diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/explicit_overlap.rs b/tests/compiletests/ui/spirv-attr/location_assignment/explicit_overlap.rs index 2181f3c5ad0..dc77780b943 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/explicit_overlap.rs +++ b/tests/compiletests/ui/spirv-attr/location_assignment/explicit_overlap.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // normalize-stderr-test "= note: module `.*`" -> "= note: module ``" diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/explict.rs b/tests/compiletests/ui/spirv-attr/location_assignment/explict.rs index 4f25e131eeb..14bbd1e8ab1 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/explict.rs +++ b/tests/compiletests/ui/spirv-attr/location_assignment/explict.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/geometry_shader.rs b/tests/compiletests/ui/spirv-attr/location_assignment/geometry_shader.rs index cda93b86269..0bb0a73af79 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/geometry_shader.rs +++ b/tests/compiletests/ui/spirv-attr/location_assignment/geometry_shader.rs @@ -4,7 +4,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/many_f32_struct.rs b/tests/compiletests/ui/spirv-attr/location_assignment/many_f32_struct.rs index ffc4ea4facc..430fdd50009 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/many_f32_struct.rs +++ b/tests/compiletests/ui/spirv-attr/location_assignment/many_f32_struct.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/mesh_shader.rs b/tests/compiletests/ui/spirv-attr/location_assignment/mesh_shader.rs index 3c464be35f9..5f30f48d273 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/mesh_shader.rs +++ b/tests/compiletests/ui/spirv-attr/location_assignment/mesh_shader.rs @@ -4,7 +4,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/mesh_shader.stderr b/tests/compiletests/ui/spirv-attr/location_assignment/mesh_shader.stderr index d10e813f20e..38967fe0188 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/mesh_shader.stderr +++ b/tests/compiletests/ui/spirv-attr/location_assignment/mesh_shader.stderr @@ -7,17 +7,18 @@ OpExecutionMode %1 LocalSize 1 1 1 OpExecutionMode %1 OutputVertices 9 OpExecutionMode %1 OutputPrimitivesEXT 3 OpExecutionMode %1 OutputTrianglesEXT -OpName %16 "core::ops::Range" -OpMemberName %16 0 "start" -OpMemberName %16 1 "end" +OpName %16 "ops::try_trait::NeverShortCircuit<[char; 3]>" +OpName %17 "core::ops::Range" +OpMemberName %17 0 "start" +OpMemberName %17 1 "end" OpName %2 "positions" OpName %3 "out_per_vertex" OpName %4 "out_per_vertex2" OpName %5 "indices" OpName %6 "out_per_primitive" OpName %7 "out_per_primitive2" -OpMemberDecorate %16 0 Offset 0 -OpMemberDecorate %16 1 Offset 4 +OpMemberDecorate %17 0 Offset 0 +OpMemberDecorate %17 1 Offset 4 OpDecorate %2 BuiltIn Position OpDecorate %3 Location 0 OpDecorate %4 Location 1 @@ -26,48 +27,48 @@ OpDecorate %6 Location 2 OpDecorate %6 PerPrimitiveEXT OpDecorate %7 Location 3 OpDecorate %7 PerPrimitiveEXT -%17 = OpTypeFloat 32 -%18 = OpTypeVector %17 4 -%19 = OpTypeInt 32 0 -%20 = OpConstant %19 9 -%21 = OpTypeArray %18 %20 -%22 = OpTypePointer Output %21 -%23 = OpTypeVector %19 3 -%24 = OpConstant %19 3 -%25 = OpTypeArray %23 %24 -%26 = OpTypePointer Output %25 -%27 = OpTypeArray %19 %20 -%28 = OpTypePointer Output %27 -%29 = OpTypeArray %17 %20 -%30 = OpTypePointer Output %29 -%31 = OpTypeArray %19 %24 -%32 = OpTypePointer Output %31 -%33 = OpTypeArray %17 %24 +%18 = OpTypeFloat 32 +%19 = OpTypeVector %18 4 +%20 = OpTypeInt 32 0 +%21 = OpConstant %20 9 +%22 = OpTypeArray %19 %21 +%23 = OpTypePointer Output %22 +%24 = OpTypeVector %20 3 +%25 = OpConstant %20 3 +%26 = OpTypeArray %24 %25 +%27 = OpTypePointer Output %26 +%28 = OpTypeArray %20 %21 +%29 = OpTypePointer Output %28 +%30 = OpTypeArray %18 %21 +%31 = OpTypePointer Output %30 +%16 = OpTypeArray %20 %25 +%32 = OpTypePointer Output %16 +%33 = OpTypeArray %18 %25 %34 = OpTypePointer Output %33 %35 = OpTypeVoid %36 = OpTypeFunction %35 -%16 = OpTypeStruct %19 %19 -%37 = OpConstant %19 0 -%38 = OpUndef %16 +%17 = OpTypeStruct %20 %20 +%37 = OpConstant %20 0 +%38 = OpUndef %17 %39 = OpTypeBool %40 = OpConstantFalse %39 -%41 = OpConstant %19 1 +%41 = OpConstant %20 1 %42 = OpTypeInt 32 1 %43 = OpConstant %42 0 -%44 = OpConstant %17 3204448256 -%45 = OpConstant %17 1056964608 -%46 = OpConstant %17 0 -%47 = OpConstant %17 1065353216 -%48 = OpTypePointer Output %18 -%2 = OpVariable %22 Output -%49 = OpConstant %19 2 -%50 = OpTypePointer Output %19 -%3 = OpVariable %28 Output -%51 = OpTypePointer Output %17 -%4 = OpVariable %30 Output -%52 = OpTypePointer Output %23 -%5 = OpVariable %26 Output +%44 = OpConstant %18 3204448256 +%45 = OpConstant %18 1056964608 +%46 = OpConstant %18 0 +%47 = OpConstant %18 1065353216 +%48 = OpTypePointer Output %19 +%2 = OpVariable %23 Output +%49 = OpConstant %20 2 +%50 = OpTypePointer Output %20 +%3 = OpVariable %29 Output +%51 = OpTypePointer Output %18 +%4 = OpVariable %31 Output +%52 = OpTypePointer Output %24 +%5 = OpVariable %27 Output %6 = OpVariable %32 Output -%53 = OpConstant %19 42 +%53 = OpConstant %20 42 %7 = OpVariable %34 Output -%54 = OpConstant %17 1116340224 +%54 = OpConstant %18 1116340224 diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/struct.rs b/tests/compiletests/ui/spirv-attr/location_assignment/struct.rs index d11bb8f8103..30e5ef3a5c5 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/struct.rs +++ b/tests/compiletests/ui/spirv-attr/location_assignment/struct.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0 diff --git a/tests/compiletests/ui/spirv-attr/location_assignment/vec3_f32.rs b/tests/compiletests/ui/spirv-attr/location_assignment/vec3_f32.rs index 0a7d754e26f..e8474ee7ead 100644 --- a/tests/compiletests/ui/spirv-attr/location_assignment/vec3_f32.rs +++ b/tests/compiletests/ui/spirv-attr/location_assignment/vec3_f32.rs @@ -3,7 +3,7 @@ // normalize-stderr-test "OpSource .*\n" -> "" // normalize-stderr-test "OpLine .*\n" -> "" // normalize-stderr-test "%\d+ = OpString .*\n" -> "" -// normalize-stderr-test "; .*\n" -> "" +// normalize-stderr-test "^(; .*\n)*" -> "" // normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> "" // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // ignore-spv1.0