[llvm] [AMDGPU] New GFX11 v_cmp_tru_* aliases for integer comparisons (PR #118976)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 6 06:09:34 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mc
Author: Jay Foad (jayfoad)
<details>
<summary>Changes</summary>
This is for compatibility with SP3. It only affects GFX11 because the
v_cmp_t_* instructions were removed in GFX12.
---
Full diff: https://github.com/llvm/llvm-project/pull/118976.diff
3 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/VOPCInstructions.td (+11)
- (added) llvm/test/MC/AMDGPU/gfx11_asm_vopc_alias.s (+14)
- (added) llvm/test/MC/AMDGPU/gfx11_asm_vopcx_alias.s (+14)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/VOPCInstructions.td b/llvm/lib/Target/AMDGPU/VOPCInstructions.td
index 0a4b51c4ac631d..9bf043ea334fea 100644
--- a/llvm/lib/Target/AMDGPU/VOPCInstructions.td
+++ b/llvm/lib/Target/AMDGPU/VOPCInstructions.td
@@ -1956,6 +1956,17 @@ defm V_CMPX_CLASS_F16_fake16 : VOPCX_Real_t16_gfx11_gfx12<0x0fd, "v_cmpx_class_f
defm V_CMPX_CLASS_F32 : VOPCX_Real_gfx11_gfx12<0x0fe>;
defm V_CMPX_CLASS_F64 : VOPCX_Real_gfx11_gfx12<0x0ff>;
+let AssemblerPredicate = isGFX11Only in {
+ def : AMDGPUMnemonicAlias<"v_cmp_tru_i32", "v_cmp_t_i32">;
+ def : AMDGPUMnemonicAlias<"v_cmp_tru_u32", "v_cmp_t_u32">;
+ def : AMDGPUMnemonicAlias<"v_cmp_tru_i64", "v_cmp_t_i64">;
+ def : AMDGPUMnemonicAlias<"v_cmp_tru_u64", "v_cmp_t_u64">;
+ def : AMDGPUMnemonicAlias<"v_cmpx_tru_i32", "v_cmpx_t_i32">;
+ def : AMDGPUMnemonicAlias<"v_cmpx_tru_u32", "v_cmpx_t_u32">;
+ def : AMDGPUMnemonicAlias<"v_cmpx_tru_i64", "v_cmpx_t_i64">;
+ def : AMDGPUMnemonicAlias<"v_cmpx_tru_u64", "v_cmpx_t_u64">;
+}
+
//===----------------------------------------------------------------------===//
// GFX10.
//===----------------------------------------------------------------------===//
diff --git a/llvm/test/MC/AMDGPU/gfx11_asm_vopc_alias.s b/llvm/test/MC/AMDGPU/gfx11_asm_vopc_alias.s
new file mode 100644
index 00000000000000..2b95e6a9487465
--- /dev/null
+++ b/llvm/test/MC/AMDGPU/gfx11_asm_vopc_alias.s
@@ -0,0 +1,14 @@
+// NOTE: Assertions have been autogenerated by utils/update_mc_test_checks.py UTC_ARGS: --version 5
+// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=+wavefrontsize64 -show-encoding %s | FileCheck -check-prefix=GFX11 %s
+
+v_cmp_tru_i32 vcc, v1, v2
+// GFX11: v_cmp_t_i32_e32 vcc, v1, v2 ; encoding: [0x01,0x05,0x8e,0x7c]
+
+v_cmp_tru_u32 vcc, v1, v2
+// GFX11: v_cmp_t_u32_e32 vcc, v1, v2 ; encoding: [0x01,0x05,0x9e,0x7c]
+
+v_cmp_tru_i64 vcc, v[1:2], v[2:3]
+// GFX11: v_cmp_t_i64_e32 vcc, v[1:2], v[2:3] ; encoding: [0x01,0x05,0xae,0x7c]
+
+v_cmp_tru_u64 vcc, v[1:2], v[2:3]
+// GFX11: v_cmp_t_u64_e32 vcc, v[1:2], v[2:3] ; encoding: [0x01,0x05,0xbe,0x7c]
diff --git a/llvm/test/MC/AMDGPU/gfx11_asm_vopcx_alias.s b/llvm/test/MC/AMDGPU/gfx11_asm_vopcx_alias.s
new file mode 100644
index 00000000000000..636ec3c19d70f1
--- /dev/null
+++ b/llvm/test/MC/AMDGPU/gfx11_asm_vopcx_alias.s
@@ -0,0 +1,14 @@
+// NOTE: Assertions have been autogenerated by utils/update_mc_test_checks.py UTC_ARGS: --version 5
+// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -mattr=+wavefrontsize64 -show-encoding %s | FileCheck -check-prefix=GFX11 %s
+
+v_cmpx_tru_i32 v1, v2
+// GFX11: v_cmpx_t_i32_e32 v1, v2 ; encoding: [0x01,0x05,0x8e,0x7d]
+
+v_cmpx_tru_u32 v1, v2
+// GFX11: v_cmpx_t_u32_e32 v1, v2 ; encoding: [0x01,0x05,0x9e,0x7d]
+
+v_cmpx_tru_i64 v[1:2], v[2:3]
+// GFX11: v_cmpx_t_i64_e32 v[1:2], v[2:3] ; encoding: [0x01,0x05,0xae,0x7d]
+
+v_cmpx_tru_u64 v[1:2], v[2:3]
+// GFX11: v_cmpx_t_u64_e32 v[1:2], v[2:3] ; encoding: [0x01,0x05,0xbe,0x7d]
``````````
</details>
https://github.com/llvm/llvm-project/pull/118976
More information about the llvm-commits
mailing list