Return a type whose total size is the GCD of OrigTy and TargetTy.

Synopsis

Declared in <llvm/CodeGen/GlobalISel/Utils.h>

LLT
getGCDType(
    LLT OrigTy,
    LLT TargetTy);

Description

This will try to either change the number of vector elements, or bitwidth of scalars. The intent is the result type can be used as the result of a G_UNMERGE_VALUES from OrigTy, and then some combination of G_MERGE_VALUES, G_BUILD_VECTOR and G_CONCAT_VECTORS (possibly with intermediate casts) can re‐form TargetTy.

If these are vectors with different element types, this will try to produce a vector with a compatible total size, but the element type of OrigTy. If this can't be satisfied, this will produce a scalar smaller than the original vector elements. It is an error to call this function where one argument is a fixed vector and the other is a scalable vector, since it is illegal to build a G_{MERGE|UNMERGE}_VALUES between fixed and scalable vectors.

In the worst case, this returns LLT::scalar(1).

Return Value

The GCD type of OrigTy and TargetTy.

Parameters

Name

Description

OrigTy

Original type being decomposed.

TargetTy

Target type that must be rebuildable from GCD parts.

Created with MrDocs