-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal-variables.forth
More file actions
27 lines (23 loc) · 1.14 KB
/
local-variables.forth
File metadata and controls
27 lines (23 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
\ RUN: %warpforth-translate --forth-to-mlir %s | %FileCheck %s
\ Test basic local variable binding and reference.
\ CHECK: func.func private @ADD3(%arg0: !forth.stack) -> !forth.stack {
\ CHECK: forth.pop %arg0 : !forth.stack -> !forth.stack, i64
\ CHECK: forth.pop %{{.*}} : !forth.stack -> !forth.stack, i64
\ CHECK: forth.pop %{{.*}} : !forth.stack -> !forth.stack, i64
\ CHECK: forth.push_value %{{.*}}, %{{.*}} : !forth.stack, i64 -> !forth.stack
\ CHECK: forth.push_value %{{.*}}, %{{.*}} : !forth.stack, i64 -> !forth.stack
\ CHECK: forth.addi
\ CHECK: forth.push_value %{{.*}}, %{{.*}} : !forth.stack, i64 -> !forth.stack
\ CHECK: forth.addi
\ CHECK: return
\ CHECK: func.func private @SWAP2(%arg0: !forth.stack) -> !forth.stack {
\ CHECK: forth.pop %arg0 : !forth.stack -> !forth.stack, i64
\ CHECK: forth.pop %{{.*}} : !forth.stack -> !forth.stack, i64
\ CHECK: forth.push_value %{{.*}}, %{{.*}} : !forth.stack, i64 -> !forth.stack
\ CHECK: forth.push_value %{{.*}}, %{{.*}} : !forth.stack, i64 -> !forth.stack
\ CHECK: return
\! kernel main
: ADD3 { a b c -- } a b + c + ;
: SWAP2 { x y -- } y x ;
1 2 3 ADD3
10 20 SWAP2