Skip to content

Commit

Permalink
Update tests to include ir
Browse files Browse the repository at this point in the history
  • Loading branch information
kehemo committed Nov 6, 2024
1 parent 0ee6127 commit 00b0d51
Show file tree
Hide file tree
Showing 22 changed files with 207 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
EXO IR:
def foo(a: i32 @ DRAM):
a = 2
a = 2
a = 2
C:
#include "test.h"

#include <stdio.h>
Expand Down
13 changes: 13 additions & 0 deletions tests/golden/test_metaprogramming/test_captured_closure.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
EXO IR:
def bar(a: i32 @ DRAM):
a += 1
a += 2
a += 3
a += 4
a += 5
a += 6
a += 7
a += 8
a += 9
a += 10
C:
#include "test.h"

#include <stdio.h>
Expand Down
8 changes: 8 additions & 0 deletions tests/golden/test_metaprogramming/test_conditional.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
EXO IR:
def bar1(a: i8 @ DRAM):
b: i8 @ DRAM
b += 1
def bar2(a: i8 @ DRAM):
b: i8 @ DRAM
b = 0
C:
#include "test.h"

#include <stdio.h>
Expand Down
4 changes: 4 additions & 0 deletions tests/golden/test_metaprogramming/test_constant_lifting.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
EXO IR:
def foo(a: f64 @ DRAM):
a = 2.0818897486445276
C:
#include "test.h"

#include <stdio.h>
Expand Down
4 changes: 4 additions & 0 deletions tests/golden/test_metaprogramming/test_local_externs.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
EXO IR:
def foo(a: f64 @ DRAM):
a = sin(a)
C:
#include "test.h"

#include <stdio.h>
Expand Down
28 changes: 28 additions & 0 deletions tests/golden/test_metaprogramming/test_proc_shadowing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
EXO IR:
def foo(a: f32 @ DRAM):
sin(a)
C:
#include "test.h"

#include <stdio.h>
#include <stdlib.h>

// sin(
// a : f32 @DRAM
// )
static void sin( void *ctxt, float* a );

// foo(
// a : f32 @DRAM
// )
void foo( void *ctxt, float* a ) {
sin(ctxt,a);
}

// sin(
// a : f32 @DRAM
// )
static void sin( void *ctxt, float* a ) {
*a = 0.0f;
}

4 changes: 4 additions & 0 deletions tests/golden/test_metaprogramming/test_quote_complex_expr.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
EXO IR:
def foo(a: i32 @ DRAM):
a = a + 1 + 1
C:
#include "test.h"

#include <stdio.h>
Expand Down
4 changes: 4 additions & 0 deletions tests/golden/test_metaprogramming/test_quote_elision.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
EXO IR:
def foo(a: i32 @ DRAM, b: i32 @ DRAM):
b = a
C:
#include "test.h"

#include <stdio.h>
Expand Down
6 changes: 6 additions & 0 deletions tests/golden/test_metaprogramming/test_scope_collision1.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
EXO IR:
def foo(a: i32 @ DRAM):
b: i32 @ DRAM
b = 2
a = 1
C:
#include "test.h"

#include <stdio.h>
Expand Down
4 changes: 4 additions & 0 deletions tests/golden/test_metaprogramming/test_scope_collision2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
EXO IR:
def foo(a: i32 @ DRAM, b: i32 @ DRAM):
b = a
C:
#include "test.h"

#include <stdio.h>
Expand Down
4 changes: 4 additions & 0 deletions tests/golden/test_metaprogramming/test_scope_nesting.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
EXO IR:
def foo(a: i8 @ DRAM, b: i8 @ DRAM):
a = b
C:
#include "test.h"

#include <stdio.h>
Expand Down
4 changes: 4 additions & 0 deletions tests/golden/test_metaprogramming/test_scoping.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
EXO IR:
def foo(a: i8 @ DRAM):
a = 3
C:
#include "test.h"

#include <stdio.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
EXO IR:
def foo(a: i32 @ DRAM):
a += 1
a += 2
a += 1
a += 2
C:
#include "test.h"

#include <stdio.h>
Expand Down
16 changes: 16 additions & 0 deletions tests/golden/test_metaprogramming/test_type_params.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
EXO IR:
def bar1(a: i32 @ DRAM, b: i8 @ DRAM):
c: i32[4] @ DRAM
for i in seq(0, 3):
d: i32 @ DRAM
d = b
c[i + 1] = a + c[i] * d
a = c[3]
def bar2(a: f64 @ DRAM, b: f64 @ DRAM):
c: f64[4] @ DRAM
for i in seq(0, 3):
d: f64 @ DRAM
d = b
c[i + 1] = a + c[i] * d
a = c[3]
C:
#include "test.h"

#include <stdio.h>
Expand Down
5 changes: 5 additions & 0 deletions tests/golden/test_metaprogramming/test_type_quote_elision.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
EXO IR:
def foo(a: i8 @ DRAM, x: i8[2] @ DRAM):
a += x[0]
a += x[1]
C:
#include "test.h"

#include <stdio.h>
Expand Down
4 changes: 4 additions & 0 deletions tests/golden/test_metaprogramming/test_unary_ops.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
EXO IR:
def foo(a: i32 @ DRAM):
a = -2
C:
#include "test.h"

#include <stdio.h>
Expand Down
4 changes: 4 additions & 0 deletions tests/golden/test_metaprogramming/test_unquote_elision.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
EXO IR:
def foo(a: i32 @ DRAM):
a = a * 2
C:
#include "test.h"

#include <stdio.h>
Expand Down
7 changes: 7 additions & 0 deletions tests/golden/test_metaprogramming/test_unquote_in_slice.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
EXO IR:
def foo(a: [i8][2] @ DRAM):
a[0] += a[1]
def bar(a: i8[10, 10] @ DRAM):
for i in seq(0, 5):
foo(a[i, 2:4])
C:
#include "test.h"

#include <stdio.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
EXO IR:
def foo(a: [i8][2, 2] @ DRAM):
a[0, 0] += a[0, 1]
a[1, 0] += a[1, 1]
def bar(a: i8[10, 10, 10] @ DRAM):
for i in seq(0, 7):
foo(a[i, i:i + 2, i + 1:i + 3])
C:
#include "test.h"

#include <stdio.h>
Expand Down
11 changes: 11 additions & 0 deletions tests/golden/test_metaprogramming/test_unquote_slice_object1.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
EXO IR:
def foo(a: [i8][2] @ DRAM):
a[0] += a[1]
def bar(a: i8[10, 10] @ DRAM):
for i in seq(0, 10):
foo(a[i, 1:3])
for i in seq(0, 10):
foo(a[i, 5:7])
for i in seq(0, 10):
foo(a[i, 2:4])
C:
#include "test.h"

#include <stdio.h>
Expand Down
15 changes: 15 additions & 0 deletions tests/golden/test_metaprogramming/test_unrolling.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
EXO IR:
def foo(a: i8 @ DRAM):
b: i8 @ DRAM
b = 0
b += a
b += a
b += a
b += a
b += a
b += a
b += a
b += a
b += a
b += a
C:
#include "test.h"

#include <stdio.h>
Expand Down
Loading

0 comments on commit 00b0d51

Please sign in to comment.