From 2239ea351acb44b68c1c0559376e5b2e4cf1194b Mon Sep 17 00:00:00 2001 From: XLS Team Date: Mon, 22 Jun 2026 04:01:54 -0700 Subject: [PATCH] Add test coverage for xls.sel, xls.one_hot_sel and xls.priority_sel in xls_to_circt.mlir PiperOrigin-RevId: 935973469 --- xls/codegen/node_expressions.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xls/codegen/node_expressions.cc b/xls/codegen/node_expressions.cc index 905413644a..c139a6e40b 100644 --- a/xls/codegen/node_expressions.cc +++ b/xls/codegen/node_expressions.cc @@ -634,6 +634,9 @@ absl::StatusOr NodeToExpression( case Op::kShrl: return EmitShift(node, inputs[0], inputs[1], file); case Op::kSignExt: { + if (node->BitCountOrDie() == node->operand(0)->BitCountOrDie()) { + return inputs[0]; + } if (node->operand(0)->BitCountOrDie() == 1) { // A sign extension of a single-bit value is just replication. return file->Concat( @@ -709,6 +712,9 @@ absl::StatusOr NodeToExpression( case Op::kXorReduce: return file->XorReduce(inputs[0], node->loc()); case Op::kZeroExt: { + if (node->BitCountOrDie() == node->operand(0)->BitCountOrDie()) { + return inputs[0]; + } int64_t bits_added = node->BitCountOrDie() - node->operand(0)->BitCountOrDie();