tcg/optimize: Change representation of s_mask
authorRichard Henderson <richard.henderson@linaro.org>
Sun, 22 Dec 2024 05:08:10 +0000 (21:08 -0800)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 24 Dec 2024 15:32:51 +0000 (07:32 -0800)
commit6d70ddc6350361c38e7720d1ffc594e5cc648900
tree859960ff5a2f64ac469656758c01fde583993fce
parent75c3bf324d21f8f57be1349007b0252ae64b4c51
tcg/optimize: Change representation of s_mask

Change the representation from sign bit repetitions to all bits equal
to the sign bit, including the sign bit itself.

The previous format has a problem in that it is difficult to recreate
a valid sign mask after a shift operation: the "repetitions" part of
the previous format meant that applying the same shift as for the value
lead to an off-by-one value.

The new format, including the sign bit itself, means that the sign mask
can be manipulated in exactly the same way as the value, canonicalization
is easier.

Canonicalize the s_mask in fold_masks_zs, rather than requiring callers
to do so.  Treat 0 as a non-canonical but typeless input for no sign
information, which will be reset as appropriate for the data type.
We can easily fold in the data from z_mask while canonicalizing.

Temporarily disable optimizations using s_mask while each operation is
converted to use fold_masks_zs and to the new form.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/optimize.c