-
Notifications
You must be signed in to change notification settings - Fork 286
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
[RTL] Add pattern matching to rtl tests #59
Conversation
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.
Thanks!
Thanks! |
// CHECK-NEXT: %0 = rtl.add %c42_i12, %c42_i12 : i12 | ||
// CHECK-NEXT: %1 = rtl.mul %c42_i12, %0 : i12 | ||
// CHECK-NEXT: %[[RES0:.*]] = rtl.add %c42_i12, %c42_i12 : i12 | ||
// CHECK-NEXT: %[[RES1:.*]] = rtl.mul %c42_i12, %[[RES0:.*]] : i12 |
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.
[[RES0:.*]]
is a capture expression. To use the captured value as a pattern, you need to use [[RES0]]
.
Since the test only uses capture expressions, this is equivalent to just use wildcards as in:
// CHECK-NEXT: %{{.*}} = rtl.mul %c42_i12, %{{.*}} : i12
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, good catch I should have noticed that. Thank you!
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.
Also, if you expect a number, you can be more specific and use [[RES0:[0-9]+]]
. As a question of style, I would probably also include the % to the pattern: [[RES0:%[0-9]+]]
.
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.
Thanks @jprotze!
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.
I'd personally just write .*
because it is unambiguous and the pattern is simpler, but we're now so far down the line of personal preference that anything is fine :-)
Updates the RTL tests to use pattern matching instead of hardcoded ssa values. Addresses #24