Skip to content

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Sep 2, 2025

This avoids an inconsistency in pseudo definitions I
ran into for a later patch.

Copy link
Contributor Author

arsenm commented Sep 2, 2025

@arsenm arsenm marked this pull request as ready for review September 2, 2025 06:08
@llvmbot
Copy link
Member

llvmbot commented Sep 2, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

This avoids an inconsistency in pseudo definitions I
ran into for a later patch.


Patch is 25.26 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/156406.diff

5 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/DSInstructions.td (+37-2)
  • (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.td (+3-1)
  • (modified) llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_ds.txt (+48-48)
  • (modified) llvm/test/MC/Disassembler/AMDGPU/gfx1250_dasm_ds.txt (+6-6)
  • (modified) llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_ds.txt (+24-24)
diff --git a/llvm/lib/Target/AMDGPU/DSInstructions.td b/llvm/lib/Target/AMDGPU/DSInstructions.td
index a9376250931b6..5e4c19e389cf6 100644
--- a/llvm/lib/Target/AMDGPU/DSInstructions.td
+++ b/llvm/lib/Target/AMDGPU/DSInstructions.td
@@ -1380,6 +1380,21 @@ multiclass DS_Real_gfx12_with_name<bits<8> op, string name> {
   defm "" : DS_Real_gfx12<op, !cast<DS_Pseudo>(NAME), name>;
 }
 
+multiclass DS_Real_gfx12_with_t16<bits<8> op,
+                                  string name = !tolower(NAME)> {
+  let DecoderNamespace = "GFX12_FAKE16" in {
+    defm "" : DS_Real_gfx12<op, !cast<DS_Pseudo>(NAME#"_gfx9"), name>;
+  }
+
+  let DecoderNamespace = "GFX12" in {
+    def _gfx12_t16 :
+      Base_DS_Real_gfx6_gfx7_gfx10_gfx11_gfx12<op,
+          !cast<DS_Pseudo>(NAME#"_t16"),
+          SIEncodingFamily.GFX12, name>,
+      True16D16Table<NAME#"_D16_HI", NAME>;
+  }
+}
+
 defm DS_MIN_F32           : DS_Real_gfx12_with_name<0x012, "ds_min_num_f32">;
 defm DS_MAX_F32           : DS_Real_gfx12_with_name<0x013, "ds_max_num_f32">;
 defm DS_MIN_RTN_F32       : DS_Real_gfx12_with_name<0x032, "ds_min_num_rtn_f32">;
@@ -1444,17 +1459,37 @@ multiclass DS_Real_gfx11<bits<8> op, DS_Pseudo ps = !cast<DS_Pseudo>(NAME),
   } // End AssemblerPredicate
 }
 
+multiclass DS_Real_gfx11_with_t16<bits<8> op,
+                                  string name = !tolower(NAME)> {
+  let DecoderNamespace = "GFX11_FAKE16" in {
+    defm "" : DS_Real_gfx11<op, !cast<DS_Pseudo>(NAME#"_gfx9"), name>;
+  }
+
+  let DecoderNamespace = "GFX11" in {
+    def _gfx11_t16 :
+      Base_DS_Real_gfx6_gfx7_gfx10_gfx11_gfx12<op,
+          !cast<DS_Pseudo>(NAME#"_t16"),
+          SIEncodingFamily.GFX11, name>,
+      True16D16Table<NAME#"_D16_HI", NAME#"_gfx9">;
+  }
+}
+
 multiclass DS_Real_gfx11_gfx12<bits<8> op,
                                string name = !tolower(NAME),
                                DS_Pseudo ps = !cast<DS_Pseudo>(NAME)>
   : DS_Real_gfx11<op, ps, name>,
     DS_Real_gfx12<op, ps, name>;
 
+multiclass DS_Real_gfx11_gfx12_with_t16<bits<8> op,
+                                        string name = !tolower(NAME)>
+  : DS_Real_gfx11_with_t16<op, name>,
+    DS_Real_gfx12_with_t16<op, name>;
+
 defm DS_WRITE_B32           : DS_Real_gfx11_gfx12<0x00d, "ds_store_b32">;
 defm DS_WRITE2_B32          : DS_Real_gfx11_gfx12<0x00e, "ds_store_2addr_b32">;
 defm DS_WRITE2ST64_B32      : DS_Real_gfx11_gfx12<0x00f, "ds_store_2addr_stride64_b32">;
-defm DS_WRITE_B8            : DS_Real_gfx11_gfx12<0x01e, "ds_store_b8">;
-defm DS_WRITE_B16           : DS_Real_gfx11_gfx12<0x01f, "ds_store_b16">;
+defm DS_WRITE_B8            : DS_Real_gfx11_gfx12_with_t16<0x01e, "ds_store_b8">;
+defm DS_WRITE_B16           : DS_Real_gfx11_gfx12_with_t16<0x01f, "ds_store_b16">;
 defm DS_WRXCHG_RTN_B32      : DS_Real_gfx11_gfx12<0x02d, "ds_storexchg_rtn_b32">;
 defm DS_WRXCHG2_RTN_B32     : DS_Real_gfx11_gfx12<0x02e, "ds_storexchg_2addr_rtn_b32">;
 defm DS_WRXCHG2ST64_RTN_B32 : DS_Real_gfx11_gfx12<0x02f, "ds_storexchg_2addr_stride64_rtn_b32">;
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.td b/llvm/lib/Target/AMDGPU/SIInstrInfo.td
index 63c938b259f35..cf9fe74f977ea 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.td
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.td
@@ -12,7 +12,9 @@ def isWave64 : Predicate<"Subtarget->isWave64()">,
   AssemblerPredicate <(all_of FeatureWavefrontSize64)>;
 
 class AMDGPUMnemonicAlias<string From, string To, string VariantName = "">
-    : MnemonicAlias<From, To, VariantName>, PredicateControl;
+    : MnemonicAlias<From, To, VariantName>, PredicateControl {
+  string DecoderNamespace = ?; // Dummy field
+}
 
 // Except for the NONE field, this must be kept in sync with the
 // SIEncodingFamily enum in SIInstrInfo.cpp and the columns of the
diff --git a/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_ds.txt b/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_ds.txt
index 448cfc95de095..2730b5be92f58 100644
--- a/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_ds.txt
+++ b/llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_ds.txt
@@ -4447,76 +4447,76 @@
 # GFX11: ds_store_b128 v255, v[2:5] offset:65535 ; encoding: [0xff,0xff,0x7c,0xdb,0xff,0x02,0x00,0x00]
 0xff,0xff,0x7c,0xdb,0xff,0x02,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v1                     ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v0, v1.l                   ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0x01,0x00,0x00]
 0x00,0x00,0x7c,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v1 gds                 ; encoding: [0x00,0x00,0x7e,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v0, v1.l gds               ; encoding: [0x00,0x00,0x7e,0xd8,0x00,0x01,0x00,0x00]
 0x00,0x00,0x7e,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v1 offset:4660         ; encoding: [0x34,0x12,0x7c,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v0, v1.l offset:4660       ; encoding: [0x34,0x12,0x7c,0xd8,0x00,0x01,0x00,0x00]
 0x34,0x12,0x7c,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v1 offset:4660 gds     ; encoding: [0x34,0x12,0x7e,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v0, v1.l offset:4660 gds   ; encoding: [0x34,0x12,0x7e,0xd8,0x00,0x01,0x00,0x00]
 0x34,0x12,0x7e,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v1 offset:65535        ; encoding: [0xff,0xff,0x7c,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v0, v1.l offset:65535      ; encoding: [0xff,0xff,0x7c,0xd8,0x00,0x01,0x00,0x00]
 0xff,0xff,0x7c,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v1 offset:65535 gds    ; encoding: [0xff,0xff,0x7e,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v0, v1.l offset:65535 gds  ; encoding: [0xff,0xff,0x7e,0xd8,0x00,0x01,0x00,0x00]
 0xff,0xff,0x7e,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v254                   ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v0, v254.l                 ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0xfe,0x00,0x00]
 0x00,0x00,0x7c,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v254 gds               ; encoding: [0x00,0x00,0x7e,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v0, v254.l gds             ; encoding: [0x00,0x00,0x7e,0xd8,0x00,0xfe,0x00,0x00]
 0x00,0x00,0x7e,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v254 offset:4660       ; encoding: [0x34,0x12,0x7c,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v0, v254.l offset:4660     ; encoding: [0x34,0x12,0x7c,0xd8,0x00,0xfe,0x00,0x00]
 0x34,0x12,0x7c,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v254 offset:4660 gds   ; encoding: [0x34,0x12,0x7e,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v0, v254.l offset:4660 gds ; encoding: [0x34,0x12,0x7e,0xd8,0x00,0xfe,0x00,0x00]
 0x34,0x12,0x7e,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v254 offset:65535      ; encoding: [0xff,0xff,0x7c,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v0, v254.l offset:65535    ; encoding: [0xff,0xff,0x7c,0xd8,0x00,0xfe,0x00,0x00]
 0xff,0xff,0x7c,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v0, v254 offset:65535 gds  ; encoding: [0xff,0xff,0x7e,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v0, v254.l offset:65535 gds ; encoding: [0xff,0xff,0x7e,0xd8,0x00,0xfe,0x00,0x00]
 0xff,0xff,0x7e,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v1                   ; encoding: [0x00,0x00,0x7c,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v255, v1.l                 ; encoding: [0x00,0x00,0x7c,0xd8,0xff,0x01,0x00,0x00]
 0x00,0x00,0x7c,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v1 gds               ; encoding: [0x00,0x00,0x7e,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v255, v1.l gds             ; encoding: [0x00,0x00,0x7e,0xd8,0xff,0x01,0x00,0x00]
 0x00,0x00,0x7e,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v1 offset:4660       ; encoding: [0x34,0x12,0x7c,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v255, v1.l offset:4660     ; encoding: [0x34,0x12,0x7c,0xd8,0xff,0x01,0x00,0x00]
 0x34,0x12,0x7c,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v1 offset:4660 gds   ; encoding: [0x34,0x12,0x7e,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v255, v1.l offset:4660 gds ; encoding: [0x34,0x12,0x7e,0xd8,0xff,0x01,0x00,0x00]
 0x34,0x12,0x7e,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v1 offset:65535      ; encoding: [0xff,0xff,0x7c,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v255, v1.l offset:65535    ; encoding: [0xff,0xff,0x7c,0xd8,0xff,0x01,0x00,0x00]
 0xff,0xff,0x7c,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v1 offset:65535 gds  ; encoding: [0xff,0xff,0x7e,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b16 v255, v1.l offset:65535 gds ; encoding: [0xff,0xff,0x7e,0xd8,0xff,0x01,0x00,0x00]
 0xff,0xff,0x7e,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v254                 ; encoding: [0x00,0x00,0x7c,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v255, v254.l               ; encoding: [0x00,0x00,0x7c,0xd8,0xff,0xfe,0x00,0x00]
 0x00,0x00,0x7c,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v254 gds             ; encoding: [0x00,0x00,0x7e,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v255, v254.l gds           ; encoding: [0x00,0x00,0x7e,0xd8,0xff,0xfe,0x00,0x00]
 0x00,0x00,0x7e,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v254 offset:4660     ; encoding: [0x34,0x12,0x7c,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v255, v254.l offset:4660   ; encoding: [0x34,0x12,0x7c,0xd8,0xff,0xfe,0x00,0x00]
 0x34,0x12,0x7c,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v254 offset:4660 gds ; encoding: [0x34,0x12,0x7e,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v255, v254.l offset:4660 gds ; encoding: [0x34,0x12,0x7e,0xd8,0xff,0xfe,0x00,0x00]
 0x34,0x12,0x7e,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v254 offset:65535    ; encoding: [0xff,0xff,0x7c,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v255, v254.l offset:65535  ; encoding: [0xff,0xff,0x7c,0xd8,0xff,0xfe,0x00,0x00]
 0xff,0xff,0x7c,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b16 v255, v254 offset:65535 gds ; encoding: [0xff,0xff,0x7e,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b16 v255, v254.l offset:65535 gds ; encoding: [0xff,0xff,0x7e,0xd8,0xff,0xfe,0x00,0x00]
 0xff,0xff,0x7e,0xd8,0xff,0xfe,0x00,0x00
 
 # GFX11: ds_store_b16_d16_hi v1, v2              ; encoding: [0x00,0x00,0x84,0xda,0x01,0x02,0x00,0x00]
@@ -4627,76 +4627,76 @@
 # GFX11: ds_store_b64 v255, v[2:3] offset:65535  ; encoding: [0xff,0xff,0x34,0xd9,0xff,0x02,0x00,0x00]
 0xff,0xff,0x34,0xd9,0xff,0x02,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v1                      ; encoding: [0x00,0x00,0x78,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v0, v1.l                    ; encoding: [0x00,0x00,0x78,0xd8,0x00,0x01,0x00,0x00]
 0x00,0x00,0x78,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v1 gds                  ; encoding: [0x00,0x00,0x7a,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v0, v1.l gds                ; encoding: [0x00,0x00,0x7a,0xd8,0x00,0x01,0x00,0x00]
 0x00,0x00,0x7a,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v1 offset:4660          ; encoding: [0x34,0x12,0x78,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v0, v1.l offset:4660        ; encoding: [0x34,0x12,0x78,0xd8,0x00,0x01,0x00,0x00]
 0x34,0x12,0x78,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v1 offset:4660 gds      ; encoding: [0x34,0x12,0x7a,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v0, v1.l offset:4660 gds    ; encoding: [0x34,0x12,0x7a,0xd8,0x00,0x01,0x00,0x00]
 0x34,0x12,0x7a,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v1 offset:65535         ; encoding: [0xff,0xff,0x78,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v0, v1.l offset:65535       ; encoding: [0xff,0xff,0x78,0xd8,0x00,0x01,0x00,0x00]
 0xff,0xff,0x78,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v1 offset:65535 gds     ; encoding: [0xff,0xff,0x7a,0xd8,0x00,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v0, v1.l offset:65535 gds   ; encoding: [0xff,0xff,0x7a,0xd8,0x00,0x01,0x00,0x00]
 0xff,0xff,0x7a,0xd8,0x00,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v254                    ; encoding: [0x00,0x00,0x78,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v0, v254.l                  ; encoding: [0x00,0x00,0x78,0xd8,0x00,0xfe,0x00,0x00]
 0x00,0x00,0x78,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v254 gds                ; encoding: [0x00,0x00,0x7a,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v0, v254.l gds              ; encoding: [0x00,0x00,0x7a,0xd8,0x00,0xfe,0x00,0x00]
 0x00,0x00,0x7a,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v254 offset:4660        ; encoding: [0x34,0x12,0x78,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v0, v254.l offset:4660      ; encoding: [0x34,0x12,0x78,0xd8,0x00,0xfe,0x00,0x00]
 0x34,0x12,0x78,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v254 offset:4660 gds    ; encoding: [0x34,0x12,0x7a,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v0, v254.l offset:4660 gds  ; encoding: [0x34,0x12,0x7a,0xd8,0x00,0xfe,0x00,0x00]
 0x34,0x12,0x7a,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v254 offset:65535       ; encoding: [0xff,0xff,0x78,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v0, v254.l offset:65535     ; encoding: [0xff,0xff,0x78,0xd8,0x00,0xfe,0x00,0x00]
 0xff,0xff,0x78,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v0, v254 offset:65535 gds   ; encoding: [0xff,0xff,0x7a,0xd8,0x00,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v0, v254.l offset:65535 gds ; encoding: [0xff,0xff,0x7a,0xd8,0x00,0xfe,0x00,0x00]
 0xff,0xff,0x7a,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v1                    ; encoding: [0x00,0x00,0x78,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v255, v1.l                  ; encoding: [0x00,0x00,0x78,0xd8,0xff,0x01,0x00,0x00]
 0x00,0x00,0x78,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v1 gds                ; encoding: [0x00,0x00,0x7a,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v255, v1.l gds              ; encoding: [0x00,0x00,0x7a,0xd8,0xff,0x01,0x00,0x00]
 0x00,0x00,0x7a,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v1 offset:4660        ; encoding: [0x34,0x12,0x78,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v255, v1.l offset:4660      ; encoding: [0x34,0x12,0x78,0xd8,0xff,0x01,0x00,0x00]
 0x34,0x12,0x78,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v1 offset:4660 gds    ; encoding: [0x34,0x12,0x7a,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v255, v1.l offset:4660 gds  ; encoding: [0x34,0x12,0x7a,0xd8,0xff,0x01,0x00,0x00]
 0x34,0x12,0x7a,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v1 offset:65535       ; encoding: [0xff,0xff,0x78,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v255, v1.l offset:65535     ; encoding: [0xff,0xff,0x78,0xd8,0xff,0x01,0x00,0x00]
 0xff,0xff,0x78,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v1 offset:65535 gds   ; encoding: [0xff,0xff,0x7a,0xd8,0xff,0x01,0x00,0x00]
+# GFX11: ds_store_b8 v255, v1.l offset:65535 gds ; encoding: [0xff,0xff,0x7a,0xd8,0xff,0x01,0x00,0x00]
 0xff,0xff,0x7a,0xd8,0xff,0x01,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v254                  ; encoding: [0x00,0x00,0x78,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v255, v254.l                ; encoding: [0x00,0x00,0x78,0xd8,0xff,0xfe,0x00,0x00]
 0x00,0x00,0x78,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v254 gds              ; encoding: [0x00,0x00,0x7a,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v255, v254.l gds            ; encoding: [0x00,0x00,0x7a,0xd8,0xff,0xfe,0x00,0x00]
 0x00,0x00,0x7a,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v254 offset:4660      ; encoding: [0x34,0x12,0x78,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v255, v254.l offset:4660    ; encoding: [0x34,0x12,0x78,0xd8,0xff,0xfe,0x00,0x00]
 0x34,0x12,0x78,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v254 offset:4660 gds  ; encoding: [0x34,0x12,0x7a,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v255, v254.l offset:4660 gds ; encoding: [0x34,0x12,0x7a,0xd8,0xff,0xfe,0x00,0x00]
 0x34,0x12,0x7a,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v254 offset:65535     ; encoding: [0xff,0xff,0x78,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v255, v254.l offset:65535   ; encoding: [0xff,0xff,0x78,0xd8,0xff,0xfe,0x00,0x00]
 0xff,0xff,0x78,0xd8,0xff,0xfe,0x00,0x00
 
-# GFX11: ds_store_b8 v255, v254 offset:65535 gds ; encoding: [0xff,0xff,0x7a,0xd8,0xff,0xfe,0x00,0x00]
+# GFX11: ds_store_b8 v255, v254.l offset:65535 gds ; encoding: [0xff,0xff,0x7a,0xd8,0xff,0xfe,0x00,0x00]
 0xff,0xff,0x7a,0xd8,0xff,0xfe,0x00,0x00
 
 # GFX11: ds_store_b8_d16_hi v1, v2               ; encoding: [0x00,0x00,0x80,0xda,0x01,0x02,0x00,0x00]
diff --git a/llvm/test/MC/Disassembler/AMDGPU/gfx1250_dasm_ds.txt b/llvm/test/MC/Disassembler/AMDGPU/gfx1250_dasm_ds.txt
index 13440a06032be..6e4b6f051b39d 100644
--- a/llvm/test/MC/Disassembler/AMDGPU/gfx1250_dasm_ds.txt
+++ b/llvm/test/MC/Disassembler/AMDGPU/gfx1250_dasm_ds.txt
@@ -873,13 +873,13 @@
 # GFX1250: ds_store_b128 v255, v[252:255] offset:4 ; encoding: [0x04,0x00,0x7c,0xdb,0xff,0xfc,0x00,0x00]
 0x04,0x00,0x7c,0xdb,0xff,0xfc,0x00,0x00
 
-# GFX1250: ds_store_b16 v1, v2                     ; encoding: [0x00,0x00,0x7c,0xd8,0x01,0x02,0x00,0x00]
+# GFX1250: ds_store_b16 v1, v2.l                   ; encoding: [0x00,0x00,0x7c,0xd8,0x01,0x02,0x00,0x00]
 0x00,0x00,0x7c,0xd8,0x01,0x02,0x00,0x00
 
-# GFX1250: ds_store_b16 v1, v2 offset:65535        ; encoding: [0xff,0xff,0x7c,0xd8,0x01,0x02,0x00,0x00]
+# GFX1250: ds_store_b16 v1, v2.l offset:65535      ; encoding: [0xff,0xff,0x7c,0xd8,0x01,0x02,0x00,0x00]
 0xff,0xff,0x7c,0xd8,0x01,0x02,0x00,0x00
 
-# GFX1250: ds_store_b16 v255, v255 offset:4        ; encoding: [0x04,0x00,0x7c,0xd8,0xff,0xff,0x00,0x00]
+# GFX1250: ds_store_b16 v255, v255.l offset:4      ; encoding: [0x04,0x00,0x7c,0xd8,0xff,0xff,0x00,0x00]
 0x04,0x00,0x7c,0xd8,0xff,0xff,0x00,0x00
 
 # GFX1250: ds_store_b16_d16_hi v1, v2              ; encoding: [0x00,0x00,0x84,0xda,0x01,0x02,0x00,0x00]
@@ -909,13 +909,13 @@
 # GFX1250: ds_store_b64 v255, v[254:255] offset:4  ; encoding: [0x04,0x00,0x34,0xd9,0xff,0xfe,0x00,0x00]
 0x04,0x00,0x34,0xd9,0xff,0xfe,0x00,0x00
 
-# GFX1250: ds_store_b8 v1, v2                      ; encoding: [0x00,0x00,0x78,0xd8,0x01,0x02,0x00,0x00]
+# GFX1250: ds_store_b8 v1, v2.l                    ; encoding: [0x00,0x00,0x78,0xd8,0x01,0x02,0x00,0x00]
 0x00,0x00,0x78,0xd8,0x01,0x02,0x00,0x00
 
-# GFX1250: ds_store_b8 v1, v2 offset:65535         ; encoding: [0xff,0xff,0x78,0xd8,0x01,0x02,0x00,0x00]
+# GFX1250: ds_store_b8 v1, v2.l offset:65535       ; encoding: [0xff,0xff,0x78,0xd8,0x01,0x02,0x00,0x00]
 0xff,0xff,0x78,0xd8,0x01,0x02,0x00,0x00
 
-# GFX1250: ds_store_b8 v255, v255 offset:4         ; encoding: [0x04,0x00,0x78,0xd8,0xff,0xff,0x00,0x00]
+# GFX1250: ds_store_b8 v255, v255.l offset:4       ; encoding: [0x04,0x00,0x78,0xd8,0xff,0xff,0x00,0x00]
 0x04,0x00,0x78,0xd8,0xff,0xff,0x00,0x00
 
 # GFX1250: ds_store_b8_d16_hi v1, v2               ; encoding: [0x00,0x00,0x80,0xda,0x01,0x02,0x00,0x00]
diff --git a/llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_ds.txt b/llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_ds.txt
index d9381b50ca29f..8f75458419202 100644
--- a/llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_ds.txt
+++ b/llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_ds.txt
@@ -2781,40 +2781,40 @@
 # GFX12: ds_store_b128 v255, v[2:5] offset:65535 ; encoding: [0xff,0xff,0x7c,0xdb,0xff,0x02,0x00,0x00]
 0xff,0xff,0x7c,0xdb,0xff,0x02,0x00,0x00
 
-# GFX12: ds_store_b16 v0, v1                     ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0x01,0x00,0x00]
+# GFX12: ds_store_b16 v0, v1.l                   ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0x01,0x00,0x00]
 0x00,0x00,0x7c,0xd8,0x00,0x01,0x00,0x00
 
-# GFX12: ds_store_b16 v0, v1 offset:4660         ; encoding: [0x34,0x12,0x7c,0xd8,0x00,0x01,0x00,0x00]
+# GFX12: ds_store_b16 v0, v1.l offset:4660       ; encoding: [0x34,0x12,0x7c,0xd8,0x00,0x01,0x00,0x00]
 0x34,0x12,0x7c,0xd8,0x00,0x01,0x00,0x00
 
-# GFX12: ds_store_b16 v0, v1 offset:65535        ; encoding: [0xff,0xff,0x7c,0xd8,0x00,0x01,0x00,0x00]
+# GFX12: ds_store_b16 v0, v1.l offset:65535      ; encoding: [0xff,0xff,0x7c,0xd8,0x00,0x01,0x00,0x00]
 0xff,0xff,0x7c,0xd8,0x00,0x01,0x00,0x00
 
-# GFX12: ds_store_b16 v0, v254                   ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0xfe,0x00,0x00]
+# GFX12: ds_store_b16 v0, v254.l                 ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0xfe,0x00,0x00]
 0x00,0x00,0x7c,0xd8,0x00,0xfe,0x00,0x00
 
-# GFX12: ds...
[truncated]

This avoids an inconsistency in pseudo definitions I
ran into for a later patch.
@@ -4447,76 +4447,76 @@
# GFX11: ds_store_b128 v255, v[2:5] offset:65535 ; encoding: [0xff,0xff,0x7c,0xdb,0xff,0x02,0x00,0x00]
0xff,0xff,0x7c,0xdb,0xff,0x02,0x00,0x00

# GFX11: ds_store_b16 v0, v1 ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0x01,0x00,0x00]
# GFX11: ds_store_b16 v0, v1.l ; encoding: [0x00,0x00,0x7c,0xd8,0x00,0x01,0x00,0x00]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the .l syntax is not right here. This is not a true16 operand, cos you can't specify v0.h but you can specify v255.l (with an 8-bit instruction field). So it's a normal 32-bit operand but the instruction happens to only use the low 16 bits of data from it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I think Jay is right, though the docs here are somewhat misleading. The operand is labeled as a vgpr with 16 bits. However, there is no way to encode the swizzle (ie v0.h) in DS. At least I can't find any reference that these would use the hi bit of the operand field the way vop1/2/C does.

@arsenm
Copy link
Contributor Author

arsenm commented Sep 2, 2025

Seems #156419 is sufficient to fix the issue

@arsenm arsenm closed this Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants