[Mesa-dev] [PATCH 1/4] ac: create ac_unpack_64_2x32_split_x() helper
Timothy Arceri
tarceri at itsqueeze.com
Tue Feb 6 04:58:38 UTC 2018
This will be used in the following commits.
---
src/amd/common/ac_llvm_build.c | 8 ++++++++
src/amd/common/ac_llvm_build.h | 3 +++
src/amd/common/ac_nir_to_llvm.c | 6 +-----
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index a86ba962fa..6375b106f7 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1992,6 +1992,14 @@ LLVMValueRef ac_find_lsb(struct ac_llvm_context *ctx,
LLVMConstInt(ctx->i32, -1, 0), lsb, "");
}
+LLVMValueRef ac_unpack_64_2x32_split_x(struct ac_llvm_context *ctx,
+ LLVMValueRef src0)
+{
+ LLVMValueRef tmp = LLVMBuildBitCast(ctx->builder, src0,
+ ctx->v2i32, "");
+ return LLVMBuildExtractElement(ctx->builder, tmp, ctx->i32_0, "");
+}
+
LLVMTypeRef ac_array_in_const_addr_space(LLVMTypeRef elem_type)
{
return LLVMPointerType(LLVMArrayType(elem_type, 0),
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index 47c843fb4b..78991b3e99 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -348,6 +348,9 @@ LLVMValueRef ac_find_lsb(struct ac_llvm_context *ctx,
LLVMTypeRef dst_type,
LLVMValueRef src0);
+LLVMValueRef ac_unpack_64_2x32_split_x(struct ac_llvm_context *ctx,
+ LLVMValueRef src0);
+
LLVMTypeRef ac_array_in_const_addr_space(LLVMTypeRef elem_type);
#ifdef __cplusplus
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 9a9db2dce9..ac4af12b3e 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -2042,11 +2042,7 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
case nir_op_unpack_64_2x32_split_x: {
assert(instr->src[0].src.ssa->num_components == 1);
- LLVMValueRef tmp = LLVMBuildBitCast(ctx->ac.builder, src[0],
- ctx->ac.v2i32,
- "");
- result = LLVMBuildExtractElement(ctx->ac.builder, tmp,
- ctx->ac.i32_0, "");
+ result = ac_unpack_64_2x32_split_x(&ctx->ac, src[0]);
break;
}
--
2.14.3
More information about the mesa-dev
mailing list