Skip to content

Commit 528aa09

Browse files
committed
[AMDGPU][Codegen] Unsupported image sample texture map instructions
Disables image_sample_*_g16 instructions on architectures lacking g16 support. This patch fixes the issue 54672. Differential Revision: https://reviews.llvm.org/D123461
1 parent d9211be commit 528aa09

File tree

4 files changed

+157
-9
lines changed

4 files changed

+157
-9
lines changed

llvm/lib/Target/AMDGPU/MIMGInstructions.td

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,8 +1000,6 @@ let OtherPredicates = [HasExtendedImageInsts] in {
10001000
defm IMAGE_SAMPLE_CL : MIMG_Sampler_WQM <mimgopc<0x21>, AMDGPUSample_cl>;
10011001
defm IMAGE_SAMPLE_D : MIMG_Sampler <mimgopc<0x22>, AMDGPUSample_d>;
10021002
defm IMAGE_SAMPLE_D_CL : MIMG_Sampler <mimgopc<0x23>, AMDGPUSample_d_cl>;
1003-
defm IMAGE_SAMPLE_D_G16 : MIMG_Sampler <mimgopc<0xa2>, AMDGPUSample_d, 0, 1>;
1004-
defm IMAGE_SAMPLE_D_CL_G16 : MIMG_Sampler <mimgopc<0xa3>, AMDGPUSample_d_cl, 0, 1>;
10051003
defm IMAGE_SAMPLE_L : MIMG_Sampler <mimgopc<0x24>, AMDGPUSample_l>;
10061004
defm IMAGE_SAMPLE_B : MIMG_Sampler_WQM <mimgopc<0x25>, AMDGPUSample_b>;
10071005
defm IMAGE_SAMPLE_B_CL : MIMG_Sampler_WQM <mimgopc<0x26>, AMDGPUSample_b_cl>;
@@ -1010,8 +1008,6 @@ defm IMAGE_SAMPLE_C : MIMG_Sampler_WQM <mimgopc<0x28>, AMDGPUSample_
10101008
defm IMAGE_SAMPLE_C_CL : MIMG_Sampler_WQM <mimgopc<0x29>, AMDGPUSample_c_cl>;
10111009
defm IMAGE_SAMPLE_C_D : MIMG_Sampler <mimgopc<0x2a>, AMDGPUSample_c_d>;
10121010
defm IMAGE_SAMPLE_C_D_CL : MIMG_Sampler <mimgopc<0x2b>, AMDGPUSample_c_d_cl>;
1013-
defm IMAGE_SAMPLE_C_D_G16 : MIMG_Sampler <mimgopc<0xaa>, AMDGPUSample_c_d, 0, 1>;
1014-
defm IMAGE_SAMPLE_C_D_CL_G16 : MIMG_Sampler <mimgopc<0xab>, AMDGPUSample_c_d_cl, 0, 1>;
10151011
defm IMAGE_SAMPLE_C_L : MIMG_Sampler <mimgopc<0x2c>, AMDGPUSample_c_l>;
10161012
defm IMAGE_SAMPLE_C_B : MIMG_Sampler_WQM <mimgopc<0x2d>, AMDGPUSample_c_b>;
10171013
defm IMAGE_SAMPLE_C_B_CL : MIMG_Sampler_WQM <mimgopc<0x2e>, AMDGPUSample_c_b_cl>;
@@ -1020,8 +1016,6 @@ defm IMAGE_SAMPLE_O : MIMG_Sampler_WQM <mimgopc<0x30>, AMDGPUSample_
10201016
defm IMAGE_SAMPLE_CL_O : MIMG_Sampler_WQM <mimgopc<0x31>, AMDGPUSample_cl_o>;
10211017
defm IMAGE_SAMPLE_D_O : MIMG_Sampler <mimgopc<0x32>, AMDGPUSample_d_o>;
10221018
defm IMAGE_SAMPLE_D_CL_O : MIMG_Sampler <mimgopc<0x33>, AMDGPUSample_d_cl_o>;
1023-
defm IMAGE_SAMPLE_D_O_G16 : MIMG_Sampler <mimgopc<0xb2>, AMDGPUSample_d_o, 0, 1>;
1024-
defm IMAGE_SAMPLE_D_CL_O_G16 : MIMG_Sampler <mimgopc<0xb3>, AMDGPUSample_d_cl_o, 0, 1>;
10251019
defm IMAGE_SAMPLE_L_O : MIMG_Sampler <mimgopc<0x34>, AMDGPUSample_l_o>;
10261020
defm IMAGE_SAMPLE_B_O : MIMG_Sampler_WQM <mimgopc<0x35>, AMDGPUSample_b_o>;
10271021
defm IMAGE_SAMPLE_B_CL_O : MIMG_Sampler_WQM <mimgopc<0x36>, AMDGPUSample_b_cl_o>;
@@ -1030,8 +1024,6 @@ defm IMAGE_SAMPLE_C_O : MIMG_Sampler_WQM <mimgopc<0x38>, AMDGPUSample_
10301024
defm IMAGE_SAMPLE_C_CL_O : MIMG_Sampler_WQM <mimgopc<0x39>, AMDGPUSample_c_cl_o>;
10311025
defm IMAGE_SAMPLE_C_D_O : MIMG_Sampler <mimgopc<0x3a>, AMDGPUSample_c_d_o>;
10321026
defm IMAGE_SAMPLE_C_D_CL_O : MIMG_Sampler <mimgopc<0x3b>, AMDGPUSample_c_d_cl_o>;
1033-
defm IMAGE_SAMPLE_C_D_O_G16 : MIMG_Sampler <mimgopc<0xba>, AMDGPUSample_c_d_o, 0, 1>;
1034-
defm IMAGE_SAMPLE_C_D_CL_O_G16 : MIMG_Sampler <mimgopc<0xbb>, AMDGPUSample_c_d_cl_o, 0, 1>;
10351027
defm IMAGE_SAMPLE_C_L_O : MIMG_Sampler <mimgopc<0x3c>, AMDGPUSample_c_l_o>;
10361028
defm IMAGE_SAMPLE_C_B_CL_O : MIMG_Sampler_WQM <mimgopc<0x3e>, AMDGPUSample_c_b_cl_o>;
10371029
defm IMAGE_SAMPLE_C_B_O : MIMG_Sampler_WQM <mimgopc<0x3d>, AMDGPUSample_c_b_o>;
@@ -1072,6 +1064,17 @@ defm IMAGE_SAMPLE_CD_O : MIMG_Sampler <mimgopc<0x6c>, AMDGPUSample_cd_o
10721064
defm IMAGE_SAMPLE_CD_CL_O : MIMG_Sampler <mimgopc<0x6d>, AMDGPUSample_cd_cl_o>;
10731065
defm IMAGE_SAMPLE_C_CD_O : MIMG_Sampler <mimgopc<0x6e>, AMDGPUSample_c_cd_o>;
10741066
defm IMAGE_SAMPLE_C_CD_CL_O : MIMG_Sampler <mimgopc<0x6f>, AMDGPUSample_c_cd_cl_o>;
1067+
} // End OtherPredicates = [HasExtendedImageInsts]
1068+
1069+
let OtherPredicates = [HasExtendedImageInsts,HasG16] in {
1070+
defm IMAGE_SAMPLE_D_G16 : MIMG_Sampler <mimgopc<0xa2>, AMDGPUSample_d, 0, 1>;
1071+
defm IMAGE_SAMPLE_D_CL_G16 : MIMG_Sampler <mimgopc<0xa3>, AMDGPUSample_d_cl, 0, 1>;
1072+
defm IMAGE_SAMPLE_C_D_G16 : MIMG_Sampler <mimgopc<0xaa>, AMDGPUSample_c_d, 0, 1>;
1073+
defm IMAGE_SAMPLE_C_D_CL_G16 : MIMG_Sampler <mimgopc<0xab>, AMDGPUSample_c_d_cl, 0, 1>;
1074+
defm IMAGE_SAMPLE_D_O_G16 : MIMG_Sampler <mimgopc<0xb2>, AMDGPUSample_d_o, 0, 1>;
1075+
defm IMAGE_SAMPLE_D_CL_O_G16 : MIMG_Sampler <mimgopc<0xb3>, AMDGPUSample_d_cl_o, 0, 1>;
1076+
defm IMAGE_SAMPLE_C_D_O_G16 : MIMG_Sampler <mimgopc<0xba>, AMDGPUSample_c_d_o, 0, 1>;
1077+
defm IMAGE_SAMPLE_C_D_CL_O_G16 : MIMG_Sampler <mimgopc<0xbb>, AMDGPUSample_c_d_cl_o, 0, 1>;
10751078
defm IMAGE_SAMPLE_CD_G16 : MIMG_Sampler <mimgopc<0xe8>, AMDGPUSample_cd, 0, 1>;
10761079
defm IMAGE_SAMPLE_CD_CL_G16 : MIMG_Sampler <mimgopc<0xe9>, AMDGPUSample_cd_cl, 0, 1>;
10771080
defm IMAGE_SAMPLE_C_CD_G16 : MIMG_Sampler <mimgopc<0xea>, AMDGPUSample_c_cd, 0, 1>;
@@ -1080,7 +1083,8 @@ defm IMAGE_SAMPLE_CD_O_G16 : MIMG_Sampler <mimgopc<0xec>, AMDGPUSample_cd_o
10801083
defm IMAGE_SAMPLE_CD_CL_O_G16 : MIMG_Sampler <mimgopc<0xed>, AMDGPUSample_cd_cl_o, 0, 1>;
10811084
defm IMAGE_SAMPLE_C_CD_O_G16 : MIMG_Sampler <mimgopc<0xee>, AMDGPUSample_c_cd_o, 0, 1>;
10821085
defm IMAGE_SAMPLE_C_CD_CL_O_G16 : MIMG_Sampler <mimgopc<0xef>, AMDGPUSample_c_cd_cl_o, 0, 1>;
1083-
} // End OtherPredicates = [HasExtendedImageInsts]
1086+
} // End OtherPredicates = [HasExtendedImageInsts,HasG16]
1087+
10841088
//def IMAGE_RSRC256 : MIMG_NoPattern_RSRC256 <"image_rsrc256", 0x0000007e>;
10851089
//def IMAGE_SAMPLER : MIMG_NoPattern_ <"image_sampler", 0x0000007f>;
10861090

