Index: lib/Target/AMDGPU/SMInstructions.td =================================================================== --- lib/Target/AMDGPU/SMInstructions.td +++ lib/Target/AMDGPU/SMInstructions.td @@ -63,6 +63,18 @@ bits<1> imm = !if(ps.has_offset, ps.offset_is_imm, 0); } +class SM_Probe_Pseudo + : SM_Pseudo { + let mayLoad = 0; + let mayStore = 0; + let has_glc = 0; + let LGKM_CNT = 0; + let ScalarStore = 0; + let hasSideEffects = 1; + let offset_is_imm = isImm; + let PseudoInstr = opName # !if(isImm, "_IMM", "_SGPR"); +} + class SM_Load_Pseudo pattern=[]> : SM_Pseudo { RegisterClass BaseClass; @@ -144,6 +156,11 @@ let has_offset = 0; } +multiclass SM_Pseudo_Probe { + def _IMM : SM_Probe_Pseudo ; + def _SGPR : SM_Probe_Pseudo ; +} + //===----------------------------------------------------------------------===// // Scalar Atomic Memory Classes //===----------------------------------------------------------------------===// @@ -260,6 +277,9 @@ def S_DCACHE_WB : SM_Inval_Pseudo <"s_dcache_wb", int_amdgcn_s_dcache_wb>; def S_DCACHE_WB_VOL : SM_Inval_Pseudo <"s_dcache_wb_vol", int_amdgcn_s_dcache_wb_vol>; def S_MEMREALTIME : SM_Time_Pseudo <"s_memrealtime", int_amdgcn_s_memrealtime>; + +defm S_ATC_PROBE : SM_Pseudo_Probe <"s_atc_probe", SReg_64>; +defm S_ATC_PROBE_BUFFER : SM_Pseudo_Probe <"s_atc_probe_buffer", SReg_128>; } // SubtargetPredicate = isVI let SubtargetPredicate = HasFlatScratchInsts, Uses = [FLAT_SCR] in { @@ -522,6 +542,11 @@ } } +multiclass SM_Real_Probe_vi op, string ps> { + def _IMM_vi : SMEM_Real_Store_vi (ps#_IMM)>; + def _SGPR_vi : SMEM_Real_Store_vi (ps#_SGPR)>; +} + defm S_LOAD_DWORD : SM_Real_Loads_vi <0x00, "S_LOAD_DWORD">; defm S_LOAD_DWORDX2 : SM_Real_Loads_vi <0x01, "S_LOAD_DWORDX2">; defm S_LOAD_DWORDX4 : SM_Real_Loads_vi <0x02, "S_LOAD_DWORDX4">; @@ -557,6 +582,9 @@ defm S_SCRATCH_STORE_DWORDX2 : SM_Real_Stores_vi <0x16, "S_SCRATCH_STORE_DWORDX2">; defm S_SCRATCH_STORE_DWORDX4 : SM_Real_Stores_vi <0x17, "S_SCRATCH_STORE_DWORDX4">; +defm S_ATC_PROBE : SM_Real_Probe_vi <0x26, "S_ATC_PROBE">; +defm S_ATC_PROBE_BUFFER : SM_Real_Probe_vi <0x27, "S_ATC_PROBE_BUFFER">; + //===----------------------------------------------------------------------===// // GFX9 //===----------------------------------------------------------------------===// Index: test/MC/AMDGPU/smem.s =================================================================== --- test/MC/AMDGPU/smem.s +++ test/MC/AMDGPU/smem.s @@ -16,6 +16,22 @@ // GFX89: s_dcache_wb_vol ; encoding: [0x00,0x00,0x8c,0xc0,0x00,0x00,0x00,0x00] // NOSICI: error: instruction not supported on this GPU +s_atc_probe 0x7, s[4:5], s0 +// GFX89: s_atc_probe 7, s[4:5], s0 ; encoding: [0xc2,0x01,0x98,0xc0,0x00,0x00,0x00,0x00] +// NOSICI: error: instruction not supported on this GPU + +s_atc_probe 0x0, s[4:5], 0x0 +// GFX89: s_atc_probe 0, s[4:5], 0x0 ; encoding: [0x02,0x00,0x9a,0xc0,0x00,0x00,0x00,0x00] +// NOSICI: error: instruction not supported on this GPU + +s_atc_probe_buffer 0x1, s[8:11], s0 +// GFX89: s_atc_probe_buffer 1, s[8:11], s0 ; encoding: [0x44,0x00,0x9c,0xc0,0x00,0x00,0x00,0x00] +// NOSICI: error: instruction not supported on this GPU + +s_atc_probe_buffer 0x0, s[8:11], s101 +// GFX89: s_atc_probe_buffer 0, s[8:11], s101 ; encoding: [0x04,0x00,0x9c,0xc0,0x65,0x00,0x00,0x00] +// NOSICI: error: instruction not supported on this GPU + s_memrealtime s[4:5] // GFX89: s_memrealtime s[4:5] ; encoding: [0x00,0x01,0x94,0xc0,0x00,0x00,0x00,0x00] // NOSICI: error: instruction not supported on this GPU Index: test/MC/Disassembler/AMDGPU/smem_vi.txt =================================================================== --- test/MC/Disassembler/AMDGPU/smem_vi.txt +++ test/MC/Disassembler/AMDGPU/smem_vi.txt @@ -44,3 +44,15 @@ # VI: s_buffer_load_dwordx4 s[8:11], s[92:95], m0 glc ; encoding: [0x2e,0x02,0x29,0xc0,0x7c,0x00,0x00,0x00] 0x2e 0x02 0x29 0xc0 0x7c 0x00 0x00 0x00 + +# VI: s_atc_probe 7, s[4:5], s0 ; encoding: [0xc2,0x01,0x98,0xc0,0x00,0x00,0x00,0x00] +0xc2,0x01,0x98,0xc0,0x00,0x00,0x00,0x00 + +# VI: s_atc_probe 0, s[4:5], 0x0 ; encoding: [0x02,0x00,0x9a,0xc0,0x00,0x00,0x00,0x00] +0x02,0x00,0x9a,0xc0,0x00,0x00,0x00,0x00 + +# VI: s_atc_probe_buffer 1, s[8:11], s0 ; encoding: [0x44,0x00,0x9c,0xc0,0x00,0x00,0x00,0x00] +0x44,0x00,0x9c,0xc0,0x00,0x00,0x00,0x00 + +# VI: s_atc_probe_buffer 0, s[8:11], s101 ; encoding: [0x04,0x00,0x9c,0xc0,0x65,0x00,0x00,0x00] +0x04,0x00,0x9c,0xc0,0x65,0x00,0x00,0x00