struct {
unsigned ptr_stride;
+ unsigned align_mul;
+ unsigned align_offset;
} cast;
};
case nir_deref_type_cast:
nderef->cast.ptr_stride = deref->cast.ptr_stride;
+ nderef->cast.align_mul = deref->cast.align_mul;
+ nderef->cast.align_offset = deref->cast.align_offset;
break;
default:
case nir_deref_type_cast:
hash = HASH(hash, instr->cast.ptr_stride);
+ hash = HASH(hash, instr->cast.align_mul);
+ hash = HASH(hash, instr->cast.align_offset);
break;
case nir_deref_type_var:
break;
case nir_deref_type_cast:
- if (deref1->cast.ptr_stride != deref2->cast.ptr_stride)
+ if (deref1->cast.ptr_stride != deref2->cast.ptr_stride ||
+ deref1->cast.align_mul != deref2->cast.align_mul ||
+ deref1->cast.align_offset != deref2->cast.align_offset)
return false;
break;
case nir_deref_type_cast:
write_src(ctx, &deref->parent);
blob_write_uint32(ctx->blob, deref->cast.ptr_stride);
+ blob_write_uint32(ctx->blob, deref->cast.align_mul);
+ blob_write_uint32(ctx->blob, deref->cast.align_offset);
if (!header.deref.cast_type_same_as_last) {
encode_type_to_blob(ctx->blob, deref->type);
ctx->last_type = deref->type;
case nir_deref_type_cast:
read_src(ctx, &deref->parent, &deref->instr);
deref->cast.ptr_stride = blob_read_uint32(ctx->blob);
+ deref->cast.align_mul = blob_read_uint32(ctx->blob);
+ deref->cast.align_offset = blob_read_uint32(ctx->blob);
if (header.deref.cast_type_same_as_last) {
deref->type = ctx->last_type;
} else {
/* We just validate that the type and mode are there */
validate_assert(state, instr->mode);
validate_assert(state, instr->type);
+ if (instr->cast.align_mul > 0) {
+ validate_assert(state, util_is_power_of_two_nonzero(instr->cast.align_mul));
+ validate_assert(state, instr->cast.align_offset < instr->cast.align_mul);
+ } else {
+ validate_assert(state, instr->cast.align_offset == 0);
+ }
} else {
/* We require the parent to be SSA. This may be lifted in the future */
validate_assert(state, instr->parent.is_ssa);