blob: e93619254718b14c1c31c13c6081874b80b42987 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
RWStructuredBuffer<float> buf;
//
// This test checks that we correctly diagnose trying to use the assignment and
// typed assignment syntax with operands with no result type or id.
//
// By virtue of these tests being in the same file, we also check the error
// recovery for the asm block parser.
//
int foo(const int constParam)
{
// Doesn't have a result type
spirv_asm
{
%bar : %wrong = OpTypeInt 32 0
// CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: cannot use this 'x : <type> = OpTypeInt...' syntax because OpTypeInt does not have a <result-type-id> operand
};
// Doesn't have a result value
spirv_asm
{
%foo = OpStore 1 2;
// CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: cannot use this 'x = OpStore...' syntax because OpStore does not have a <result-id> operand
};
// garbage
spirv_asm
{
%foo =;
// CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';'
%foo :;
// CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';'
%foo : bar;
// CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';', expected '='
%foo : bar =;
// CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';'
};
}
|