}
static void assign_ssa_dest(struct lp_build_nir_context *bld_base, const nir_ssa_def *ssa,
- LLVMValueRef vals[4])
+ LLVMValueRef vals[NIR_MAX_VEC_COMPONENTS])
{
assign_ssa(bld_base, ssa->index, ssa->num_components == 1 ? vals[0] : lp_nir_array_build_gather_values(bld_base->base.gallivm->builder, vals, ssa->num_components));
}
static void assign_reg(struct lp_build_nir_context *bld_base, const nir_reg_dest *reg,
unsigned write_mask,
- LLVMValueRef vals[4])
+ LLVMValueRef vals[NIR_MAX_VEC_COMPONENTS])
{
struct hash_entry *entry = _mesa_hash_table_search(bld_base->regs, reg->reg);
LLVMValueRef reg_storage = (LLVMValueRef)entry->data;
bld_base->store_reg(bld_base, reg_bld, reg, write_mask ? write_mask : 0xf, indir_src, reg_storage, vals);
}
-static void assign_dest(struct lp_build_nir_context *bld_base, const nir_dest *dest, LLVMValueRef vals[4])
+static void assign_dest(struct lp_build_nir_context *bld_base, const nir_dest *dest, LLVMValueRef vals[NIR_MAX_VEC_COMPONENTS])
{
if (dest->is_ssa)
assign_ssa_dest(bld_base, &dest->ssa, vals);
assign_reg(bld_base, &dest->reg, 0, vals);
}
-static void assign_alu_dest(struct lp_build_nir_context *bld_base, const nir_alu_dest *dest, LLVMValueRef vals[4])
+static void assign_alu_dest(struct lp_build_nir_context *bld_base, const nir_alu_dest *dest, LLVMValueRef vals[NIR_MAX_VEC_COMPONENTS])
{
if (dest->dest.is_ssa)
assign_ssa_dest(bld_base, &dest->dest.ssa, vals);
static LLVMValueRef fcmp32(struct lp_build_nir_context *bld_base,
enum pipe_compare_func compare,
uint32_t src_bit_size,
- LLVMValueRef src[4])
+ LLVMValueRef src[NIR_MAX_VEC_COMPONENTS])
{
LLVMBuilderRef builder = bld_base->base.gallivm->builder;
struct lp_build_context *flt_bld = get_flt_bld(bld_base, src_bit_size);
enum pipe_compare_func compare,
bool is_unsigned,
uint32_t src_bit_size,
- LLVMValueRef src[4])
+ LLVMValueRef src[NIR_MAX_VEC_COMPONENTS])
{
LLVMBuilderRef builder = bld_base->base.gallivm->builder;
struct lp_build_context *i_bld = get_int_bld(bld_base, is_unsigned, src_bit_size);
}
static LLVMValueRef emit_b32csel(struct lp_build_nir_context *bld_base,
- unsigned src_bit_size[4],
- LLVMValueRef src[4])
+ unsigned src_bit_size[NIR_MAX_VEC_COMPONENTS],
+ LLVMValueRef src[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef sel = cast_type(bld_base, src[0], nir_type_int, 32);
LLVMValueRef v = lp_build_compare(bld_base->base.gallivm, bld_base->int_bld.type, PIPE_FUNC_NOTEQUAL, sel, bld_base->int_bld.zero);
}
static LLVMValueRef do_alu_action(struct lp_build_nir_context *bld_base,
- nir_op op, unsigned src_bit_size[4], LLVMValueRef src[4])
+ nir_op op, unsigned src_bit_size[NIR_MAX_VEC_COMPONENTS], LLVMValueRef src[NIR_MAX_VEC_COMPONENTS])
{
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
static void visit_alu(struct lp_build_nir_context *bld_base, const nir_alu_instr *instr)
{
struct gallivm_state *gallivm = bld_base->base.gallivm;
- LLVMValueRef src[4];
- unsigned src_bit_size[4];
+ LLVMValueRef src[NIR_MAX_VEC_COMPONENTS];
+ unsigned src_bit_size[NIR_MAX_VEC_COMPONENTS];
unsigned num_components = nir_dest_num_components(instr->dest.dest);
unsigned src_components;
switch (instr->op) {
src_bit_size[i] = nir_src_bit_size(instr->src[i].src);
}
- LLVMValueRef result[4];
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS];
if (instr->op == nir_op_vec4 || instr->op == nir_op_vec3 || instr->op == nir_op_vec2) {
for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
result[i] = cast_type(bld_base, src[i], nir_op_infos[instr->op].input_types[i], src_bit_size[i]);
}
} else {
for (unsigned c = 0; c < num_components; c++) {
- LLVMValueRef src_chan[4];
+ LLVMValueRef src_chan[NIR_MAX_VEC_COMPONENTS];
for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
if (num_components > 1) {
static void visit_load_const(struct lp_build_nir_context *bld_base,
const nir_load_const_instr *instr)
{
- LLVMValueRef result[4];
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS];
struct lp_build_context *int_bld = get_int_bld(bld_base, true, instr->def.bit_size);
for (unsigned i = 0; i < instr->def.num_components; i++)
result[i] = lp_build_const_int_vec(bld_base->base.gallivm, int_bld->type, instr->value[i].u64);
static void visit_load_var(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
nir_deref_instr *deref = nir_instr_as_deref(instr->src[0].ssa->parent_instr);
nir_variable *var = nir_deref_instr_get_variable(deref);
static void visit_load_ubo(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
static void visit_load_ssbo(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef idx = get_src(bld_base, instr->src[0]);
LLVMValueRef offset = get_src(bld_base, instr->src[1]);
static void visit_get_buffer_size(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef idx = get_src(bld_base, instr->src[0]);
result[0] = bld_base->get_buffer_size(bld_base, idx);
static void visit_ssbo_atomic(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef idx = get_src(bld_base, instr->src[0]);
LLVMValueRef offset = get_src(bld_base, instr->src[1]);
static void visit_load_image(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
static void visit_atomic_image(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
static void visit_image_size(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
nir_deref_instr *deref = nir_instr_as_deref(instr->src[0].ssa->parent_instr);
nir_variable *var = nir_deref_instr_get_variable(deref);
static void visit_shared_load(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef offset = get_src(bld_base, instr->src[0]);
bld_base->load_mem(bld_base, nir_dest_num_components(instr->dest), nir_dest_bit_size(instr->dest),
static void visit_shared_atomic(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef offset = get_src(bld_base, instr->src[0]);
LLVMValueRef val = get_src(bld_base, instr->src[1]);
}
static void visit_load_kernel_input(struct lp_build_nir_context *bld_base,
- nir_intrinsic_instr *instr, LLVMValueRef result[4])
+ nir_intrinsic_instr *instr, LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef offset = get_src(bld_base, instr->src[0]);
}
static void visit_load_global(struct lp_build_nir_context *bld_base,
- nir_intrinsic_instr *instr, LLVMValueRef result[4])
+ nir_intrinsic_instr *instr, LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef addr = get_src(bld_base, instr->src[0]);
bld_base->load_global(bld_base, nir_dest_num_components(instr->dest), nir_dest_bit_size(instr->dest),
static void visit_global_atomic(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
LLVMValueRef addr = get_src(bld_base, instr->src[0]);
LLVMValueRef val = get_src(bld_base, instr->src[1]);
static void visit_intrinsic(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr)
{
- LLVMValueRef result[4] = {0};
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS] = {0};
switch (instr->intrinsic) {
case nir_intrinsic_load_deref:
visit_load_var(bld_base, instr, result);
static void visit_txs(struct lp_build_nir_context *bld_base, nir_tex_instr *instr)
{
struct lp_sampler_size_query_params params;
- LLVMValueRef sizes_out[4];
+ LLVMValueRef sizes_out[NIR_MAX_VEC_COMPONENTS];
LLVMValueRef explicit_lod = NULL;
for (unsigned i = 0; i < instr->num_srcs; i++) {
unsigned sample_key = 0;
nir_deref_instr *texture_deref_instr = NULL;
nir_deref_instr *sampler_deref_instr = NULL;
- LLVMValueRef texel[4];
+ LLVMValueRef texel[NIR_MAX_VEC_COMPONENTS];
unsigned lod_src = 0;
LLVMValueRef coord_undef = LLVMGetUndef(bld_base->base.int_vec_type);
const nir_ssa_undef_instr *instr)
{
unsigned num_components = instr->def.num_components;
- LLVMValueRef undef[4];
+ LLVMValueRef undef[NIR_MAX_VEC_COMPONENTS];
for (unsigned i = 0; i < num_components; i++)
undef[i] = LLVMGetUndef(bld_base->base.vec_type);
assign_ssa_dest(bld_base, &instr->def, undef);
unsigned nc,
unsigned bit_size,
bool offset_is_uniform,
- LLVMValueRef index, LLVMValueRef offset, LLVMValueRef result[4]);
+ LLVMValueRef index, LLVMValueRef offset, LLVMValueRef result[NIR_MAX_VEC_COMPONENTS]);
void (*load_kernel_arg)(struct lp_build_nir_context *bld_base,
unsigned nc,
unsigned bit_size,
unsigned offset_bit_size,
bool offset_is_uniform,
- LLVMValueRef offset, LLVMValueRef result[4]);
+ LLVMValueRef offset, LLVMValueRef result[NIR_MAX_VEC_COMPONENTS]);
void (*load_global)(struct lp_build_nir_context *bld_base,
unsigned nc, unsigned bit_size,
unsigned offset_bit_size,
- LLVMValueRef offset, LLVMValueRef result[4]);
+ LLVMValueRef offset, LLVMValueRef result[NIR_MAX_VEC_COMPONENTS]);
void (*store_global)(struct lp_build_nir_context *bld_base,
unsigned writemask,
/* for SSBO and shared memory */
void (*load_mem)(struct lp_build_nir_context *bld_base,
unsigned nc, unsigned bit_size,
- LLVMValueRef index, LLVMValueRef offset, LLVMValueRef result[4]);
+ LLVMValueRef index, LLVMValueRef offset, LLVMValueRef result[NIR_MAX_VEC_COMPONENTS]);
void (*store_mem)(struct lp_build_nir_context *bld_base,
unsigned writemask, unsigned nc, unsigned bit_size,
LLVMValueRef index, LLVMValueRef offset, LLVMValueRef dst);
unsigned vertex_index,
unsigned const_index,
LLVMValueRef indir_index,
- LLVMValueRef result[4]);
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS]);
void (*store_var)(struct lp_build_nir_context *bld_base,
nir_variable_mode deref_mode,
unsigned bit_size,
unsigned writemask,
LLVMValueRef indir_src,
LLVMValueRef reg_storage,
- LLVMValueRef dst[4]);
+ LLVMValueRef dst[NIR_MAX_VEC_COMPONENTS]);
void (*emit_var_decl)(struct lp_build_nir_context *bld_base,
nir_variable *var);
void (*sysval_intrin)(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4]);
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS]);
void (*discard)(struct lp_build_nir_context *bld_base,
LLVMValueRef cond);
unsigned vertex_index,
unsigned const_index,
LLVMValueRef indir_index,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
int nc = reg->reg->num_components;
- LLVMValueRef vals[4];
+ LLVMValueRef vals[NIR_MAX_VEC_COMPONENTS];
struct lp_build_context *uint_bld = &bld_base->uint_bld;
if (reg->reg->num_array_elems) {
LLVMValueRef indirect_val = lp_build_const_int_vec(gallivm, uint_bld->type, reg->base_offset);
unsigned writemask,
LLVMValueRef indir_src,
LLVMValueRef reg_storage,
- LLVMValueRef dst[4])
+ LLVMValueRef dst[NIR_MAX_VEC_COMPONENTS])
{
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;
unsigned offset_bit_size,
bool offset_is_uniform,
LLVMValueRef offset,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;
unsigned bit_size,
unsigned addr_bit_size,
LLVMValueRef addr,
- LLVMValueRef outval[4])
+ LLVMValueRef outval[NIR_MAX_VEC_COMPONENTS])
{
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
bool offset_is_uniform,
LLVMValueRef index,
LLVMValueRef offset,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;
unsigned bit_size,
LLVMValueRef index,
LLVMValueRef offset,
- LLVMValueRef outval[4])
+ LLVMValueRef outval[NIR_MAX_VEC_COMPONENTS])
{
struct gallivm_state *gallivm = bld_base->base.gallivm;
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
static void emit_sysval_intrin(struct lp_build_nir_context *bld_base,
nir_intrinsic_instr *instr,
- LLVMValueRef result[4])
+ LLVMValueRef result[NIR_MAX_VEC_COMPONENTS])
{
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;