forked from terralang/terra
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for SPIR-V code generation (terralang#652)
- Loading branch information
1 parent
e824949
commit dff6c92
Showing
3 changed files
with
90 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- Tests of pointers with address spaces. | ||
|
||
-- The exact meaning of this depends on the target, but at least basic | ||
-- code compilation should work. | ||
|
||
local function ptr1(ty) | ||
-- A pointer in address space 1. | ||
return terralib.types.pointer(ty, 1) | ||
end | ||
|
||
terra test(x : &int, y : ptr1(int)) | ||
-- Should be able to do math on pointers with non-zero address spaces: | ||
var a = [ptr1(int8)](y) | ||
var b = a + 8 | ||
var c = [ptr1(int)](b) | ||
var d = c - y | ||
y = c | ||
|
||
-- Casts should work: | ||
y = [ptr1(int)](x) | ||
x = [&int](y) | ||
|
||
return d | ||
end | ||
test:compile() | ||
print(test) |