Skip to content

CodeGenPass#184

Merged
n0thingNoob merged 2 commits intomainfrom
testbench
Nov 4, 2025
Merged

CodeGenPass#184
n0thingNoob merged 2 commits intomainfrom
testbench

Conversation

@n0thingNoob
Copy link
Copy Markdown
Collaborator

Fix missing constant operands in arithmetic and cmp instructions in YAML/ASM generation; add cmp_type and cast_type for YAML/ASM generation.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances code generation for comparison and cast operations by making their opcodes more specific. It appends the operation subtype (comparison type or cast type) to the base opcode, transforming generic opcodes like ICMP, FCMP, and CAST into more specific ones like ICMP_EQ, ICMP_SGE, CAST_FPTOSI, and CAST_TRUNC.

  • Extended the getOpcode() function to append comparison and cast types to operation names
  • Refactored constant literal extraction into a reusable helper function
  • Added support for rhs_value attribute in binary operations with constant RHS operands
  • Updated test expectations to reflect the new specific opcode naming

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
lib/NeuraDialect/Transforms/GenerateCodePass.cpp Enhanced opcode generation to include comparison/cast types, refactored constant extraction, and added rhs_value attribute support
test/e2e/relu/relu_kernel.mlir Updated test expectations to include specific CAST_TRUNC, ICMP_EQ, and ICMP_SGE opcodes
test/e2e/histogram/histogram_kernel.mlir Changed generic CAST opcode to specific CAST_FPTOSI opcode
test/e2e/fir/fir_kernel.mlir Added ICMP_EQ opcode and corresponding ASM output expectations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@n0thingNoob n0thingNoob merged commit 77e5aba into main Nov 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants