forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes rust-lang#9
- Loading branch information
Jorge Aparicio
committed
Jul 10, 2016
1 parent
9487913
commit 43cfa4b
Showing
4 changed files
with
83 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
-include ../tools.mk | ||
|
||
NVPTX = nvptx-unknown-unknown | ||
NVPTX64 = nvptx64-unknown-unknown | ||
|
||
all: smoke syncthreads thread_idx | ||
|
||
smoke: | ||
$(RUSTC) --target $(NVPTX) --emit=asm $@.rs | ||
grep '\.address_size *32' $(TMPDIR)/$@.s | ||
$(RUSTC) --target $(NVPTX64) --emit=asm $@.rs | ||
grep '\.address_size *64' $(TMPDIR)/$@.s | ||
|
||
syncthreads: | ||
$(RUSTC) --target $(NVPTX) --emit=llvm-ir $@.rs | ||
grep 'call.*syncthreads' $(TMPDIR)/$@.ll | ||
$(RUSTC) --target $(NVPTX64) --emit=llvm-ir $@.rs | ||
grep 'call.*syncthreads' $(TMPDIR)/$@.ll | ||
$(RUSTC) --target $(NVPTX) --emit=asm $@.rs | ||
grep 'bar\.sync' $(TMPDIR)/$@.s | ||
$(RUSTC) --target $(NVPTX64) --emit=asm $@.rs | ||
grep 'bar\.sync' $(TMPDIR)/$@.s | ||
|
||
thread_idx: | ||
$(RUSTC) --target $(NVPTX) --emit=llvm-ir $@.rs | ||
grep 'call.*tid\.x' $(TMPDIR)/$@.ll | ||
$(RUSTC) --target $(NVPTX64) --emit=llvm-ir $@.rs | ||
grep 'call.*tid\.x' $(TMPDIR)/$@.ll | ||
$(RUSTC) --target $(NVPTX) --emit=asm $@.rs | ||
grep '%tid\.x' $(TMPDIR)/$@.s | ||
$(RUSTC) --target $(NVPTX64) --emit=asm $@.rs | ||
grep '%tid\.x' $(TMPDIR)/$@.s |
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,5 @@ | ||
#![feature(lang_items)] | ||
#![feature(no_core)] | ||
#![feature(platform_intrinsics)] | ||
|
||
#![no_core] |
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,23 @@ | ||
#![feature(lang_items)] | ||
#![feature(no_core)] | ||
#![feature(platform_intrinsics)] | ||
|
||
#![no_core] | ||
|
||
#![allow(dead_code)] | ||
|
||
extern "platform-intrinsic" { | ||
fn nvptx_syncthreads(); | ||
} | ||
|
||
fn syncthreads() { | ||
unsafe { | ||
nvptx_syncthreads(); | ||
} | ||
} | ||
|
||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
#[lang = "sized"] | ||
trait Sized {} |
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,23 @@ | ||
#![feature(lang_items)] | ||
#![feature(no_core)] | ||
#![feature(platform_intrinsics)] | ||
|
||
#![no_core] | ||
|
||
#![allow(dead_code)] | ||
|
||
extern "platform-intrinsic" { | ||
fn nvptx_thread_idx_x() -> i32; | ||
} | ||
|
||
fn thread_idx() -> i32 { | ||
unsafe { | ||
nvptx_thread_idx_x() | ||
} | ||
} | ||
|
||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
#[lang = "sized"] | ||
trait Sized {} |