llvm/test/MC/AMDGPU/gfx7_unsupported.s

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,6 +2546,54 @@ v_xor3_b32 v255, v1, v2, v3
25462546
// Unsupported e64 variants.
25472547
//===----------------------------------------------------------------------===//
25482548

2549+
image_sample_c_cd_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
2550+
// CHECK: error: instruction not supported on this GPU
2551+
2552+
image_sample_c_cd_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3
2553+
// CHECK: error: instruction not supported on this GPU
2554+
2555+
image_sample_c_cd_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
2556+
// CHECK: error: instruction not supported on this GPU
2557+
2558+
image_sample_c_cd_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
2559+
// CHECK: error: instruction not supported on this GPU
2560+
2561+
image_sample_c_d_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
2562+
// CHECK: error: instruction not supported on this GPU
2563+
2564+
image_sample_c_d_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3
2565+
// CHECK: error: instruction not supported on this GPU
2566+
2567+
image_sample_c_d_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
2568+
// CHECK: error: instruction not supported on this GPU
2569+
2570+
image_sample_c_d_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
2571+
// CHECK: error: instruction not supported on this GPU
2572+
2573+
image_sample_cd_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
2574+
// CHECK: error: instruction not supported on this GPU
2575+
2576+
image_sample_cd_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
2577+
// CHECK: error: instruction not supported on this GPU
2578+
2579+
image_sample_cd_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3
2580+
// CHECK: error: instruction not supported on this GPU
2581+
2582+
image_sample_cd_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
2583+
// CHECK: error: instruction not supported on this GPU
2584+
2585+
image_sample_d_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
2586+
// CHECK: error: instruction not supported on this GPU
2587+
2588+
image_sample_d_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
2589+
// CHECK: error: instruction not supported on this GPU
2590+
2591+
image_sample_d_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3
2592+
// CHECK: error: instruction not supported on this GPU
2593+
2594+
image_sample_d_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
2595+
// CHECK: error: instruction not supported on this GPU
2596+
25492597
v_interp_mov_f32_e64 v255, p10, attr0.x
25502598
// CHECK: error: e64 variant of this instruction is not supported
25512599

