Skip to content

Commit

Permalink
adding some uncommitted tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zdevito committed Feb 26, 2016
1 parent c501af4 commit 2fa8d0a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/fmod.t
Original file line number Diff line number Diff line change
@@ -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))
13 changes: 13 additions & 0 deletions tests/fnptrstruct.t
Original file line number Diff line number Diff line change
@@ -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()
11 changes: 11 additions & 0 deletions tests/ustore.t
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 2fa8d0a

Please sign in to comment.