Index: llvm/trunk/lib/Target/AMDGPU/SMInstructions.td =================================================================== --- llvm/trunk/lib/Target/AMDGPU/SMInstructions.td +++ llvm/trunk/lib/Target/AMDGPU/SMInstructions.td @@ -81,6 +81,18 @@ let ScalarStore = 1; } +class SM_Discard_Pseudo + : SM_Pseudo { + let mayLoad = 0; + let mayStore = 0; + let has_glc = 0; + let has_sdst = 0; + let ScalarStore = 0; + let hasSideEffects = 1; + let offset_is_imm = isImm; + let PseudoInstr = opName # !if(isImm, "_IMM", "_SGPR"); +} + multiclass SM_Pseudo_Loads { @@ -125,6 +137,11 @@ } } +multiclass SM_Pseudo_Discards { + def _IMM : SM_Discard_Pseudo ; + def _SGPR : SM_Discard_Pseudo ; +} + class SM_Time_Pseudo : SM_Pseudo< opName, (outs SReg_64_XEXEC:$sdst), (ins), " $sdst", [(set i64:$sdst, (node))]> { @@ -332,6 +349,11 @@ } // let SubtargetPredicate = HasScalarAtomics +let SubtargetPredicate = isGFX9 in { +defm S_DCACHE_DISCARD : SM_Pseudo_Discards <"s_dcache_discard">; +defm S_DCACHE_DISCARD_X2 : SM_Pseudo_Discards <"s_dcache_discard_x2">; +} + //===----------------------------------------------------------------------===// // Scalar Memory Patterns //===----------------------------------------------------------------------===// @@ -636,6 +658,14 @@ defm S_ATOMIC_INC_X2 : SM_Real_Atomics_vi <0xab, "S_ATOMIC_INC_X2">; defm S_ATOMIC_DEC_X2 : SM_Real_Atomics_vi <0xac, "S_ATOMIC_DEC_X2">; +multiclass SM_Real_Discard_vi op, string ps> { + def _IMM_vi : SMEM_Real_vi (ps#_IMM)>; + def _SGPR_vi : SMEM_Real_vi (ps#_SGPR)>; +} + +defm S_DCACHE_DISCARD : SM_Real_Discard_vi <0x28, "S_DCACHE_DISCARD">; +defm S_DCACHE_DISCARD_X2 : SM_Real_Discard_vi <0x29, "S_DCACHE_DISCARD_X2">; + //===----------------------------------------------------------------------===// // CI //===----------------------------------------------------------------------===// Index: llvm/trunk/test/MC/AMDGPU/smem.s =================================================================== --- llvm/trunk/test/MC/AMDGPU/smem.s +++ llvm/trunk/test/MC/AMDGPU/smem.s @@ -214,6 +214,26 @@ // NOSICIVI: error //===----------------------------------------------------------------------===// +// s_dcache_discard instructions +//===----------------------------------------------------------------------===// + +s_dcache_discard s[2:3], s0 +// GFX9: s_dcache_discard s[2:3], s0 ; encoding: [0x01,0x00,0xa0,0xc0,0x00,0x00,0x00,0x00] +// NOSICIVI: error: instruction not supported on this GPU + +s_dcache_discard s[2:3], 0x0 +// GFX9: s_dcache_discard s[2:3], 0x0 ; encoding: [0x01,0x00,0xa2,0xc0,0x00,0x00,0x00,0x00] +// NOSICIVI: error: instruction not supported on this GPU + +s_dcache_discard_x2 s[2:3], s101 +// GFX9: s_dcache_discard_x2 s[2:3], s101 ; encoding: [0x01,0x00,0xa4,0xc0,0x65,0x00,0x00,0x00] +// NOSICIVI: error: instruction not supported on this GPU + +s_dcache_discard_x2 s[2:3], 0x0 +// GFX9: s_dcache_discard_x2 s[2:3], 0x0 ; encoding: [0x01,0x00,0xa6,0xc0,0x00,0x00,0x00,0x00] +// NOSICIVI: error: instruction not supported on this GPU + +//===----------------------------------------------------------------------===// // s_atomic instructions //===----------------------------------------------------------------------===// Index: llvm/trunk/test/MC/Disassembler/AMDGPU/smem_gfx9.txt =================================================================== --- llvm/trunk/test/MC/Disassembler/AMDGPU/smem_gfx9.txt +++ llvm/trunk/test/MC/Disassembler/AMDGPU/smem_gfx9.txt @@ -32,6 +32,22 @@ 0x02,0x01,0x5d,0xc0,0x00,0x00,0x00,0x00 #===------------------------------------------------------------------------===# +# s_dcache_discard +#===------------------------------------------------------------------------===# + +# GFX9: s_dcache_discard s[100:101], s0 ; encoding: [0x32,0x00,0xa0,0xc0,0x00,0x00,0x00,0x00] +0x32,0x00,0xa0,0xc0,0x00,0x00,0x00,0x00 + +# GFX9: s_dcache_discard s[2:3], 0x0 ; encoding: [0x01,0x00,0xa2,0xc0,0x00,0x00,0x00,0x00] +0x01,0x00,0xa2,0xc0,0x00,0x00,0x00,0x00 + +# GFX9: s_dcache_discard_x2 s[2:3], s101 ; encoding: [0x01,0x00,0xa4,0xc0,0x65,0x00,0x00,0x00] +0x01,0x00,0xa4,0xc0,0x65,0x00,0x00,0x00 + +# GFX9: s_dcache_discard_x2 s[2:3], 0x0 ; encoding: [0x01,0x00,0xa6,0xc0,0x00,0x00,0x00,0x00] +0x01,0x00,0xa6,0xc0,0x00,0x00,0x00,0x00 + +#===------------------------------------------------------------------------===# # s_atomic #===------------------------------------------------------------------------===#