llvm/test/MC/AMDGPU/gfx8_unsupported.s

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,54 @@
44
// Unsupported instructions.
55
//===----------------------------------------------------------------------===//
66

7+
image_sample_c_cd_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
8+
// CHECK: error: instruction not supported on this GPU
9+
10+
image_sample_c_cd_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3
11+
// CHECK: error: instruction not supported on this GPU
12+
13+
image_sample_c_cd_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
14+
// CHECK: error: instruction not supported on this GPU
15+
16+
image_sample_c_cd_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
17+
// CHECK: error: instruction not supported on this GPU
18+
19+
image_sample_c_d_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
20+
// CHECK: error: instruction not supported on this GPU
21+
22+
image_sample_c_d_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3
23+
// CHECK: error: instruction not supported on this GPU
24+
25+
image_sample_c_d_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
26+
// CHECK: error: instruction not supported on this GPU
27+
28+
image_sample_c_d_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
29+
// CHECK: error: instruction not supported on this GPU
30+
31+
image_sample_cd_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
32+
// CHECK: error: instruction not supported on this GPU
33+
34+
image_sample_cd_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
35+
// CHECK: error: instruction not supported on this GPU
36+
37+
image_sample_cd_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3
38+
// CHECK: error: instruction not supported on this GPU
39+
40+
image_sample_cd_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
41+
// CHECK: error: instruction not supported on this GPU
42+
43+
image_sample_d_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
44+
// CHECK: error: instruction not supported on this GPU
45+
46+
image_sample_d_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
47+
// CHECK: error: instruction not supported on this GPU
48+
49+
image_sample_d_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3
50+
// CHECK: error: instruction not supported on this GPU
51+
52+
image_sample_d_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
53+
// CHECK: error: instruction not supported on this GPU
54+
755
buffer_atomic_add_f32 v255, off, s[8:11], s3 offset:4095
856
// CHECK: error: instruction not supported on this GPU
957

