[llvm] e78970f - [AMDGPU] MC support for v_wave_match_b32 on gfx13 (#223360)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 04:06:35 PDT 2026
Author: Mariusz Sikora
Date: 2026-09-15T13:06:30+02:00
New Revision: e78970f80f1041de8948cb0b665a9aaae682f6c6
URL: https://github.com/llvm/llvm-project/commit/e78970f80f1041de8948cb0b665a9aaae682f6c6
DIFF: https://github.com/llvm/llvm-project/commit/e78970f80f1041de8948cb0b665a9aaae682f6c6.diff
LOG: [AMDGPU] MC support for v_wave_match_b32 on gfx13 (#223360)
Added:
llvm/test/MC/AMDGPU/gfx13_asm_vop3_err-fake16.s
Modified:
llvm/lib/Target/AMDGPU/AMDGPU.td
llvm/lib/Target/AMDGPU/VOP3Instructions.td
llvm/test/MC/AMDGPU/gfx13_asm_vop3-fake16.s
llvm/test/MC/AMDGPU/gfx13_asm_vop3.s
llvm/test/MC/AMDGPU/gfx13_asm_vop3_err.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 5eaa5df801690..827d87d2c1579 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -1610,6 +1610,10 @@ defm NoSleepForever : AMDGPUSubtargetFeature<"no-sleep-forever",
/*GenPredicate=*/1
>;
+defm WaveMatchInsts : AMDGPUSubtargetFeature<"wave-match-insts",
+ "Has v_wave_match_b32 instruction"
+>;
+
//===----------------------------------------------------------------------===//
class GCNSubtargetFeatureGeneration <string Value,
@@ -2576,6 +2580,7 @@ def FeatureISAVersion12_5_Generic: FeatureSet<
def FeatureISAVersion13 : FeatureSet<
[FeatureGFX13,
FeatureGFX1250Insts,
+ FeatureWaveMatchInsts,
FeatureAddressableLocalMemorySize196608,
Feature64BitLiterals,
FeatureLDSBankCount32,
diff --git a/llvm/lib/Target/AMDGPU/VOP3Instructions.td b/llvm/lib/Target/AMDGPU/VOP3Instructions.td
index f5ddfdbcf9f56..91420bc599b67 100644
--- a/llvm/lib/Target/AMDGPU/VOP3Instructions.td
+++ b/llvm/lib/Target/AMDGPU/VOP3Instructions.td
@@ -2093,6 +2093,16 @@ let SubtargetPredicate = HasF32ToFP6BF6ConversionScaleInsts in {
defm V_CVT_SCALEF32_PK32_FP6_F32 : VOP3Inst<"v_cvt_scalef32_pk32_fp6_f32", VOP3_CVT_SCALEF32_PK_F864_Profile<VOP_V6I32_V32F32_F32>, int_amdgcn_cvt_scalef32_pk32_fp6_f32>;
}
+def VOP_WAVE_MATCH_B32 : VOP3_Profile<VOP_I32_I32_I32> {
+ let HasSrc0IntMods = 0;
+ let HasExtVOP3DPP = 0;
+ let HasExtDPP = 0;
+}
+
+let isConvergent = 1, SubtargetPredicate = HasWaveMatchInsts in {
+ defm V_WAVE_MATCH_B32 : VOP3Inst<"v_wave_match_b32", VOP_WAVE_MATCH_B32>;
+}
+
//===----------------------------------------------------------------------===//
// Integer Clamp Patterns
//===----------------------------------------------------------------------===//
@@ -2164,6 +2174,7 @@ defm V_MIN3_NUM_F16 : VOP3_Realtriple_t16_and_fake16_gfx12_gfx13<0x22b, 0x
defm V_MAX3_NUM_F16 : VOP3_Realtriple_t16_and_fake16_gfx12_gfx13<0x22c, 0x354, "v_max3_num_f16", "V_MAX3_F16", "v_max3_f16">;
defm V_MED3_NUM_F32 : VOP3_Realtriple_with_name_gfx12_gfx13<0x231, 0x231, "V_MED3_F32", "v_med3_num_f32">;
defm V_MED3_NUM_F16 : VOP3_Realtriple_t16_and_fake16_gfx12_gfx13<0x232, 0x357, "v_med3_num_f16", "V_MED3_F16", "v_med3_f16">;
+defm V_WAVE_MATCH_B32 : VOP3Only_Real_Base_gfx13<0x241>;
defm V_MINMAX_NUM_F32 : VOP3_Realtriple_with_name_gfx12_gfx13<0x268,0x268, "V_MINMAX_F32", "v_minmax_num_f32">;
defm V_MAXMIN_NUM_F32 : VOP3_Realtriple_with_name_gfx12_gfx13<0x269, 0x269, "V_MAXMIN_F32", "v_maxmin_num_f32">;
defm V_MINMAX_NUM_F16 : VOP3_Realtriple_t16_and_fake16_gfx12_gfx13<0x26a, 0x26a, "v_minmax_num_f16", "V_MINMAX_F16", "v_minmax_f16">;
diff --git a/llvm/test/MC/AMDGPU/gfx13_asm_vop3-fake16.s b/llvm/test/MC/AMDGPU/gfx13_asm_vop3-fake16.s
index 0589e1e41cc0f..1fd215a1bc6eb 100644
--- a/llvm/test/MC/AMDGPU/gfx13_asm_vop3-fake16.s
+++ b/llvm/test/MC/AMDGPU/gfx13_asm_vop3-fake16.s
@@ -7750,6 +7750,51 @@ v_s_sqrt_f16 s5, s1 mul:4
v_s_sqrt_f16 s5, s1 div:2
// GFX13: v_s_sqrt_f16 s5, s1 div:2 ; encoding: [0x05,0x00,0x89,0xd6,0x01,0x00,0x01,0x1a]
+v_wave_match_b32 v255, 0xfe0b, vcc_hi
+// GFX13: v_wave_match_b32 v255, 0xfe0b, vcc_hi ; encoding: [0xff,0x00,0x41,0xd6,0xff,0xd6,0x00,0x02,0x0b,0xfe,0x00,0x00]
+
+v_wave_match_b32 v5, -1, exec_hi
+// GFX13: v_wave_match_b32 v5, -1, exec_hi ; encoding: [0x05,0x00,0x41,0xd6,0xc1,0xfe,0x00,0x02]
+
+v_wave_match_b32 v5, 0.5, m0
+// GFX13: v_wave_match_b32 v5, 0.5, m0 ; encoding: [0x05,0x00,0x41,0xd6,0xf0,0xfa,0x00,0x02]
+
+v_wave_match_b32 v5, exec_hi, null
+// GFX13: v_wave_match_b32 v5, exec_hi, null ; encoding: [0x05,0x00,0x41,0xd6,0x7f,0xf8,0x00,0x02]
+
+v_wave_match_b32 v5, exec_lo, -1
+// GFX13: v_wave_match_b32 v5, exec_lo, -1 ; encoding: [0x05,0x00,0x41,0xd6,0x7e,0x82,0x01,0x02]
+
+v_wave_match_b32 v5, m0, 0.5
+// GFX13: v_wave_match_b32 v5, m0, 0.5 ; encoding: [0x05,0x00,0x41,0xd6,0x7d,0xe0,0x01,0x02]
+
+v_wave_match_b32 v5, null, exec_lo
+// GFX13: v_wave_match_b32 v5, null, exec_lo ; encoding: [0x05,0x00,0x41,0xd6,0x7c,0xfc,0x00,0x02]
+
+v_wave_match_b32 v5, s1, s2
+// GFX13: v_wave_match_b32 v5, s1, s2 ; encoding: [0x05,0x00,0x41,0xd6,0x01,0x04,0x00,0x02]
+
+v_wave_match_b32 v5, s105, s105
+// GFX13: v_wave_match_b32 v5, s105, s105 ; encoding: [0x05,0x00,0x41,0xd6,0x69,0xd2,0x00,0x02]
+
+v_wave_match_b32 v5, src_scc, vcc_lo
+// GFX13: v_wave_match_b32 v5, src_scc, vcc_lo ; encoding: [0x05,0x00,0x41,0xd6,0xfd,0xd4,0x00,0x02]
+
+v_wave_match_b32 v5, ttmp15, src_scc
+// GFX13: v_wave_match_b32 v5, ttmp15, src_scc ; encoding: [0x05,0x00,0x41,0xd6,0x7b,0xfa,0x01,0x02]
+
+v_wave_match_b32 v5, v1, v2
+// GFX13: v_wave_match_b32 v5, v1, v2 ; encoding: [0x05,0x00,0x41,0xd6,0x01,0x05,0x02,0x02]
+
+v_wave_match_b32 v5, v255, v255
+// GFX13: v_wave_match_b32 v5, v255, v255 ; encoding: [0x05,0x00,0x41,0xd6,0xff,0xff,0x03,0x02]
+
+v_wave_match_b32 v5, vcc_hi, 0xfe0b
+// GFX13: v_wave_match_b32 v5, vcc_hi, 0xfe0b ; encoding: [0x05,0x00,0x41,0xd6,0x6b,0xfe,0x01,0x02,0x0b,0xfe,0x00,0x00]
+
+v_wave_match_b32 v5, vcc_lo, ttmp15
+// GFX13: v_wave_match_b32 v5, vcc_lo, ttmp15 ; encoding: [0x05,0x00,0x41,0xd6,0x6a,0xf6,0x00,0x02]
+
v_cvt_sr_pk_f16_f32 v5, v1, v2, s3
// GFX13: v_cvt_sr_pk_f16_f32 v5, v1, v2, s3 ; encoding: [0x05,0x00,0xc3,0xd6,0x01,0x05,0x0e,0x00]
diff --git a/llvm/test/MC/AMDGPU/gfx13_asm_vop3.s b/llvm/test/MC/AMDGPU/gfx13_asm_vop3.s
index 76ed1390b85ae..dce2cb80467f2 100644
--- a/llvm/test/MC/AMDGPU/gfx13_asm_vop3.s
+++ b/llvm/test/MC/AMDGPU/gfx13_asm_vop3.s
@@ -7885,6 +7885,51 @@ v_s_sqrt_f16 s5, s1 mul:4
v_s_sqrt_f16 s5, s1 div:2
// GFX13: v_s_sqrt_f16 s5, s1 div:2 ; encoding: [0x05,0x00,0x89,0xd6,0x01,0x00,0x01,0x1a]
+v_wave_match_b32 v255, 0xfe0b, vcc_hi
+// GFX13: v_wave_match_b32 v255, 0xfe0b, vcc_hi ; encoding: [0xff,0x00,0x41,0xd6,0xff,0xd6,0x00,0x02,0x0b,0xfe,0x00,0x00]
+
+v_wave_match_b32 v5, -1, exec_hi
+// GFX13: v_wave_match_b32 v5, -1, exec_hi ; encoding: [0x05,0x00,0x41,0xd6,0xc1,0xfe,0x00,0x02]
+
+v_wave_match_b32 v5, 0.5, m0
+// GFX13: v_wave_match_b32 v5, 0.5, m0 ; encoding: [0x05,0x00,0x41,0xd6,0xf0,0xfa,0x00,0x02]
+
+v_wave_match_b32 v5, exec_hi, null
+// GFX13: v_wave_match_b32 v5, exec_hi, null ; encoding: [0x05,0x00,0x41,0xd6,0x7f,0xf8,0x00,0x02]
+
+v_wave_match_b32 v5, exec_lo, -1
+// GFX13: v_wave_match_b32 v5, exec_lo, -1 ; encoding: [0x05,0x00,0x41,0xd6,0x7e,0x82,0x01,0x02]
+
+v_wave_match_b32 v5, m0, 0.5
+// GFX13: v_wave_match_b32 v5, m0, 0.5 ; encoding: [0x05,0x00,0x41,0xd6,0x7d,0xe0,0x01,0x02]
+
+v_wave_match_b32 v5, null, exec_lo
+// GFX13: v_wave_match_b32 v5, null, exec_lo ; encoding: [0x05,0x00,0x41,0xd6,0x7c,0xfc,0x00,0x02]
+
+v_wave_match_b32 v5, s1, s2
+// GFX13: v_wave_match_b32 v5, s1, s2 ; encoding: [0x05,0x00,0x41,0xd6,0x01,0x04,0x00,0x02]
+
+v_wave_match_b32 v5, s105, s105
+// GFX13: v_wave_match_b32 v5, s105, s105 ; encoding: [0x05,0x00,0x41,0xd6,0x69,0xd2,0x00,0x02]
+
+v_wave_match_b32 v5, src_scc, vcc_lo
+// GFX13: v_wave_match_b32 v5, src_scc, vcc_lo ; encoding: [0x05,0x00,0x41,0xd6,0xfd,0xd4,0x00,0x02]
+
+v_wave_match_b32 v5, ttmp15, src_scc
+// GFX13: v_wave_match_b32 v5, ttmp15, src_scc ; encoding: [0x05,0x00,0x41,0xd6,0x7b,0xfa,0x01,0x02]
+
+v_wave_match_b32 v5, v1, v2
+// GFX13: v_wave_match_b32 v5, v1, v2 ; encoding: [0x05,0x00,0x41,0xd6,0x01,0x05,0x02,0x02]
+
+v_wave_match_b32 v5, v255, v255
+// GFX13: v_wave_match_b32 v5, v255, v255 ; encoding: [0x05,0x00,0x41,0xd6,0xff,0xff,0x03,0x02]
+
+v_wave_match_b32 v5, vcc_hi, 0xfe0b
+// GFX13: v_wave_match_b32 v5, vcc_hi, 0xfe0b ; encoding: [0x05,0x00,0x41,0xd6,0x6b,0xfe,0x01,0x02,0x0b,0xfe,0x00,0x00]
+
+v_wave_match_b32 v5, vcc_lo, ttmp15
+// GFX13: v_wave_match_b32 v5, vcc_lo, ttmp15 ; encoding: [0x05,0x00,0x41,0xd6,0x6a,0xf6,0x00,0x02]
+
v_cvt_sr_pk_f16_f32 v5, v1, v2, s3
// GFX13: v_cvt_sr_pk_f16_f32 v5, v1, v2, s3 ; encoding: [0x05,0x00,0xc3,0xd6,0x01,0x05,0x0e,0x00]
diff --git a/llvm/test/MC/AMDGPU/gfx13_asm_vop3_err-fake16.s b/llvm/test/MC/AMDGPU/gfx13_asm_vop3_err-fake16.s
new file mode 100644
index 0000000000000..6f449c69f6fe4
--- /dev/null
+++ b/llvm/test/MC/AMDGPU/gfx13_asm_vop3_err-fake16.s
@@ -0,0 +1,30 @@
+// NOTE: Assertions have been autogenerated by utils/update_mc_test_checks.py UTC_ARGS: --version 6
+// RUN: not llvm-mc -triple=amdgpu13.10 -mattr=+wavefrontsize32,-real-true16 -filetype=null %s 2>&1 | FileCheck --check-prefix=GFX13 --strict-whitespace --implicit-check-not=error %s
+// RUN: not llvm-mc -triple=amdgpu13.10 -mattr=+wavefrontsize64,-real-true16 -filetype=null %s 2>&1 | FileCheck --check-prefix=GFX13 --strict-whitespace --implicit-check-not=error %s
+
+v_wave_match_b32 v5, |v3|, v1
+// GFX13: :[[@LINE-1]]:22: error: not a valid operand.
+
+v_wave_match_b32 v5, -v3, v1
+// GFX13: :[[@LINE-1]]:22: error: not a valid operand.
+
+v_wave_match_b32 v5, v3, |v1|
+// GFX13: :[[@LINE-1]]:26: error: not a valid operand.
+
+v_wave_match_b32 v5, v3, -v1
+// GFX13: :[[@LINE-1]]:26: error: not a valid operand.
+
+v_wave_match_b32 v5, v3, v1 clamp
+// GFX13: :[[@LINE-1]]:29: error: invalid operand for instruction
+
+v_wave_match_b32 v5, v3, v1 mul:2
+// GFX13: :[[@LINE-1]]:29: error: not a valid operand.
+
+v_wave_match_b32_dpp v5, v3, v1 row_share:1
+// GFX13: :[[@LINE-1]]:1: error: dpp variant of this instruction is not supported
+
+v_wave_match_b32_dpp v5, v3, v1 dpp8:[7,6,5,4,3,2,1,0]
+// GFX13: :[[@LINE-1]]:1: error: dpp variant of this instruction is not supported
+
+v_wave_match_b32_e64_dpp v5, v3, v1 row_share:1
+// GFX13: :[[@LINE-1]]:1: error: e64_dpp variant of this instruction is not supported
diff --git a/llvm/test/MC/AMDGPU/gfx13_asm_vop3_err.s b/llvm/test/MC/AMDGPU/gfx13_asm_vop3_err.s
index 8b96b954fa8bb..ebcccde419895 100644
--- a/llvm/test/MC/AMDGPU/gfx13_asm_vop3_err.s
+++ b/llvm/test/MC/AMDGPU/gfx13_asm_vop3_err.s
@@ -1,6 +1,8 @@
// NOTE: Assertions have been autogenerated by utils/update_mc_test_checks.py UTC_ARGS: --version 6
// RUN: not llvm-mc -triple=amdgpu13.10 -mattr=+wavefrontsize32,+real-true16 -show-encoding %s 2>&1 | FileCheck --check-prefix=W32 --strict-whitespace --implicit-check-not=error %s
// RUN: not llvm-mc -triple=amdgpu13.10 -mattr=+wavefrontsize64,+real-true16 -show-encoding %s 2>&1 | FileCheck --check-prefix=W64 --strict-whitespace --implicit-check-not=error %s
+// RUN: not llvm-mc -triple=amdgpu13.10 -mattr=+wavefrontsize32,-real-true16 -show-encoding %s 2>&1 | FileCheck --check-prefix=W32 --strict-whitespace --implicit-check-not=error %s
+// RUN: not llvm-mc -triple=amdgpu13.10 -mattr=+wavefrontsize64,-real-true16 -show-encoding %s 2>&1 | FileCheck --check-prefix=W64 --strict-whitespace --implicit-check-not=error %s
v_cvt_scale_pk32_bf16_bf6 v[10:25], s[20:25], v8
// W32: :[[@LINE-1]]:37: error: invalid operand for instruction
@@ -218,3 +220,38 @@ v_cvt_scale_pk32_f32_fp6_e64_dpp v[0:31], v[20:25], v8
// W32: :[[@LINE-1]]:1: error: e64_dpp variant of this instruction is not supported
// W64: :[[@LINE-2]]:1: error: instruction not supported on this GPU (gfx1310): v_cvt_scale_pk32_f32_fp6
+v_wave_match_b32 v5, |v3|, v1
+// W32: :[[@LINE-1]]:22: error: not a valid operand.
+// W64: :[[@LINE-2]]:22: error: not a valid operand.
+
+v_wave_match_b32 v5, -v3, v1
+// W32: :[[@LINE-1]]:22: error: not a valid operand.
+// W64: :[[@LINE-2]]:22: error: not a valid operand.
+
+v_wave_match_b32 v5, v3, |v1|
+// W32: :[[@LINE-1]]:26: error: not a valid operand.
+// W64: :[[@LINE-2]]:26: error: not a valid operand.
+
+v_wave_match_b32 v5, v3, -v1
+// W32: :[[@LINE-1]]:26: error: not a valid operand.
+// W64: :[[@LINE-2]]:26: error: not a valid operand.
+
+v_wave_match_b32 v5, v3, v1 clamp
+// W32: :[[@LINE-1]]:29: error: invalid operand for instruction
+// W64: :[[@LINE-2]]:29: error: invalid operand for instruction
+
+v_wave_match_b32 v5, v3, v1 mul:2
+// W32: :[[@LINE-1]]:29: error: not a valid operand.
+// W64: :[[@LINE-2]]:29: error: not a valid operand.
+
+v_wave_match_b32_dpp v5, v3, v1 row_share:1
+// W32: :[[@LINE-1]]:1: error: dpp variant of this instruction is not supported
+// W64: :[[@LINE-2]]:1: error: dpp variant of this instruction is not supported
+
+v_wave_match_b32_dpp v5, v3, v1 dpp8:[7,6,5,4,3,2,1,0]
+// W32: :[[@LINE-1]]:1: error: dpp variant of this instruction is not supported
+// W64: :[[@LINE-2]]:1: error: dpp variant of this instruction is not supported
+
+v_wave_match_b32_e64_dpp v5, v3, v1 row_share:1
+// W32: :[[@LINE-1]]:1: error: e64_dpp variant of this instruction is not supported
+// W64: :[[@LINE-2]]:1: error: e64_dpp variant of this instruction is not supported
More information about the llvm-commits
mailing list