-
Notifications
You must be signed in to change notification settings - Fork 348
[RTL] Add pattern matching to rtl tests #59
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,43 +3,43 @@ | |
// CHECK-LABEL: func @test1(%arg0: i3) -> i50 { | ||
func @test1(%arg0: i3) -> i50 { | ||
// CHECK-NEXT: %c42_i12 = rtl.constant(42 : i12) : i12 | ||
// 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 commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I'd personally just write |
||
%a = rtl.constant(42 : i12) : i12 | ||
%b = rtl.add %a, %a : i12 | ||
%c = rtl.mul %a, %b : i12 | ||
|
||
// CHECK-NEXT: %2 = rtl.sext %arg0 : (i3) -> i7 | ||
// CHECK-NEXT: %3 = rtl.zext %arg0 : (i3) -> i7 | ||
// CHECK-NEXT: %[[RES2:.*]] = rtl.sext %arg0 : (i3) -> i7 | ||
// CHECK-NEXT: %[[RES3:.*]] = rtl.zext %arg0 : (i3) -> i7 | ||
%d = rtl.sext %arg0 : (i3) -> i7 | ||
%e = rtl.zext %arg0 : (i3) -> i7 | ||
|
||
// CHECK-NEXT: %4 = rtl.concat %c42_i12 : (i12) -> i12 | ||
// CHECK-NEXT: %[[RES4:.*]] = rtl.concat %[[C42_i12:.*]] : (i12) -> i12 | ||
%conc1 = rtl.concat %a : (i12) -> i12 | ||
|
||
// CHECK-NEXT: %5 = rtl.andr %4 : i12 | ||
// CHECK-NEXT: %6 = rtl.orr %4 : i12 | ||
// CHECK-NEXT: %7 = rtl.xorr %4 : i12 | ||
// CHECK-NEXT: %[[RES5:.*]] = rtl.andr %[[RES4:.*]] : i12 | ||
// CHECK-NEXT: %[[RES6:.*]] = rtl.orr %[[RES4:.*]] : i12 | ||
// CHECK-NEXT: %[[RES7:.*]] = rtl.xorr %[[RES4:.*]] : i12 | ||
%andr1 = rtl.andr %conc1 : i12 | ||
%orr1 = rtl.orr %conc1 : i12 | ||
%xorr1 = rtl.xorr %conc1 : i12 | ||
|
||
// CHECK-NEXT: %8 = rtl.concat %4, %0, %1, %2, %3 : (i12, i12, i12, i7, i7) -> i50 | ||
// CHECK-NEXT: %[[RES8:.*]] = rtl.concat %[[RES4:.*]], %[[RES0:.*]], %[[RES1:.*]], %[[RES2:.*]], %[[RES3:.*]] : (i12, i12, i12, i7, i7) -> i50 | ||
%result = rtl.concat %conc1, %b, %c, %d, %e : (i12, i12, i12, i7, i7) -> i50 | ||
|
||
// CHECK-NEXT: rtl.extract %8 from 4 : (i50) -> i19 | ||
// CHECK-NEXT: %[[RES9:.*]] = rtl.extract [[RES8:.*]] from 4 : (i50) -> i19 | ||
%small1 = rtl.extract %result from 4 : (i50) -> i19 | ||
|
||
// CHECK-NEXT: rtl.extract %8 from 31 : (i50) -> i19 | ||
// CHECK-NEXT: %[[RES10:.*]] = rtl.extract [[RES8:.*]] from 31 : (i50) -> i19 | ||
%small2 = rtl.extract %result from 31 : (i50) -> i19 | ||
|
||
// CHECK-NEXT: rtl.add | ||
// CHECK-NEXT: rtl.add %[[RES9:.*]], %[[RES10:.*]] : i19 | ||
%add = rtl.add %small1, %small2 : i19 | ||
|
||
// CHECK-NEXT: = rtl.wire : i4 | ||
%w = rtl.wire : i4 | ||
|
||
// CHECK-NEXT: return %8 : i50 | ||
// CHECK-NEXT: return [[RES8:.*]] : i50 | ||
return %result : i50 | ||
} | ||
// CHECK-NEXT: } |
Uh oh!
There was an error while loading. Please reload this page.