llvm/test/MC/AMDGPU/gfx9_unsupported.s

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,54 @@
44
// Unsupported instructions.
55
//===----------------------------------------------------------------------===//
66

7+
image_sample_c_cd_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
8+
// CHECK: error: instruction not supported on this GPU
9+
10+
image_sample_c_cd_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3
11+
// CHECK: error: instruction not supported on this GPU
12+
13+
image_sample_c_cd_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
14+
// CHECK: error: instruction not supported on this GPU
15+
16+
image_sample_c_cd_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
17+
// CHECK: error: instruction not supported on this GPU
18+
19+
image_sample_c_d_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
20+
// CHECK: error: instruction not supported on this GPU
21+
22+
image_sample_c_d_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3
23+
// CHECK: error: instruction not supported on this GPU
24+
25+
image_sample_c_d_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
26+
// CHECK: error: instruction not supported on this GPU
27+
28+
image_sample_c_d_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
29+
// CHECK: error: instruction not supported on this GPU
30+
31+
image_sample_cd_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
32+
// CHECK: error: instruction not supported on this GPU
33+
34+
image_sample_cd_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
35+
// CHECK: error: instruction not supported on this GPU
36+
37+
image_sample_cd_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3
38+
// CHECK: error: instruction not supported on this GPU
39+
40+
image_sample_cd_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
41+
// CHECK: error: instruction not supported on this GPU
42+
43+
image_sample_d_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
44+
// CHECK: error: instruction not supported on this GPU
45+
46+
image_sample_d_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3
47+
// CHECK: error: instruction not supported on this GPU
48+
49+
image_sample_d_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3
50+
// CHECK: error: instruction not supported on this GPU
51+
52+
image_sample_d_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3
53+
// CHECK: error: instruction not supported on this GPU
54+
755
buffer_atomic_add_f32 v255, off, s[8:11], s3 offset:4095
856
// CHECK: error: instruction not supported on this GPU
957

0 commit comments

Comments
 (0)