[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 09:07:29 PDT 2024
michaelmaitland wrote:
>From [GISel Docs](https://llvm.org/docs/GlobalISel/GenericOpcode.html#g-extract-subvector)
> Extract a vector of destination type from the source vector. The index operand represents the starting index from which a subvector is extracted from the source vector.
> The index must be a constant multiple of the source vector’s minimum vector length. If the source vector is a scalable vector, then the index is first scaled by the runtime scaling factor. The indices extracted from the source vector must be valid indices of that vector. If this condition cannot be determined statically but is false at runtime, then the result vector is undefined.
>From ISD::EXTRACT_SUBVECTOR:
> Let the result type be T, then IDX represents the starting element number from which a subvector of type T is extracted. IDX must be a constant multiple of T's known minimum vector length. If T is a scalable vector, IDX is first scaled by the runtime scaling factor of T. Elements IDX through (IDX + num_elements(T) - 1) must be valid VECTOR indices. If this condition cannot be determined statically but is false at runtime, then the result vector is undefined. The IDX parameter must be a vector index constant type, which for most targets will be an integer pointer type.
> This operation supports extracting a fixed-width vector from a scalable vector, but not the other way around.
I don't see in here where we specify that scalable vector result needs to have same type as source.
It sounds like selection dag supports extracting fixed from scalable, which would mean that the source and destination are not the same type. But we don't yet specify whether we will permit this in GISel.
I would imagine that legalizers could be responsible for what different types they'd like to permit.
https://github.com/llvm/llvm-project/pull/108848
More information about the llvm-commits
mailing list