diff --git a/tests/fmod.t b/tests/fmod.t new file mode 100644 index 00000000..5753ce59 --- /dev/null +++ b/tests/fmod.t @@ -0,0 +1,6 @@ +local fmodf = terralib.externfunction("fmodf",{float,float} -> float) +local terra boom (m : float) : float + return fmodf(m,3.14) --m % 3.14159 +end + +print(boom(0)) \ No newline at end of file diff --git a/tests/fnptrstruct.t b/tests/fnptrstruct.t new file mode 100644 index 00000000..0aeb18f9 --- /dev/null +++ b/tests/fnptrstruct.t @@ -0,0 +1,13 @@ +local C = terralib.includecstring [[ + struct Foo { int (*what)(int); }; +]] + +C.Foo:printpretty() + +terra bar(a : int) return a + 1 end + +terra foo(a : &C.Foo, b : int -> int) + a.what = b +end + +foo:disas() \ No newline at end of file diff --git a/tests/ustore.t b/tests/ustore.t new file mode 100644 index 00000000..f33d2f3c --- /dev/null +++ b/tests/ustore.t @@ -0,0 +1,11 @@ +local terra unalignedload(addr : &float) + return terralib.attrload([&vector(float,4)](addr), { align = 4 }) +end +local terra unalignedstore(addr : &float, value : vector(float,4)) + terralib.attrstore([&vector(float,4)](addr),value, { align = 4 }) +end + +terra foo(a : &float) + unalignedstore(a,unalignedload(a+3)) +end +foo:disas() \ No newline at end of file