mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-07-15 08:48:33 +00:00
mask right with 31/63 first
This commit is contained in:
parent
8bd5d5d2ef
commit
e9409066c2
|
@ -690,13 +690,12 @@ compile_int_rot(AOTCompContext *comp_ctx, LLVMValueRef left, LLVMValueRef right,
|
||||||
LLVMValueRef bits_minus_shift_count, res, tmp_l, tmp_r;
|
LLVMValueRef bits_minus_shift_count, res, tmp_l, tmp_r;
|
||||||
char *name = is_rotl ? "rotl" : "rotr";
|
char *name = is_rotl ? "rotl" : "rotr";
|
||||||
|
|
||||||
/* right is 0 */
|
|
||||||
if (LLVMIsConstant(right) && (uint64)LLVMConstIntGetZExtValue(right) == 0) {
|
|
||||||
return left;
|
|
||||||
}
|
|
||||||
|
|
||||||
SHIFT_COUNT_MASK;
|
SHIFT_COUNT_MASK;
|
||||||
|
|
||||||
|
/* rotl/rotr with 0 */
|
||||||
|
if (IS_CONST_ZERO(right))
|
||||||
|
return left;
|
||||||
|
|
||||||
/* Calculate (bits - shif_count) */
|
/* Calculate (bits - shif_count) */
|
||||||
LLVM_BUILD_OP(Sub, is_i32 ? I32_32 : I64_64, right, bits_minus_shift_count,
|
LLVM_BUILD_OP(Sub, is_i32 ? I32_32 : I64_64, right, bits_minus_shift_count,
|
||||||
"bits_minus_shift_count", NULL);
|
"bits_minus_shift_count", NULL);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user