Skip to content

[HLSL] Support element-wise matrix comparison operators #216786

Description

@farzonl

Problem

Clang does not support HLSL comparison operators when either operand is a matrix.

The following operators should perform element-wise comparisons:

  • <
  • >
  • <=
  • >=
  • ==
  • !=

Test cases

bool2x2 matrix_matrix(float2x2 a, float2x2 b) {
  return a < b;
}

bool2x2 matrix_scalar(float2x2 a, float b) {
  return a == b;
}

bool2x2 scalar_matrix(float a, float2x2 b) {
  return a >= b;
}

Requirments

Matrix comparisons should be element-wise and produce a Boolean matrix with the same dimensions as the matrix operand.
Scalar operands should be converted to the matrix element type and broadcast across the matrix.

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:codegenIR generation bugs: mangling, exceptions, etc.clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

Projects

Status
Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions