merged with nvptx
This commit is contained in:
83
builtins.cpp
83
builtins.cpp
@@ -338,11 +338,13 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__all",
|
||||
"__any",
|
||||
"__aos_to_soa3_float",
|
||||
"__aos_to_soa3_float1",
|
||||
"__aos_to_soa3_float16",
|
||||
"__aos_to_soa3_float4",
|
||||
"__aos_to_soa3_float8",
|
||||
"__aos_to_soa3_int32",
|
||||
"__aos_to_soa4_float",
|
||||
"__aos_to_soa4_float1",
|
||||
"__aos_to_soa4_float16",
|
||||
"__aos_to_soa4_float4",
|
||||
"__aos_to_soa4_float8",
|
||||
@@ -351,10 +353,14 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__atomic_add_int64_global",
|
||||
"__atomic_add_uniform_int32_global",
|
||||
"__atomic_add_uniform_int64_global",
|
||||
"__atomic_add_varying_int32_global",
|
||||
"__atomic_add_varying_int64_global",
|
||||
"__atomic_and_int32_global",
|
||||
"__atomic_and_int64_global",
|
||||
"__atomic_and_uniform_int32_global",
|
||||
"__atomic_and_uniform_int64_global",
|
||||
"__atomic_and_varying_int32_global",
|
||||
"__atomic_and_varying_int64_global",
|
||||
"__atomic_compare_exchange_double_global",
|
||||
"__atomic_compare_exchange_float_global",
|
||||
"__atomic_compare_exchange_int32_global",
|
||||
@@ -363,18 +369,30 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__atomic_compare_exchange_uniform_float_global",
|
||||
"__atomic_compare_exchange_uniform_int32_global",
|
||||
"__atomic_compare_exchange_uniform_int64_global",
|
||||
"__atomic_compare_exchange_varying_double_global",
|
||||
"__atomic_compare_exchange_varying_float_global",
|
||||
"__atomic_compare_exchange_varying_int32_global",
|
||||
"__atomic_compare_exchange_varying_int64_global",
|
||||
"__atomic_max_uniform_int32_global",
|
||||
"__atomic_max_uniform_int64_global",
|
||||
"__atomic_min_uniform_int32_global",
|
||||
"__atomic_min_uniform_int64_global",
|
||||
"__atomic_max_varying_int32_global",
|
||||
"__atomic_max_varying_int64_global",
|
||||
"__atomic_min_varying_int32_global",
|
||||
"__atomic_min_varying_int64_global",
|
||||
"__atomic_or_int32_global",
|
||||
"__atomic_or_int64_global",
|
||||
"__atomic_or_uniform_int32_global",
|
||||
"__atomic_or_uniform_int64_global",
|
||||
"__atomic_or_varying_int32_global",
|
||||
"__atomic_or_varying_int64_global",
|
||||
"__atomic_sub_int32_global",
|
||||
"__atomic_sub_int64_global",
|
||||
"__atomic_sub_uniform_int32_global",
|
||||
"__atomic_sub_uniform_int64_global",
|
||||
"__atomic_sub_varying_int32_global",
|
||||
"__atomic_sub_varying_int64_global",
|
||||
"__atomic_swap_double_global",
|
||||
"__atomic_swap_float_global",
|
||||
"__atomic_swap_int32_global",
|
||||
@@ -383,14 +401,28 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__atomic_swap_uniform_float_global",
|
||||
"__atomic_swap_uniform_int32_global",
|
||||
"__atomic_swap_uniform_int64_global",
|
||||
"__atomic_swap_varying_double_global",
|
||||
"__atomic_swap_varying_float_global",
|
||||
"__atomic_swap_varying_int32_global",
|
||||
"__atomic_swap_varying_int64_global",
|
||||
"__atomic_umax_uniform_uint32_global",
|
||||
"__atomic_umax_uniform_uint64_global",
|
||||
"__atomic_umin_uniform_uint32_global",
|
||||
"__atomic_umin_uniform_uint64_global",
|
||||
"__atomic_umax_varying_uint32_global",
|
||||
"__atomic_umax_varying_uint64_global",
|
||||
"__atomic_umin_varying_uint32_global",
|
||||
"__atomic_umin_varying_uint64_global",
|
||||
"__atomic_xor_int32_global",
|
||||
"__atomic_xor_int64_global",
|
||||
"__atomic_xor_uniform_int32_global",
|
||||
"__atomic_xor_uniform_int64_global",
|
||||
"__atomic_xor_uniform_int32_global",
|
||||
"__atomic_xor_uniform_int64_global",
|
||||
"__atomic_xor_varying_int32_global",
|
||||
"__atomic_xor_varying_int64_global",
|
||||
"__atomic_xor_varying_int32_global",
|
||||
"__atomic_xor_varying_int64_global",
|
||||
"__broadcast_double",
|
||||
"__broadcast_float",
|
||||
"__broadcast_i16",
|
||||
@@ -413,6 +445,7 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__do_assert_uniform",
|
||||
"__do_assert_varying",
|
||||
"__do_print",
|
||||
"__do_print_nvptx",
|
||||
"__doublebits_uniform_int64",
|
||||
"__doublebits_varying_int64",
|
||||
"__exclusive_scan_add_double",
|
||||
@@ -427,6 +460,8 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__extract_int32",
|
||||
"__extract_int64",
|
||||
"__extract_int8",
|
||||
"__extract_float",
|
||||
"__extract_double",
|
||||
"__fastmath",
|
||||
"__float_to_half_uniform",
|
||||
"__float_to_half_varying",
|
||||
@@ -443,6 +478,8 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__insert_int32",
|
||||
"__insert_int64",
|
||||
"__insert_int8",
|
||||
"__insert_float",
|
||||
"__insert_double",
|
||||
"__intbits_uniform_double",
|
||||
"__intbits_uniform_float",
|
||||
"__intbits_varying_double",
|
||||
@@ -479,6 +516,7 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__min_varying_uint32",
|
||||
"__min_varying_uint64",
|
||||
"__movmsk",
|
||||
"__movmsk_ptx",
|
||||
"__new_uniform_32rt",
|
||||
"__new_uniform_64rt",
|
||||
"__new_varying32_32rt",
|
||||
@@ -560,11 +598,13 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__shuffle_i64",
|
||||
"__shuffle_i8",
|
||||
"__soa_to_aos3_float",
|
||||
"__soa_to_aos3_float1",
|
||||
"__soa_to_aos3_float16",
|
||||
"__soa_to_aos3_float4",
|
||||
"__soa_to_aos3_float8",
|
||||
"__soa_to_aos3_int32",
|
||||
"__soa_to_aos4_float",
|
||||
"__soa_to_aos4_float1",
|
||||
"__soa_to_aos4_float16",
|
||||
"__soa_to_aos4_float4",
|
||||
"__soa_to_aos4_float8",
|
||||
@@ -622,6 +662,24 @@ lSetInternalFunctions(llvm::Module *module) {
|
||||
"__vec4_add_int32",
|
||||
"__vselect_float",
|
||||
"__vselect_i32",
|
||||
"__program_index",
|
||||
"__program_count",
|
||||
"__warp_index",
|
||||
"__task_index0",
|
||||
"__task_index1",
|
||||
"__task_index2",
|
||||
"__task_index",
|
||||
"__task_count0",
|
||||
"__task_count1",
|
||||
"__task_count2",
|
||||
"__task_count",
|
||||
"__cvt_loc2gen",
|
||||
"__cvt_loc2gen_var",
|
||||
"__cvt_const2gen",
|
||||
"__puts_nvptx",
|
||||
"ISPCAlloc",
|
||||
"ISPCLaunch",
|
||||
"ISPCSync",
|
||||
};
|
||||
|
||||
int count = sizeof(names) / sizeof(names[0]);
|
||||
@@ -694,6 +752,7 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
|
||||
g->target->getISA() != Target::NEON16 &&
|
||||
g->target->getISA() != Target::NEON8)
|
||||
#endif // !__arm__
|
||||
if (g->target->getISA() != Target::NVPTX)
|
||||
{
|
||||
Assert(bcTriple.getArch() == llvm::Triple::UnknownArch ||
|
||||
mTriple.getArch() == bcTriple.getArch());
|
||||
@@ -855,7 +914,17 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
|
||||
// Next, add the target's custom implementations of the various needed
|
||||
// builtin functions (e.g. __masked_store_32(), etc).
|
||||
switch (g->target->getISA()) {
|
||||
|
||||
case Target::NVPTX:
|
||||
{
|
||||
if (runtime32) {
|
||||
fprintf(stderr, "Unforetunatly 32bit targets are supported at the moment .. \n");
|
||||
assert(0);
|
||||
}
|
||||
else {
|
||||
EXPORT_MODULE(builtins_bitcode_nvptx_64bit);
|
||||
}
|
||||
break;
|
||||
};
|
||||
#ifdef ISPC_ARM_ENABLED
|
||||
case Target::NEON8: {
|
||||
if (runtime32) {
|
||||
@@ -1125,7 +1194,14 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
|
||||
}
|
||||
|
||||
// define the 'programCount' builtin variable
|
||||
lDefineConstantInt("programCount", g->target->getVectorWidth(), module, symbolTable);
|
||||
if (g->target->getISA() != Target::NVPTX)
|
||||
{
|
||||
lDefineConstantInt("programCount", g->target->getVectorWidth(), module, symbolTable);
|
||||
}
|
||||
else
|
||||
{
|
||||
lDefineConstantInt("programCount", 32, module, symbolTable);
|
||||
}
|
||||
|
||||
// define the 'programIndex' builtin
|
||||
lDefineProgramIndex(module, symbolTable);
|
||||
@@ -1155,6 +1231,9 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
|
||||
lDefineConstantInt("__have_native_rcpd", g->target->hasRcpd(),
|
||||
module, symbolTable);
|
||||
|
||||
lDefineConstantInt("__is_nvptx_target", (int)(g->target->getISA() == Target::NVPTX),
|
||||
module, symbolTable);
|
||||
|
||||
if (g->forceAlignment != -1) {
|
||||
llvm::GlobalVariable *alignment = module->getGlobalVariable("memory_alignment", true);
|
||||
alignment->setInitializer(LLVMInt32(g->forceAlignment));
|
||||
|
||||
Reference in New Issue
Block a user