aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-02-09 15:01:35 -0500
committerNicolai Hähnle <[email protected]>2016-03-21 15:34:23 -0500
commit136686a51dd5f92c3905253d7abf7ad40f717016 (patch)
treedf2a3b36c2f17ff3b671bdd1960e88341a35c5b6 /src
parent02bd0cd7b108dd903ae40af1f70a36f7553bfa7e (diff)
radeonsi: extract the LLVM type name construction into its own function
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 04f4aa98e99..fd43e2ace3d 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2691,6 +2691,23 @@ static LLVMValueRef get_buffer_size(
return size;
}
+/**
+ * Given the i32 or vNi32 \p type, generate the textual name (e.g. for use with
+ * intrinsic names).
+ */
+static void build_int_type_name(
+ LLVMTypeRef type,
+ char *buf, unsigned bufsize)
+{
+ assert(bufsize >= 6);
+
+ if (LLVMGetTypeKind(type) == LLVMVectorTypeKind)
+ snprintf(buf, bufsize, "v%ui32",
+ LLVMGetVectorSize(type));
+ else
+ strcpy(buf, "i32");
+}
+
static void build_tex_intrinsic(const struct lp_build_tgsi_action *action,
struct lp_build_tgsi_context *bld_base,
struct lp_build_emit_data *emit_data);
@@ -3355,14 +3372,9 @@ static void build_tex_intrinsic(const struct lp_build_tgsi_action *action,
return;
}
- if (LLVMGetTypeKind(LLVMTypeOf(emit_data->args[0])) == LLVMVectorTypeKind)
- sprintf(type, ".v%ui32",
- LLVMGetVectorSize(LLVMTypeOf(emit_data->args[0])));
- else
- strcpy(type, ".i32");
-
/* Add the type and suffixes .c, .o if needed. */
- sprintf(intr_name, "%s%s%s%s%s",
+ build_int_type_name(LLVMTypeOf(emit_data->args[0]), type, sizeof(type));
+ sprintf(intr_name, "%s%s%s%s.%s",
name, is_shadow ? ".c" : "", infix,
has_offset ? ".o" : "", type);