Skip to content

Commit

Permalink
tests: adjust for lack of PassMode::{Indirect, Cast}.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Oct 15, 2021
1 parent 52a6c2e commit 4d67678
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 40 deletions.
15 changes: 15 additions & 0 deletions tests/ui/dis/entry-pass-mode-cast.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This is a similar setup to the `issue-731` test, but instead of "just" the
// missing copy out of the global (`Input`) `OpVariable`, small enough types
// would fail much earlier, as they would use `PassMode::Cast`, through the
// default Rust ABI adjustments (that we now override through query hooks).

// build-pass
// compile-flags: -C llvm-args=--disassemble-entry=main

use spirv_std as _;

#[spirv(fragment)]
pub fn main(mut in_array: [f32; 2], out_array: &mut [f32; 2]) {
in_array[0] += 1.0;
*out_array = in_array;
}
21 changes: 21 additions & 0 deletions tests/ui/dis/entry-pass-mode-cast.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
%1 = OpFunction %2 None %3
%4 = OpLabel
%5 = OpVariable %6 Function
%7 = OpVariable %6 Function
OpLine %8 12 12
%9 = OpLoad %10 %11
OpLine %8 12 0
OpStore %5 %9
OpLine %8 13 4
%12 = OpInBoundsAccessChain %13 %5 %14
%15 = OpInBoundsAccessChain %13 %5 %14
%16 = OpLoad %17 %15
%18 = OpFAdd %17 %16 %19
OpStore %12 %18
OpLine %8 14 17
OpCopyMemory %7 %5
OpLine %8 14 4
OpCopyMemory %20 %7
OpLine %8 15 1
OpReturn
OpFunctionEnd
17 changes: 0 additions & 17 deletions tests/ui/dis/issue-723-indirect-input.rs

This file was deleted.

23 changes: 0 additions & 23 deletions tests/ui/dis/issue-723-indirect-input.stderr

This file was deleted.

14 changes: 14 additions & 0 deletions tests/ui/dis/issue-731.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Test that non-immediate (i.e. not one of scalar/scalar-pair/vector) inputs
// get properly copied out of the global (`Input`) `OpVariable` and mutation is
// only ever done on `fn`-local `OpVariable`s, not on the original global.

// build-pass
// compile-flags: -C llvm-args=--disassemble-entry=main

use spirv_std as _;

#[spirv(fragment)]
pub fn main(mut in_array: [f32; 3], out_array: &mut [f32; 3]) {
in_array[0] += 1.0;
*out_array = in_array;
}
21 changes: 21 additions & 0 deletions tests/ui/dis/issue-731.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
%1 = OpFunction %2 None %3
%4 = OpLabel
%5 = OpVariable %6 Function
%7 = OpVariable %6 Function
OpLine %8 11 12
%9 = OpLoad %10 %11
OpLine %8 11 0
OpStore %5 %9
OpLine %8 12 4
%12 = OpInBoundsAccessChain %13 %5 %14
%15 = OpInBoundsAccessChain %13 %5 %14
%16 = OpLoad %17 %15
%18 = OpFAdd %17 %16 %19
OpStore %12 %18
OpLine %8 13 17
OpCopyMemory %7 %5
OpLine %8 13 4
OpCopyMemory %20 %7
OpLine %8 14 1
OpReturn
OpFunctionEnd

0 comments on commit 4d67678

Please sign in to comment.