Lines Matching defs:lc

1254 write_load_const(write_ctx *ctx, const nir_load_const_instr *lc)
1256 assert(lc->def.num_components >= 1 && lc->def.num_components <= 16);
1260 header.load_const.instr_type = lc->instr.type;
1261 header.load_const.last_component = lc->def.num_components - 1;
1262 header.load_const.bit_size = encode_bit_size_3bits(lc->def.bit_size);
1266 if (lc->def.num_components == 1) {
1267 switch (lc->def.bit_size) {
1269 if ((lc->value[0].u64 & 0x1fffffffffffull) == 0) {
1272 header.load_const.packed_value = lc->value[0].u64 >> 45;
1273 } else if (((lc->value[0].i64 << 45) >> 45) == lc->value[0].i64) {
1276 header.load_const.packed_value = lc->value[0].u64;
1281 if ((lc->value[0].u32 & 0x1fff) == 0) {
1283 header.load_const.packed_value = lc->value[0].u32 >> 13;
1284 } else if (((lc->value[0].i32 << 13) >> 13) == lc->value[0].i32) {
1286 header.load_const.packed_value = lc->value[0].u32;
1292 header.load_const.packed_value = lc->value[0].u16;
1296 header.load_const.packed_value = lc->value[0].u8;
1300 header.load_const.packed_value = lc->value[0].b;
1310 switch (lc->def.bit_size) {
1312 blob_write_bytes(ctx->blob, lc->value,
1313 sizeof(*lc->value) * lc->def.num_components);
1317 for (unsigned i = 0; i < lc->def.num_components; i++)
1318 blob_write_uint32(ctx->blob, lc->value[i].u32);
1322 for (unsigned i = 0; i < lc->def.num_components; i++)
1323 blob_write_uint16(ctx->blob, lc->value[i].u16);
1327 assert(lc->def.bit_size <= 8);
1328 for (unsigned i = 0; i < lc->def.num_components; i++)
1329 blob_write_uint8(ctx->blob, lc->value[i].u8);
1334 write_add_object(ctx, &lc->def);
1340 nir_load_const_instr *lc =
1346 switch (lc->def.bit_size) {
1348 lc->value[0].u64 = (uint64_t)header.load_const.packed_value << 45;
1351 lc->value[0].u32 = (uint64_t)header.load_const.packed_value << 13;
1359 switch (lc->def.bit_size) {
1361 lc->value[0].i64 = ((int64_t)header.load_const.packed_value << 45) >> 45;
1364 lc->value[0].i32 = ((int32_t)header.load_const.packed_value << 13) >> 13;
1367 lc->value[0].u16 = header.load_const.packed_value;
1370 lc->value[0].u8 = header.load_const.packed_value;
1373 lc->value[0].b = header.load_const.packed_value;
1381 switch (lc->def.bit_size) {
1383 blob_copy_bytes(ctx->blob, lc->value, sizeof(*lc->value) * lc->def.num_components);
1387 for (unsigned i = 0; i < lc->def.num_components; i++)
1388 lc->value[i].u32 = blob_read_uint32(ctx->blob);
1392 for (unsigned i = 0; i < lc->def.num_components; i++)
1393 lc->value[i].u16 = blob_read_uint16(ctx->blob);
1397 assert(lc->def.bit_size <= 8);
1398 for (unsigned i = 0; i < lc->def.num_components; i++)
1399 lc->value[i].u8 = blob_read_uint8(ctx->blob);
1405 read_add_object(ctx, &lc->def);
1406 return lc;