Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dialects: (llvm) added the 'nneg' keyword to zext #3420

Merged
merged 2 commits into from
Nov 11, 2024
Merged

Conversation

lfrenot
Copy link
Collaborator

@lfrenot lfrenot commented Nov 11, 2024

No description provided.

@lfrenot lfrenot added the dialects Changes on the dialects label Nov 11, 2024
@lfrenot lfrenot self-assigned this Nov 11, 2024
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.16%. Comparing base (9b64a9b) to head (957940d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3420      +/-   ##
==========================================
- Coverage   90.16%   90.16%   -0.01%     
==========================================
  Files         455      455              
  Lines       57467    57475       +8     
  Branches     5532     5532              
==========================================
+ Hits        51815    51822       +7     
- Misses       4195     4196       +1     
  Partials     1457     1457              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@tobiasgrosser tobiasgrosser left a comment

Choose a reason for hiding this comment

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

This looks good from my side.

@superlopuh, any input?

Comment on lines 589 to 615
@classmethod
def parse_nneg(cls, parser: Parser):
if parser.parse_optional_keyword("nneg") is not None:
return UnitAttr()

def print_nneg(self, printer: Printer) -> None:
if self.non_neg:
printer.print(" nneg")

@classmethod
def parse(cls, parser: Parser):
non_neg = cls.parse_nneg(parser)
arg = parser.parse_unresolved_operand()
attributes = parser.parse_optional_attr_dict()
parser.parse_characters(":")
arg_type = parser.parse_type()
parser.parse_characters("to")
res_type = parser.parse_type()
operands = parser.resolve_operands([arg], [arg_type], parser.pos)
return cls(operands[0], res_type, attributes, non_neg)

def print(self, printer: Printer):
self.print_nneg(printer)
printer.print(" ", self.arg)
printer.print_op_attributes(self.attributes)
printer.print(" : ")
printer.print(self.arg.type, " to ", self.res.type)
Copy link
Member

Choose a reason for hiding this comment

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

Not sure how urgently you need this in, but could you try using assembly_format for this? I have a feeling it could work, and have all the functionality you need in one line instead of 25.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, I did not know that was a thing.
I'll try it, and make a note to work on using it for the other operations as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment on lines 581 to 584
operands=[arg],
attributes=attributes,
result_types=[res_type],
properties={
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
operands=[arg],
attributes=attributes,
result_types=[res_type],
properties={
operands=(arg,),
attributes=attributes,
result_types=(res_type,),
properties={

Copy link
Member

Choose a reason for hiding this comment

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

Using tuples is marginally faster but it adds up if done consistently thoughout the project

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done, I'll also make a note to apply that to the rest of the file

@tobiasgrosser
Copy link
Contributor

@lfrenot, is this ready to merge?

@lfrenot
Copy link
Collaborator Author

lfrenot commented Nov 11, 2024

Yes it is

@tobiasgrosser tobiasgrosser merged commit e03689e into main Nov 11, 2024
15 checks passed
@tobiasgrosser tobiasgrosser deleted the leon/llvm-nneg branch November 11, 2024 16:27
EdmundGoodman pushed a commit to EdmundGoodman/xdsl that referenced this pull request Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialects Changes on the dialects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants