-
Notifications
You must be signed in to change notification settings - Fork 85
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
There was a problem hiding this 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?
xdsl/dialects/llvm.py
Outdated
@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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
xdsl/dialects/llvm.py
Outdated
operands=[arg], | ||
attributes=attributes, | ||
result_types=[res_type], | ||
properties={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operands=[arg], | |
attributes=attributes, | |
result_types=[res_type], | |
properties={ | |
operands=(arg,), | |
attributes=attributes, | |
result_types=(res_type,), | |
properties={ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
e57ac6d
to
957940d
Compare
@lfrenot, is this ready to merge? |
Yes it is |
No description provided.