|
From: | Richard Henderson |
Subject: | Re: [PATCH v5 16/30] tcg/loongarch64: Implement shl/shr/sar/rotl/rotr ops |
Date: | Sat, 25 Sep 2021 10:09:44 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
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~
[Prev in Thread] | Current Thread | [Next in Thread] |