Skip to content

Commit 306f49a

Browse files
authored
[AMDGPU][MC] Disallow nogds in ds_gws_* instructions (#166873)
The ds_gws_* instructions require gds as an operand. However, when nogds is given, it is treated the same as gds. This patch fixes this to disallow nogds.
1 parent 739a5a4 commit 306f49a

File tree

6 files changed

+192
-0
lines changed

6 files changed

+192
-0
lines changed

llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7044,6 +7044,12 @@ ParseStatus AMDGPUAsmParser::parseNamedBit(StringRef Name,
70447044
if (Name == "a16" && !hasA16())
70457045
return Error(S, "a16 modifier is not supported on this GPU");
70467046

7047+
if (Bit == 0 && Name == "gds") {
7048+
StringRef Mnemo = ((AMDGPUOperand &)*Operands[0]).getToken();
7049+
if (Mnemo.starts_with("ds_gws"))
7050+
return Error(S, "nogds is not allowed");
7051+
}
7052+
70477053
if (isGFX9() && ImmTy == AMDGPUOperand::ImmTyA16)
70487054
ImmTy = AMDGPUOperand::ImmTyR128A16;
70497055

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// RUN: not llvm-mc -triple=amdgcn -mcpu=gfx1010 -mattr=+wavefrontsize32 %s 2>&1 | FileCheck --implicit-check-not=error: %s
2+
// RUN: not llvm-mc -triple=amdgcn -mcpu=gfx1010 -mattr=+wavefrontsize64 %s 2>&1 | FileCheck --implicit-check-not=error: %s
3+
4+
ds_gws_sema_release_all nogds
5+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
6+
7+
ds_gws_sema_release_all offset:4660 nogds
8+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
9+
10+
ds_gws_init v0 nogds
11+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
12+
13+
ds_gws_init v0 offset:0 nogds
14+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
15+
16+
ds_gws_sema_v nogds
17+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
18+
19+
ds_gws_sema_v offset:65535 nogds
20+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
21+
22+
ds_gws_sema_br v0 nogds
23+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
24+
25+
ds_gws_sema_br v0 offset:4660 nogds
26+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
27+
28+
ds_gws_sema_p nogds
29+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
30+
31+
ds_gws_sema_p offset:0 nogds
32+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
33+
34+
ds_gws_barrier v0 nogds
35+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
36+
37+
ds_gws_barrier v0 offset:0 nogds
38+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// RUN: not llvm-mc -triple=amdgcn -mcpu=gfx1100 %s 2>&1 | FileCheck --implicit-check-not=error: %s
2+
3+
ds_gws_barrier v1 nogds
4+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
5+
6+
ds_gws_barrier v1 offset:65535 nogds
7+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
8+
9+
ds_gws_init v1 nogds
10+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
11+
12+
ds_gws_init v1 offset:65535 nogds
13+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
14+
15+
ds_gws_sema_br v1 nogds
16+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
17+
18+
ds_gws_sema_br v1 offset:65535 nogds
19+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
20+
21+
ds_gws_sema_p nogds
22+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
23+
24+
ds_gws_sema_p offset:65535 nogds
25+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
26+
27+
ds_gws_sema_release_all nogds
28+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
29+
30+
ds_gws_sema_release_all offset:65535 nogds
31+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
32+
33+
ds_gws_sema_v nogds
34+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
35+
36+
ds_gws_sema_v offset:65535 nogds
37+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// RUN: not llvm-mc -triple=amdgcn -mcpu=bonaire %s 2>&1 | FileCheck --implicit-check-not=error: %s
2+
3+
ds_gws_sema_release_all offset:65535 nogds
4+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
5+
6+
ds_gws_sema_release_all nogds
7+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
8+
9+
ds_gws_init v1 offset:65535 nogds
10+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
11+
12+
ds_gws_init v1 nogds
13+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
14+
15+
ds_gws_sema_v offset:65535 nogds
16+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
17+
18+
ds_gws_sema_v nogds
19+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
20+
21+
ds_gws_sema_br v1 offset:65535 nogds
22+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
23+
24+
ds_gws_sema_br v1 nogds
25+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
26+
27+
ds_gws_sema_p offset:65535 nogds
28+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
29+
30+
ds_gws_sema_p nogds
31+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
32+
33+
ds_gws_barrier v255 offset:65535 nogds
34+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
35+
36+
ds_gws_barrier v1 nogds
37+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// RUN: not llvm-mc -triple=amdgcn -mcpu=tonga %s 2>&1 | FileCheck --implicit-check-not=error: %s
2+
3+
ds_gws_sema_release_all offset:65535 nogds
4+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
5+
6+
ds_gws_sema_release_all nogds
7+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
8+
9+
ds_gws_init v1 offset:65535 nogds
10+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
11+
12+
ds_gws_init v1 nogds
13+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
14+
15+
ds_gws_sema_v offset:65535 nogds
16+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
17+
18+
ds_gws_sema_v nogds
19+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
20+
21+
ds_gws_sema_br v1 offset:65535 nogds
22+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
23+
24+
ds_gws_sema_br v1 nogds
25+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
26+
27+
ds_gws_sema_p offset:65535 nogds
28+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
29+
30+
ds_gws_sema_p nogds
31+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
32+
33+
ds_gws_barrier v255 offset:65535 nogds
34+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
35+
36+
ds_gws_barrier v1 nogds
37+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// RUN: not llvm-mc -triple=amdgcn -mcpu=gfx900 %s 2>&1 | FileCheck --implicit-check-not=error: %s
2+
3+
ds_gws_sema_release_all offset:65535 nogds
4+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
5+
6+
ds_gws_sema_release_all nogds
7+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
8+
9+
ds_gws_init v1 offset:65535 nogds
10+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
11+
12+
ds_gws_init v1 nogds
13+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
14+
15+
ds_gws_sema_v offset:65535 nogds
16+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
17+
18+
ds_gws_sema_v nogds
19+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
20+
21+
ds_gws_sema_br v1 offset:65535 nogds
22+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
23+
24+
ds_gws_sema_br v1 nogds
25+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
26+
27+
ds_gws_sema_p offset:65535 nogds
28+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
29+
30+
ds_gws_sema_p nogds
31+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
32+
33+
ds_gws_barrier v1 offset:65535 nogds
34+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed
35+
36+
ds_gws_barrier v1 nogds
37+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: nogds is not allowed

0 commit comments

Comments
 (0)