Skip to content

Support heterogeneous vector-vector numeric unification #270

@xmnlab

Description

@xmnlab

Summary

PR #237 centralized numeric unification in BinaryOp by introducing
_unify_numeric_operands, but the remaining parts of the original scope from
#135 still need to be completed. In particular, #135 explicitly called for
centralized numeric unification and promotions across scalars and vectors, and
to use that logic in binops, compares, and FMA. PR #237 wired the new helper
into BinaryOp and described the change as being applied there. :contentReference[oaicite:0]{index=0}

Missing pieces

  1. Support heterogeneous vector-vector numeric unification

    • keep rejecting lane-count mismatches
    • when both operands are vectors with the same lane count but different
      element types, promote both to a common element type instead of erroring
    • preserve signed/unsigned integer semantics during widening and int->float
      conversion
  2. Reuse the same centralized unification in compare lowering

    • scalar-scalar
    • scalar-vector
    • vector-vector
  3. Reuse the same centralized unification in FMA lowering

    • unify all three operands before emission
    • ensure scalar/vector and vector/vector cases behave consistently with
      BinaryOp

Expected behavior

The numeric coercion rules should live in one place and be reused consistently
across arithmetic, compares, and FMA. The result should match the intent of
#135: one unified promotion path for scalar and vector numeric operands,
including signedness handling, FP rank selection, and scalar↔vector splatting. :contentReference[oaicite:1]{index=1}

Suggested tests

Add coverage for at least the following:

  • vector<i16> with vector<i32>
  • vector<float> with vector<double>
  • unsigned vector integer widening
  • unsigned vector int->float promotion
  • compare operations using mixed scalar/scalar, scalar/vector, and
    vector/vector numeric types
  • FMA with mixed scalar/scalar, scalar/vector, and vector/vector numeric types

Notes

PR #237 mentioned the possibility of bringing FMA into the same unification
path later, so this issue tracks that remaining work explicitly. :contentReference[oaicite:2]{index=2}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions