Fix aot rotl/rotr 0 issue

This commit is contained in:
Wenyong Huang 2022-07-11 21:33:09 +08:00
parent db210fbc66
commit a3f16871ed

View File

@ -690,6 +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;
/* Calculate (bits - shif_count) */ /* Calculate (bits - shif_count) */