aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-07-25 11:17:48 +0200
committerMarek Olšák <[email protected]>2015-07-31 16:49:16 +0200
commit0c805b6240769891d55db601f91b8dd84d69d43d (patch)
tree4bd4d2a3d785d24dabdd8791cc90bd18a4edd9f0 /src/gallium/auxiliary
parent488a83637fe726d445775ee301e42003f749cb9f (diff)
gallivm: add LLVMAttribute parameter to lp_build_intrinsic
This will help remove some duplicated code from radeon. Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.c6
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_intr.c12
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_intr.h3
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_logic.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.c2
5 files changed, 15 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 1d327ce48a9..50ae192325b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -1717,7 +1717,7 @@ lp_build_round_sse41(struct lp_build_context *bld,
args[2] = LLVMConstInt(i32t, mode, 0);
res = lp_build_intrinsic(builder, intrinsic,
- vec_type, args, Elements(args));
+ vec_type, args, Elements(args), 0);
res = LLVMBuildExtractElement(builder, res, index0, "");
}
@@ -3547,7 +3547,7 @@ lp_build_fpstate_get(struct gallivm_state *gallivm)
lp_build_intrinsic(builder,
"llvm.x86.sse.stmxcsr",
LLVMVoidTypeInContext(gallivm->context),
- &mxcsr_ptr8, 1);
+ &mxcsr_ptr8, 1, 0);
return mxcsr_ptr;
}
return 0;
@@ -3594,6 +3594,6 @@ lp_build_fpstate_set(struct gallivm_state *gallivm,
lp_build_intrinsic(builder,
"llvm.x86.sse.ldmxcsr",
LLVMVoidTypeInContext(gallivm->context),
- &mxcsr_ptr, 1);
+ &mxcsr_ptr, 1, 0);
}
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.c b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
index 2bf1211bcd7..30f4863ec44 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_intr.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
@@ -81,7 +81,8 @@ lp_build_intrinsic(LLVMBuilderRef builder,
const char *name,
LLVMTypeRef ret_type,
LLVMValueRef *args,
- unsigned num_args)
+ unsigned num_args,
+ LLVMAttribute attr)
{
LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
LLVMValueRef function;
@@ -99,6 +100,9 @@ lp_build_intrinsic(LLVMBuilderRef builder,
}
function = lp_declare_intrinsic(module, name, ret_type, arg_types, num_args);
+
+ if (attr)
+ LLVMAddFunctionAttr(function, attr);
}
return LLVMBuildCall(builder, function, args, num_args, "");
@@ -111,7 +115,7 @@ lp_build_intrinsic_unary(LLVMBuilderRef builder,
LLVMTypeRef ret_type,
LLVMValueRef a)
{
- return lp_build_intrinsic(builder, name, ret_type, &a, 1);
+ return lp_build_intrinsic(builder, name, ret_type, &a, 1, 0);
}
@@ -127,7 +131,7 @@ lp_build_intrinsic_binary(LLVMBuilderRef builder,
args[0] = a;
args[1] = b;
- return lp_build_intrinsic(builder, name, ret_type, args, 2);
+ return lp_build_intrinsic(builder, name, ret_type, args, 2, 0);
}
@@ -242,7 +246,7 @@ lp_build_intrinsic_map(struct gallivm_state *gallivm,
LLVMValueRef res_elem;
for(j = 0; j < num_args; ++j)
arg_elems[j] = LLVMBuildExtractElement(builder, args[j], index, "");
- res_elem = lp_build_intrinsic(builder, name, ret_elem_type, arg_elems, num_args);
+ res_elem = lp_build_intrinsic(builder, name, ret_elem_type, arg_elems, num_args, 0);
res = LLVMBuildInsertElement(builder, res, res_elem, index, "");
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.h b/src/gallium/auxiliary/gallivm/lp_bld_intr.h
index 38c5c29c980..a54b367961a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_intr.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.h
@@ -59,7 +59,8 @@ lp_build_intrinsic(LLVMBuilderRef builder,
const char *name,
LLVMTypeRef ret_type,
LLVMValueRef *args,
- unsigned num_args);
+ unsigned num_args,
+ LLVMAttribute attr);
LLVMValueRef
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
index 80b53e5c3f8..19d30d0d63c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
@@ -395,7 +395,7 @@ lp_build_select(struct lp_build_context *bld,
args[2] = mask;
res = lp_build_intrinsic(builder, intrinsic,
- arg_type, args, Elements(args));
+ arg_type, args, Elements(args), 0);
if (arg_type != bld->vec_type) {
res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
index 1887956d1c4..c4ae30461cb 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
@@ -104,7 +104,7 @@ lp_build_tgsi_intrinsic(
struct lp_build_context * base = &bld_base->base;
emit_data->output[emit_data->chan] = lp_build_intrinsic(
base->gallivm->builder, action->intr_name,
- emit_data->dst_type, emit_data->args, emit_data->arg_count);
+ emit_data->dst_type, emit_data->args, emit_data->arg_count, 0);
}
LLVMValueRef