assert(num_dsts <= LP_MAX_VECTOR_LENGTH);
tmp_type = src_type;
- for(i = 0; i < num_srcs; ++i)
+ for(i = 0; i < num_srcs; ++i) {
+ assert(lp_check_value(src_type, src[i]));
tmp[i] = src[i];
+ }
num_tmps = num_srcs;
/*
/*
* Truncate or expand bit width
+ *
+ * No data conversion should happen here, although the sign bits are
+ * crucial to avoid bad clamping.
*/
- assert(!tmp_type.floating || tmp_type.width == dst_type.width);
+ {
+ struct lp_type new_type;
- lp_build_resize(builder, tmp_type, dst_type, tmp, num_srcs, tmp, num_dsts);
+ new_type = tmp_type;
+ new_type.sign = dst_type.sign;
+ new_type.width = dst_type.width;
+ new_type.length = dst_type.length;
- tmp_type.width = dst_type.width;
- tmp_type.length = dst_type.length;
- num_tmps = num_dsts;
+ lp_build_resize(builder, tmp_type, new_type, tmp, num_srcs, tmp, num_dsts);
+
+ tmp_type = new_type;
+ num_tmps = num_dsts;
+ }
/*
* Scale to the widest range
}
}
- for(i = 0; i < num_dsts; ++i)
+ for(i = 0; i < num_dsts; ++i) {
dst[i] = tmp[i];
+ assert(lp_check_value(dst_type, dst[i]));
+ }
}