[llvm] [GISEL] Fix bug in G_EXTRACT_SUBVECTOR definition (PR #108848)
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 08:48:09 PDT 2024
https://github.com/michaelmaitland created https://github.com/llvm/llvm-project/pull/108848
The implementation was missing the fact that `G_EXTRACT_SUBVECTOR` destination and source vector can be different types.
>From c3ff5706a9bd0d2d25990d83ae7f704f8b958ba8 Mon Sep 17 00:00:00 2001
From: Michael Maitland <michaeltmaitland at gmail.com>
Date: Mon, 16 Sep 2024 08:45:56 -0700
Subject: [PATCH] [RISCV][GISEL] Fix bug in G_EXTRACT_SUBVECTOR definition
The implementation was missing the fact that G_EXTRACT_SUBVECTOR destination
and source vector can be different types.
---
llvm/include/llvm/Target/GenericOpcodes.td | 2 +-
llvm/test/MachineVerifier/test_g_extract_subvector.mir | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/llvm/include/llvm/Target/GenericOpcodes.td b/llvm/include/llvm/Target/GenericOpcodes.td
index a55d9d3b04e62f..f5e62dda6fd043 100644
--- a/llvm/include/llvm/Target/GenericOpcodes.td
+++ b/llvm/include/llvm/Target/GenericOpcodes.td
@@ -1541,7 +1541,7 @@ def G_INSERT_SUBVECTOR : GenericInstruction {
// Generic extract subvector.
def G_EXTRACT_SUBVECTOR : GenericInstruction {
let OutOperandList = (outs type0:$dst);
- let InOperandList = (ins type0:$src, untyped_imm_0:$idx);
+ let InOperandList = (ins type1:$src, untyped_imm_0:$idx);
let hasSideEffects = false;
}
diff --git a/llvm/test/MachineVerifier/test_g_extract_subvector.mir b/llvm/test/MachineVerifier/test_g_extract_subvector.mir
index 5a441ff29c1721..3414843084e8a8 100644
--- a/llvm/test/MachineVerifier/test_g_extract_subvector.mir
+++ b/llvm/test/MachineVerifier/test_g_extract_subvector.mir
@@ -29,4 +29,7 @@ body: |
; CHECK: Index must be a multiple of the source vector's minimum vector length
%9:_(<vscale x 4 x s32>) = G_EXTRACT_SUBVECTOR %1, 3
+
+ ; CHECK-NOT: Type mismatch in generic instruction
+ %10:_(<vscale x 4 x s32>) = G_EXTRACT_SUBVECTOR %1, 2
...
More information about the llvm-commits
mailing list