Lines Matching defs:header

516 write_src_full(write_ctx *ctx, const nir_src *src, union packed_src header)
524 header.any.is_ssa = src->is_ssa;
526 header.any.object_idx = write_lookup_object(ctx, src->ssa);
527 blob_write_uint32(ctx->blob, header.u32);
529 header.any.object_idx = write_lookup_object(ctx, src->reg.reg);
530 header.any.is_indirect = !!src->reg.indirect;
531 blob_write_uint32(ctx->blob, header.u32);
534 union packed_src header = {0};
535 write_src_full(ctx, src->reg.indirect, header);
543 union packed_src header = {0};
544 write_src_full(ctx, src, header);
551 union packed_src header;
552 header.u32 = blob_read_uint32(ctx->blob);
554 src->is_ssa = header.any.is_ssa;
556 src->ssa = read_lookup_object(ctx, header.any.object_idx);
558 src->reg.reg = read_lookup_object(ctx, header.any.object_idx);
560 if (header.any.is_indirect) {
567 return header;
628 /* Scalarized ALUs always have the same header. */
690 write_dest(write_ctx *ctx, const nir_dest *dst, union packed_instr header,
706 header.any.dest = dest.u8;
708 /* Check if the current ALU instruction has the same header as the previous
710 * the current header. This is a typical occurence after scalarization.
726 * sharing the same header.
729 header.u32 == clean_header.u32) {
740 blob_overwrite_uint32(ctx->blob, ctx->last_alu_header_offset, header.u32);
741 ctx->last_alu_header = header.u32;
744 blob_write_uint32(ctx->blob, header.u32);
763 union packed_instr header)
766 dest.u8 = header.any.dest;
830 union packed_instr header;
831 header.u32 = 0;
833 header.alu.instr_type = alu->instr.type;
834 header.alu.exact = alu->exact;
835 header.alu.no_signed_wrap = alu->no_signed_wrap;
836 header.alu.no_unsigned_wrap = alu->no_unsigned_wrap;
837 header.alu.saturate = alu->dest.saturate;
838 header.alu.op = alu->op;
839 header.alu.packed_src_ssa_16bit = is_alu_src_ssa_16bit(ctx, alu);
841 if (header.alu.packed_src_ssa_16bit &&
844 header.alu.writemask_or_two_swizzles = alu->src[0].swizzle[0];
846 header.alu.writemask_or_two_swizzles |= alu->src[1].swizzle[0] << 2;
849 header.alu.writemask_or_two_swizzles = alu->dest.write_mask;
852 write_dest(ctx, &alu->dest.dest, header, alu->instr.type);
857 if (header.alu.packed_src_ssa_16bit) {
902 read_alu(read_ctx *ctx, union packed_instr header)
904 unsigned num_srcs = nir_op_infos[header.alu.op].num_inputs;
905 nir_alu_instr *alu = nir_alu_instr_create(ctx->nir, header.alu.op);
907 alu->exact = header.alu.exact;
908 alu->no_signed_wrap = header.alu.no_signed_wrap;
909 alu->no_unsigned_wrap = header.alu.no_unsigned_wrap;
910 alu->dest.saturate = header.alu.saturate;
912 read_dest(ctx, &alu->dest.dest, &alu->instr, header);
919 alu->dest.write_mask = header.alu.writemask_or_two_swizzles;
924 if (header.alu.packed_src_ssa_16bit) {
968 if (header.alu.packed_src_ssa_16bit &&
970 alu->src[0].swizzle[0] = header.alu.writemask_or_two_swizzles & 0x3;
972 alu->src[1].swizzle[0] = header.alu.writemask_or_two_swizzles >> 2;
1024 union packed_instr header;
1025 header.u32 = 0;
1027 header.deref.instr_type = deref->instr.type;
1028 header.deref.deref_type = deref->deref_type;
1031 header.deref.modes = encode_deref_modes(deref->modes);
1032 header.deref.cast_type_same_as_last = deref->type == ctx->last_type;
1039 header.deref_var.object_idx = var_idx;
1044 header.deref.packed_src_ssa_16bit =
1048 header.deref.in_bounds = deref->arr.in_bounds;
1051 write_dest(ctx, &deref->dest, header, deref->instr.type);
1055 if (!header.deref_var.object_idx)
1066 if (header.deref.packed_src_ssa_16bit) {
1082 if (!header.deref.cast_type_same_as_last) {
1098 read_deref(read_ctx *ctx, union packed_instr header)
1100 nir_deref_type deref_type = header.deref.deref_type;
1103 read_dest(ctx, &deref->dest, &deref->instr, header);
1109 if (header.deref_var.object_idx)
1110 deref->var = read_lookup_object(ctx, header.deref_var.object_idx);
1126 if (header.deref.packed_src_ssa_16bit) {
1136 deref->arr.in_bounds = header.deref.in_bounds;
1150 if (header.deref.cast_type_same_as_last) {
1171 deref->modes = decode_deref_modes(header.deref.modes);
1189 union packed_instr header;
1190 header.u32 = 0;
1192 header.intrinsic.instr_type = intrin->instr.type;
1193 header.intrinsic.intrinsic = intrin->intrinsic;
1204 header.intrinsic.const_indices_encoding = const_indices_all_combined;
1209 header.intrinsic.packed_const_indices |=
1213 header.intrinsic.const_indices_encoding = const_indices_8bit;
1215 header.intrinsic.const_indices_encoding = const_indices_16bit;
1217 header.intrinsic.const_indices_encoding = const_indices_32bit;
1221 write_dest(ctx, &intrin->dest, header, intrin->instr.type);
1223 blob_write_uint32(ctx->blob, header.u32);
1229 switch (header.intrinsic.const_indices_encoding) {
1247 read_intrinsic(read_ctx *ctx, union packed_instr header)
1249 nir_intrinsic_op op = header.intrinsic.intrinsic;
1256 read_dest(ctx, &intrin->dest, &intrin->instr, header);
1277 switch (header.intrinsic.const_indices_encoding) {
1283 (header.intrinsic.packed_const_indices >> (i * bit_size)) &
1310 union packed_instr header;
1311 header.u32 = 0;
1313 header.load_const.instr_type = lc->instr.type;
1314 header.load_const.last_component = lc->def.num_components - 1;
1315 header.load_const.bit_size = encode_bit_size_3bits(lc->def.bit_size);
1316 header.load_const.packing = load_const_full;
1318 /* Try to pack 1-component constants into the 19 free bits in the header. */
1324 header.load_const.packing = load_const_scalar_hi_19bits;
1325 header.load_const.packed_value = lc->value[0].u64 >> 45;
1328 header.load_const.packing = load_const_scalar_lo_19bits_sext;
1329 header.load_const.packed_value = lc->value[0].u64;
1335 header.load_const.packing = load_const_scalar_hi_19bits;
1336 header.load_const.packed_value = lc->value[0].u32 >> 13;
1338 header.load_const.packing = load_const_scalar_lo_19bits_sext;
1339 header.load_const.packed_value = lc->value[0].u32;
1344 header.load_const.packing = load_const_scalar_lo_19bits_sext;
1345 header.load_const.packed_value = lc->value[0].u16;
1348 header.load_const.packing = load_const_scalar_lo_19bits_sext;
1349 header.load_const.packed_value = lc->value[0].u8;
1352 header.load_const.packing = load_const_scalar_lo_19bits_sext;
1353 header.load_const.packed_value = lc->value[0].b;
1360 blob_write_uint32(ctx->blob, header.u32);
1362 if (header.load_const.packing == load_const_full) {
1391 read_load_const(read_ctx *ctx, union packed_instr header)
1394 nir_load_const_instr_create(ctx->nir, header.load_const.last_component + 1,
1395 decode_bit_size_3bits(header.load_const.bit_size));
1398 switch (header.load_const.packing) {
1402 lc->value[0].u64 = (uint64_t)header.load_const.packed_value << 45;
1405 lc->value[0].u32 = (uint64_t)header.load_const.packed_value << 13;
1415 lc->value[0].i64 = ((int64_t)header.load_const.packed_value << 45) >> 45;
1418 lc->value[0].i32 = ((int32_t)header.load_const.packed_value << 13) >> 13;
1421 lc->value[0].u16 = header.load_const.packed_value;
1424 lc->value[0].u8 = header.load_const.packed_value;
1427 lc->value[0].b = header.load_const.packed_value;
1468 union packed_instr header;
1469 header.u32 = 0;
1471 header.undef.instr_type = undef->instr.type;
1472 header.undef.last_component = undef->def.num_components - 1;
1473 header.undef.bit_size = encode_bit_size_3bits(undef->def.bit_size);
1475 blob_write_uint32(ctx->blob, header.u32);
1480 read_ssa_undef(read_ctx *ctx, union packed_instr header)
1483 nir_ssa_undef_instr_create(ctx->nir, header.undef.last_component + 1,
1484 decode_bit_size_3bits(header.undef.bit_size));
1516 union packed_instr header;
1517 header.u32 = 0;
1519 header.tex.instr_type = tex->instr.type;
1520 header.tex.num_srcs = tex->num_srcs;
1521 header.tex.op = tex->op;
1523 write_dest(ctx, &tex->dest, header, tex->instr.type);
1555 read_tex(read_ctx *ctx, union packed_instr header)
1557 nir_tex_instr *tex = nir_tex_instr_create(ctx->nir, header.tex.num_srcs);
1559 read_dest(ctx, &tex->dest, &tex->instr, header);
1561 tex->op = header.tex.op;
1592 union packed_instr header;
1593 header.u32 = 0;
1595 header.phi.instr_type = phi->instr.type;
1596 header.phi.num_srcs = exec_list_length(&phi->srcs);
1603 write_dest(ctx, &phi->dest, header, phi->instr.type);
1633 read_phi(read_ctx *ctx, nir_block *blk, union packed_instr header)
1637 read_dest(ctx, &phi->dest, &phi->instr, header);
1649 for (unsigned i = 0; i < header.phi.num_srcs; i++) {
1692 union packed_instr header;
1693 header.u32 = 0;
1695 header.jump.instr_type = jmp->instr.type;
1696 header.jump.type = jmp->type;
1698 blob_write_uint32(ctx->blob, header.u32);
1702 read_jump(read_ctx *ctx, union packed_instr header)
1705 assert(header.jump.type != nir_jump_goto &&
1706 header.jump.type != nir_jump_goto_if);
1708 nir_jump_instr *jmp = nir_jump_instr_create(ctx->nir, header.jump.type);
1780 union packed_instr header;
1781 header.u32 = blob_read_uint32(ctx->blob);
1784 switch (header.any.instr_type) {
1786 for (unsigned i = 0; i <= header.alu.num_followup_alu_sharing_header; i++)
1787 nir_instr_insert_after_block(block, &read_alu(ctx, header)->instr);
1788 return header.alu.num_followup_alu_sharing_header + 1;
1790 instr = &read_deref(ctx, header)->instr;
1793 instr = &read_intrinsic(ctx, header)->instr;
1796 instr = &read_load_const(ctx, header)->instr;
1799 instr = &read_ssa_undef(ctx, header)->instr;
1802 instr = &read_tex(ctx, header)->instr;
1810 read_phi(ctx, block, header);
1813 instr = &read_jump(ctx, header)->instr;