On 9/25/21 6:05 AM, Philippe Mathieu-Daudé wrote:
+    case INDEX_op_shl_i32:
+        if (c2) {

Why can't we use:

                tcg_debug_assert(a2 <= 0x1f);
                tcg_out_opc_slli_w(s, a0, a1, a2);

?

Because tcg/optimize.c can produce out-of-range values.
We have this same masking in tcg/sparc/ starting as far back as 1fd95946657.

Officially, the tcg backend generator must accept this, with UNSPECIFIED behaviour. Generally, such out-of-range shifts will be followed by a conditional move that overwrites the undefined result. The tcg backend is not allowed to trap or assert.


r~

Reply via email to