radeon/llvm: Set the target triple on the module
authorTom Stellard <thomas.stellard@amd.com>
Thu, 4 Feb 2016 02:34:55 +0000 (02:34 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 17 Feb 2016 19:06:41 +0000 (19:06 +0000)
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/r600/r600_llvm.c
src/gallium/drivers/radeon/radeon_llvm.h
src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
src/gallium/drivers/radeonsi/si_shader.c

index 0fe7c74418d49d694223bfd472d4b6dcc120d5a6..981bb12f90076f24fd3dd8a00f9f199207be4574 100644 (file)
@@ -784,7 +784,7 @@ LLVMModuleRef r600_tgsi_llvm(
 {
        struct tgsi_shader_info shader_info;
        struct lp_build_tgsi_context * bld_base = &ctx->soa.bld_base;
-       radeon_llvm_context_init(ctx);
+       radeon_llvm_context_init(ctx, "r600--");
        LLVMTypeRef Arguments[32];
        unsigned ArgumentsCount = 0;
        for (unsigned i = 0; i < ctx->inputs_count; i++)
index e967ad2214e850255e3372ef5bfc9e3a3d589624..9f7d03909e963b5a5edf68104b1df93252b1dcc6 100644 (file)
@@ -158,7 +158,8 @@ void radeon_llvm_emit_prepare_cube_coords(struct lp_build_tgsi_context * bld_bas
                                          LLVMValueRef *coords_arg,
                                          LLVMValueRef *derivs_arg);
 
-void radeon_llvm_context_init(struct radeon_llvm_context * ctx);
+void radeon_llvm_context_init(struct radeon_llvm_context * ctx,
+                              const char *triple);
 
 void radeon_llvm_create_func(struct radeon_llvm_context * ctx,
                              LLVMTypeRef *ParamTypes, unsigned ParamCount);
index f5e3f6af1a07cb9e3a5ab818560cbd85b556cd26..73bc84988c4760960156f61ca2d3896648c33bd0 100644 (file)
@@ -1520,7 +1520,7 @@ static void emit_up2h(const struct lp_build_tgsi_action *action,
        }
 }
 
-void radeon_llvm_context_init(struct radeon_llvm_context * ctx)
+void radeon_llvm_context_init(struct radeon_llvm_context * ctx, const char *triple)
 {
        struct lp_type type;
 
@@ -1534,6 +1534,13 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx)
        ctx->gallivm.context = LLVMContextCreate();
        ctx->gallivm.module = LLVMModuleCreateWithNameInContext("tgsi",
                                                ctx->gallivm.context);
+       LLVMSetTarget(ctx->gallivm.module,
+
+#if HAVE_LLVM < 0x0306
+                       "r600--");
+#else
+                       triple);
+#endif
        ctx->gallivm.builder = LLVMCreateBuilderInContext(ctx->gallivm.context);
 
        struct lp_build_tgsi_context * bld_base = &ctx->soa.bld_base;
index 19c427a1bb9160860a6c855f038dd6626e595b44..d1482de209d101803d5581a3d6021a81437211c0 100644 (file)
@@ -4323,7 +4323,7 @@ static void si_init_shader_ctx(struct si_shader_context *ctx,
        struct lp_build_tgsi_context *bld_base;
 
        memset(ctx, 0, sizeof(*ctx));
-       radeon_llvm_context_init(&ctx->radeon_bld);
+       radeon_llvm_context_init(&ctx->radeon_bld, "amdgcn--");
        ctx->tm = tm;
        ctx->screen = sscreen;
        if (shader && shader->selector)