Skip to content

Commit 59d2d2a

Browse files
committed
Add test for issue #1062 (bit rotates being completely broken).
1 parent e96418f commit 59d2d2a

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

tests/ui/dis/issue-1062.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![crate_name = "issue_1062"]
2+
3+
// Test that rotates take the correct path for non-zero bit amounts.
4+
5+
// build-pass
6+
// compile-flags: -C llvm-args=--disassemble-entry=main
7+
8+
use spirv_std::spirv;
9+
10+
#[spirv(fragment)]
11+
pub fn main(#[spirv(flat)] x: u32, #[spirv(flat)] s: u32, out: &mut (u32, u32)) {
12+
*out = (x.rotate_left(s), x.rotate_right(s));
13+
}

tests/ui/dis/issue-1062.stderr

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
%1 = OpFunction %2 None %3
2+
%4 = OpLabel
3+
OpLine %5 11 12
4+
%6 = OpLoad %7 %8
5+
OpLine %5 11 35
6+
%9 = OpLoad %7 %10
7+
OpLine %11 1142 4
8+
%12 = OpBitwiseAnd %7 %9 %13
9+
%14 = OpISub %7 %15 %12
10+
%16 = OpShiftLeftLogical %7 %6 %12
11+
%17 = OpShiftRightLogical %7 %6 %14
12+
%18 = OpBitwiseOr %7 %16 %17
13+
%19 = OpINotEqual %20 %12 %21
14+
%22 = OpSelect %7 %19 %6 %18
15+
%23 = OpBitwiseAnd %7 %9 %13
16+
%24 = OpISub %7 %15 %23
17+
%25 = OpShiftRightLogical %7 %6 %23
18+
%26 = OpShiftLeftLogical %7 %6 %24
19+
%27 = OpBitwiseOr %7 %25 %26
20+
%28 = OpINotEqual %20 %23 %21
21+
%29 = OpSelect %7 %28 %6 %27
22+
OpLine %5 12 4
23+
%30 = OpAccessChain %31 %32 %21
24+
OpStore %30 %22
25+
%33 = OpAccessChain %31 %32 %34
26+
OpStore %33 %29
27+
OpNoLine
28+
OpReturn
29+
OpFunctionEnd

0 commit comments

Comments
 (0)