radeonsi: use a trick to extract and pack edgeflags using fewer instructions
This removes 4 instructions from the prim export packing. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12343>
This commit is contained in:
@@ -4627,13 +4627,11 @@ LLVMValueRef ac_pack_prim_export(struct ac_llvm_context *ctx, const struct ac_ng
|
||||
LLVMBuilderRef builder = ctx->builder;
|
||||
LLVMValueRef tmp = LLVMBuildZExt(builder, prim->isnull, ctx->i32, "");
|
||||
LLVMValueRef result = LLVMBuildShl(builder, tmp, LLVMConstInt(ctx->i32, 31, false), "");
|
||||
result = LLVMBuildOr(ctx->builder, result, prim->edgeflags, "");
|
||||
|
||||
for (unsigned i = 0; i < prim->num_vertices; ++i) {
|
||||
tmp = LLVMBuildShl(builder, prim->index[i], LLVMConstInt(ctx->i32, 10 * i, false), "");
|
||||
result = LLVMBuildOr(builder, result, tmp, "");
|
||||
tmp = LLVMBuildZExt(builder, prim->edgeflag[i], ctx->i32, "");
|
||||
tmp = LLVMBuildShl(builder, tmp, LLVMConstInt(ctx->i32, 10 * i + 9, false), "");
|
||||
result = LLVMBuildOr(builder, result, tmp, "");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user