Skip to content

Commit 2a0ec5f

Browse files
authored
[AMDGPU] Add GFX11.5 s_singleuse_vdst instruction (#67536)
1 parent 7e8a0e4 commit 2a0ec5f

File tree

7 files changed

+53
-1
lines changed

7 files changed

+53
-1
lines changed

llvm/lib/Target/AMDGPU/AMDGPU.td

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,12 @@ def FeatureSALUFloatInsts : SubtargetFeature<"salu-float",
797797
"Has SALU floating point instructions"
798798
>;
799799

800+
def FeatureVGPRSingleUseHintInsts : SubtargetFeature<"vgpr-singleuse-hint",
801+
"HasVGPRSingleUseHintInsts",
802+
"true",
803+
"Has single-use VGPR hint instructions"
804+
>;
805+
800806
//===------------------------------------------------------------===//
801807
// Subtarget Features (options and debugging)
802808
//===------------------------------------------------------------===//
@@ -1390,12 +1396,14 @@ def FeatureISAVersion11_0_3 : FeatureSet<
13901396
def FeatureISAVersion11_5_0 : FeatureSet<
13911397
!listconcat(FeatureISAVersion11_Common.Features,
13921398
[FeatureSALUFloatInsts,
1393-
FeatureDPPSrc1SGPR])>;
1399+
FeatureDPPSrc1SGPR,
1400+
FeatureVGPRSingleUseHintInsts])>;
13941401

13951402
def FeatureISAVersion11_5_1 : FeatureSet<
13961403
!listconcat(FeatureISAVersion11_Common.Features,
13971404
[FeatureSALUFloatInsts,
13981405
FeatureDPPSrc1SGPR,
1406+
FeatureVGPRSingleUseHintInsts,
13991407
FeatureGFX11FullVGPRs])>;
14001408

14011409
//===----------------------------------------------------------------------===//
@@ -1909,6 +1917,9 @@ def HasNotMADIntraFwdBug : Predicate<"!Subtarget->hasMADIntraFwdBug()">;
19091917
def HasSALUFloatInsts : Predicate<"Subtarget->hasSALUFloatInsts()">,
19101918
AssemblerPredicate<(all_of FeatureSALUFloatInsts)>;
19111919

1920+
def HasVGPRSingleUseHintInsts : Predicate<"Subtarget->hasVGPRSingleUseHintInsts()">,
1921+
AssemblerPredicate<(all_of FeatureVGPRSingleUseHintInsts)>;
1922+
19121923
def HasGDS : Predicate<"Subtarget->hasGDS()">;
19131924

19141925
def HasGWS : Predicate<"Subtarget->hasGWS()">;

llvm/lib/Target/AMDGPU/GCNSubtarget.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
194194
bool HasPackedTID = false;
195195
bool ScalarizeGlobal = false;
196196
bool HasSALUFloatInsts = false;
197+
bool HasVGPRSingleUseHintInsts = false;
197198

198199
bool HasVcmpxPermlaneHazard = false;
199200
bool HasVMEMtoScalarWriteHazard = false;
@@ -1145,6 +1146,8 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
11451146

11461147
bool hasSALUFloatInsts() const { return HasSALUFloatInsts; }
11471148

1149+
bool hasVGPRSingleUseHintInsts() const { return HasVGPRSingleUseHintInsts; }
1150+
11481151
/// Return the maximum number of waves per SIMD for kernels using \p SGPRs
11491152
/// SGPRs
11501153
unsigned getOccupancyWithNumSGPRs(unsigned SGPRs) const;

llvm/lib/Target/AMDGPU/SOPInstructions.td

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,11 @@ let SubtargetPredicate = isGFX11Plus in {
15581558
"$simm16">;
15591559
} // End SubtargetPredicate = isGFX11Plus
15601560

1561+
let SubtargetPredicate = HasVGPRSingleUseHintInsts in {
1562+
def S_SINGLEUSE_VDST :
1563+
SOPP_Pseudo<"s_singleuse_vdst", (ins s16imm:$simm16), "$simm16">;
1564+
} // End SubtargetPredicate = HasVGPRSingeUseHintInsts
1565+
15611566
//===----------------------------------------------------------------------===//
15621567
// SOP1 Patterns
15631568
//===----------------------------------------------------------------------===//
@@ -2267,6 +2272,12 @@ defm S_TTRACEDATA_IMM : SOPP_Real_32_gfx11<0x03b>;
22672272
defm S_ICACHE_INV : SOPP_Real_32_gfx11<0x03c>;
22682273
defm S_BARRIER : SOPP_Real_32_gfx11<0x03d>;
22692274

2275+
//===----------------------------------------------------------------------===//
2276+
// SOPP - GFX1150
2277+
//===----------------------------------------------------------------------===//
2278+
2279+
defm S_SINGLEUSE_VDST : SOPP_Real_32_gfx11<0x013>;
2280+
22702281
//===----------------------------------------------------------------------===//
22712282
// SOPP - GFX6, GFX7, GFX8, GFX9, GFX10
22722283
//===----------------------------------------------------------------------===//
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: llvm-mc -arch=amdgcn -mcpu=gfx1150 -show-encoding %s | FileCheck --check-prefixes=GFX1150 %s
2+
3+
s_singleuse_vdst 0x0000
4+
// GFX1150: encoding: [0x00,0x00,0x93,0xbf]
5+
6+
s_singleuse_vdst 0xffff
7+
// GFX1150: encoding: [0xff,0xff,0x93,0xbf]
8+
9+
s_singleuse_vdst 0x1234
10+
// GFX1150: encoding: [0x34,0x12,0x93,0xbf]

llvm/test/MC/AMDGPU/gfx11_unsupported.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,3 +1980,6 @@ s_cmp_neq_f16 s1, s2
19801980

19811981
s_cmp_nlt_f16 s1, s2
19821982
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
1983+
1984+
s_singleuse_vdst 0x1234
1985+
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU

llvm/test/MC/Disassembler/AMDGPU/decode-err.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
# GCN: warning: invalid instruction encoding
66
0xdf,0x00,0x00,0x02
77

8+
# this is s_singleuse_vdst 0x1234, which is only valid on gfx1150
9+
# GFX11: warning: invalid instruction encoding
10+
0x34,0x12,0x93,0xbf
11+
812
# this is buffer_atomic_csub_u32 v5, off, s[8:11], s3 offset:4095. Invalid without glc
913
# GFX11: warning: invalid instruction encoding
1014
0xff,0x0f,0xdc,0xe0,0x00,0x05,0x02,0x03
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# RUN: llvm-mc -arch=amdgcn -mcpu=gfx1150 -disassemble -show-encoding < %s | FileCheck -check-prefixes=GFX1150 %s
2+
3+
# GFX1150: s_singleuse_vdst 0x0 ; encoding: [0x00,0x00,0x93,0xbf]
4+
0x00,0x00,0x93,0xbf
5+
6+
# GFX1150: s_singleuse_vdst 0xffff ; encoding: [0xff,0xff,0x93,0xbf]
7+
0xff,0xff,0x93,0xbf
8+
9+
# GFX1150: s_singleuse_vdst 0x1234 ; encoding: [0x34,0x12,0x93,0xbf]
10+
0x34,0x12,0x93,0xbf

0 commit comments

Comments
 (0)