From 528aa090104a2d390ea47dabc100801abca150a3 Mon Sep 17 00:00:00 2001 From: Anshil Gandhi Date: Tue, 12 Apr 2022 09:46:41 -0600 Subject: [PATCH] [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 --- llvm/lib/Target/AMDGPU/MIMGInstructions.td | 22 ++++++---- llvm/test/MC/AMDGPU/gfx7_unsupported.s | 48 ++++++++++++++++++++++ llvm/test/MC/AMDGPU/gfx8_unsupported.s | 48 ++++++++++++++++++++++ llvm/test/MC/AMDGPU/gfx9_unsupported.s | 48 ++++++++++++++++++++++ 4 files changed, 157 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/MIMGInstructions.td b/llvm/lib/Target/AMDGPU/MIMGInstructions.td index 1d7a3a52e4d5..9427355a1fbc 100644 --- a/llvm/lib/Target/AMDGPU/MIMGInstructions.td +++ b/llvm/lib/Target/AMDGPU/MIMGInstructions.td @@ -1000,8 +1000,6 @@ let OtherPredicates = [HasExtendedImageInsts] in { defm IMAGE_SAMPLE_CL : MIMG_Sampler_WQM , AMDGPUSample_cl>; defm IMAGE_SAMPLE_D : MIMG_Sampler , AMDGPUSample_d>; defm IMAGE_SAMPLE_D_CL : MIMG_Sampler , AMDGPUSample_d_cl>; -defm IMAGE_SAMPLE_D_G16 : MIMG_Sampler , AMDGPUSample_d, 0, 1>; -defm IMAGE_SAMPLE_D_CL_G16 : MIMG_Sampler , AMDGPUSample_d_cl, 0, 1>; defm IMAGE_SAMPLE_L : MIMG_Sampler , AMDGPUSample_l>; defm IMAGE_SAMPLE_B : MIMG_Sampler_WQM , AMDGPUSample_b>; defm IMAGE_SAMPLE_B_CL : MIMG_Sampler_WQM , AMDGPUSample_b_cl>; @@ -1010,8 +1008,6 @@ defm IMAGE_SAMPLE_C : MIMG_Sampler_WQM , AMDGPUSample_ defm IMAGE_SAMPLE_C_CL : MIMG_Sampler_WQM , AMDGPUSample_c_cl>; defm IMAGE_SAMPLE_C_D : MIMG_Sampler , AMDGPUSample_c_d>; defm IMAGE_SAMPLE_C_D_CL : MIMG_Sampler , AMDGPUSample_c_d_cl>; -defm IMAGE_SAMPLE_C_D_G16 : MIMG_Sampler , AMDGPUSample_c_d, 0, 1>; -defm IMAGE_SAMPLE_C_D_CL_G16 : MIMG_Sampler , AMDGPUSample_c_d_cl, 0, 1>; defm IMAGE_SAMPLE_C_L : MIMG_Sampler , AMDGPUSample_c_l>; defm IMAGE_SAMPLE_C_B : MIMG_Sampler_WQM , AMDGPUSample_c_b>; defm IMAGE_SAMPLE_C_B_CL : MIMG_Sampler_WQM , AMDGPUSample_c_b_cl>; @@ -1020,8 +1016,6 @@ defm IMAGE_SAMPLE_O : MIMG_Sampler_WQM , AMDGPUSample_ defm IMAGE_SAMPLE_CL_O : MIMG_Sampler_WQM , AMDGPUSample_cl_o>; defm IMAGE_SAMPLE_D_O : MIMG_Sampler , AMDGPUSample_d_o>; defm IMAGE_SAMPLE_D_CL_O : MIMG_Sampler , AMDGPUSample_d_cl_o>; -defm IMAGE_SAMPLE_D_O_G16 : MIMG_Sampler , AMDGPUSample_d_o, 0, 1>; -defm IMAGE_SAMPLE_D_CL_O_G16 : MIMG_Sampler , AMDGPUSample_d_cl_o, 0, 1>; defm IMAGE_SAMPLE_L_O : MIMG_Sampler , AMDGPUSample_l_o>; defm IMAGE_SAMPLE_B_O : MIMG_Sampler_WQM , AMDGPUSample_b_o>; defm IMAGE_SAMPLE_B_CL_O : MIMG_Sampler_WQM , AMDGPUSample_b_cl_o>; @@ -1030,8 +1024,6 @@ defm IMAGE_SAMPLE_C_O : MIMG_Sampler_WQM , AMDGPUSample_ defm IMAGE_SAMPLE_C_CL_O : MIMG_Sampler_WQM , AMDGPUSample_c_cl_o>; defm IMAGE_SAMPLE_C_D_O : MIMG_Sampler , AMDGPUSample_c_d_o>; defm IMAGE_SAMPLE_C_D_CL_O : MIMG_Sampler , AMDGPUSample_c_d_cl_o>; -defm IMAGE_SAMPLE_C_D_O_G16 : MIMG_Sampler , AMDGPUSample_c_d_o, 0, 1>; -defm IMAGE_SAMPLE_C_D_CL_O_G16 : MIMG_Sampler , AMDGPUSample_c_d_cl_o, 0, 1>; defm IMAGE_SAMPLE_C_L_O : MIMG_Sampler , AMDGPUSample_c_l_o>; defm IMAGE_SAMPLE_C_B_CL_O : MIMG_Sampler_WQM , AMDGPUSample_c_b_cl_o>; defm IMAGE_SAMPLE_C_B_O : MIMG_Sampler_WQM , AMDGPUSample_c_b_o>; @@ -1072,6 +1064,17 @@ defm IMAGE_SAMPLE_CD_O : MIMG_Sampler , AMDGPUSample_cd_o defm IMAGE_SAMPLE_CD_CL_O : MIMG_Sampler , AMDGPUSample_cd_cl_o>; defm IMAGE_SAMPLE_C_CD_O : MIMG_Sampler , AMDGPUSample_c_cd_o>; defm IMAGE_SAMPLE_C_CD_CL_O : MIMG_Sampler , AMDGPUSample_c_cd_cl_o>; +} // End OtherPredicates = [HasExtendedImageInsts] + +let OtherPredicates = [HasExtendedImageInsts,HasG16] in { +defm IMAGE_SAMPLE_D_G16 : MIMG_Sampler , AMDGPUSample_d, 0, 1>; +defm IMAGE_SAMPLE_D_CL_G16 : MIMG_Sampler , AMDGPUSample_d_cl, 0, 1>; +defm IMAGE_SAMPLE_C_D_G16 : MIMG_Sampler , AMDGPUSample_c_d, 0, 1>; +defm IMAGE_SAMPLE_C_D_CL_G16 : MIMG_Sampler , AMDGPUSample_c_d_cl, 0, 1>; +defm IMAGE_SAMPLE_D_O_G16 : MIMG_Sampler , AMDGPUSample_d_o, 0, 1>; +defm IMAGE_SAMPLE_D_CL_O_G16 : MIMG_Sampler , AMDGPUSample_d_cl_o, 0, 1>; +defm IMAGE_SAMPLE_C_D_O_G16 : MIMG_Sampler , AMDGPUSample_c_d_o, 0, 1>; +defm IMAGE_SAMPLE_C_D_CL_O_G16 : MIMG_Sampler , AMDGPUSample_c_d_cl_o, 0, 1>; defm IMAGE_SAMPLE_CD_G16 : MIMG_Sampler , AMDGPUSample_cd, 0, 1>; defm IMAGE_SAMPLE_CD_CL_G16 : MIMG_Sampler , AMDGPUSample_cd_cl, 0, 1>; defm IMAGE_SAMPLE_C_CD_G16 : MIMG_Sampler , AMDGPUSample_c_cd, 0, 1>; @@ -1080,7 +1083,8 @@ defm IMAGE_SAMPLE_CD_O_G16 : MIMG_Sampler , AMDGPUSample_cd_o defm IMAGE_SAMPLE_CD_CL_O_G16 : MIMG_Sampler , AMDGPUSample_cd_cl_o, 0, 1>; defm IMAGE_SAMPLE_C_CD_O_G16 : MIMG_Sampler , AMDGPUSample_c_cd_o, 0, 1>; defm IMAGE_SAMPLE_C_CD_CL_O_G16 : MIMG_Sampler , AMDGPUSample_c_cd_cl_o, 0, 1>; -} // End OtherPredicates = [HasExtendedImageInsts] +} // End OtherPredicates = [HasExtendedImageInsts,HasG16] + //def IMAGE_RSRC256 : MIMG_NoPattern_RSRC256 <"image_rsrc256", 0x0000007e>; //def IMAGE_SAMPLER : MIMG_NoPattern_ <"image_sampler", 0x0000007f>; diff --git a/llvm/test/MC/AMDGPU/gfx7_unsupported.s b/llvm/test/MC/AMDGPU/gfx7_unsupported.s index 81146340ad72..e295f4ff2174 100644 --- a/llvm/test/MC/AMDGPU/gfx7_unsupported.s +++ b/llvm/test/MC/AMDGPU/gfx7_unsupported.s @@ -2546,6 +2546,54 @@ v_xor3_b32 v255, v1, v2, v3 // Unsupported e64 variants. //===----------------------------------------------------------------------===// +image_sample_c_cd_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_cd_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_cd_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_cd_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + v_interp_mov_f32_e64 v255, p10, attr0.x // CHECK: error: e64 variant of this instruction is not supported diff --git a/llvm/test/MC/AMDGPU/gfx8_unsupported.s b/llvm/test/MC/AMDGPU/gfx8_unsupported.s index 47f0f35c4d84..ede155d88228 100644 --- a/llvm/test/MC/AMDGPU/gfx8_unsupported.s +++ b/llvm/test/MC/AMDGPU/gfx8_unsupported.s @@ -4,6 +4,54 @@ // Unsupported instructions. //===----------------------------------------------------------------------===// +image_sample_c_cd_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_cd_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_cd_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_cd_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + buffer_atomic_add_f32 v255, off, s[8:11], s3 offset:4095 // CHECK: error: instruction not supported on this GPU diff --git a/llvm/test/MC/AMDGPU/gfx9_unsupported.s b/llvm/test/MC/AMDGPU/gfx9_unsupported.s index cf1b2b90c8c5..f085b7bc46d2 100644 --- a/llvm/test/MC/AMDGPU/gfx9_unsupported.s +++ b/llvm/test/MC/AMDGPU/gfx9_unsupported.s @@ -4,6 +4,54 @@ // Unsupported instructions. //===----------------------------------------------------------------------===// +image_sample_c_cd_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_cd_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_cd_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_cd_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_cl_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_cl_o_g16 v[5:6], v[1:6], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_c_d_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_cd_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_cl_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_cl_o_g16 v[5:6], v[1:5], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_g16 v[5:6], v[1:3], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + +image_sample_d_o_g16 v[5:6], v[1:4], s[8:15], s[12:15] dmask:0x3 +// CHECK: error: instruction not supported on this GPU + buffer_atomic_add_f32 v255, off, s[8:11], s3 offset:4095 // CHECK: error: instruction not supported on this GPU