mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 05:11:19 +00:00 
			
		
		
		
	fast-jit: Fix const shift and const i64 compare issues (#2969)
This commit is contained in:
		
							parent
							
								
									286ea35508
								
							
						
					
					
						commit
						2ee013faf3
					
				|  | @ -4379,13 +4379,18 @@ cmp_r_r_to_r_i32(x86::Assembler &a, int32 reg_no_dst, int32 reg_no1_src, | |||
|  * @return true if success, false otherwise | ||||
|  */ | ||||
| static bool | ||||
| cmp_imm_imm_to_r_i64(x86::Assembler &a, int32 reg_no_dst, int32 data1_src, | ||||
|                      int32 data2_src) | ||||
| cmp_imm_imm_to_r_i64(x86::Assembler &a, int32 reg_no_dst, int64 data1_src, | ||||
|                      int64 data2_src) | ||||
| { | ||||
|     Imm imm(data1_src); | ||||
|     a.mov(regs_i64[REG_I64_FREE_IDX], imm); | ||||
|     imm.setValue(data2_src); | ||||
|     a.cmp(regs_i64[REG_I64_FREE_IDX], imm); | ||||
|     /* imm -> m64 */ | ||||
|     const JitHardRegInfo *hreg_info = jit_codegen_get_hreg_info(); | ||||
|     x86::Mem mem = x86::qword_ptr(regs_i64[hreg_info->exec_env_hreg_index], | ||||
|                                   offsetof(WASMExecEnv, jit_cache)); | ||||
|     Imm imm(data2_src); | ||||
|     mov_imm_to_m(a, mem, imm, 8); | ||||
| 
 | ||||
|     a.mov(regs_i64[REG_I64_FREE_IDX], data1_src); | ||||
|     a.cmp(regs_i64[REG_I64_FREE_IDX], mem); | ||||
|     (void)reg_no_dst; | ||||
|     return true; | ||||
| } | ||||
|  |  | |||
|  | @ -1066,13 +1066,15 @@ DEF_UNI_INT_CONST_OPS(shru) | |||
| static int32 | ||||
| do_i32_const_shl(int32 lhs, int32 rhs) | ||||
| { | ||||
|     rhs &= 31; | ||||
|     return (int32)((uint32)lhs << (uint32)rhs); | ||||
| } | ||||
| 
 | ||||
| static int64 | ||||
| do_i64_const_shl(int64 lhs, int64 rhs) | ||||
| { | ||||
|     return (int32)((uint64)lhs << (uint64)rhs); | ||||
|     rhs &= 63LL; | ||||
|     return (uint64)lhs << (uint64)rhs; | ||||
| } | ||||
| 
 | ||||
| DEF_BI_INT_CONST_OPS(shrs, >>) | ||||
|  | @ -1080,12 +1082,14 @@ DEF_BI_INT_CONST_OPS(shrs, >>) | |||
| static int32 | ||||
| do_i32_const_shru(int32 lhs, int32 rhs) | ||||
| { | ||||
|     rhs &= 31; | ||||
|     return (uint32)lhs >> rhs; | ||||
| } | ||||
| 
 | ||||
| static int64 | ||||
| do_i64_const_shru(int64 lhs, int64 rhs) | ||||
| { | ||||
|     rhs &= 63LL; | ||||
|     return (uint64)lhs >> rhs; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Wenyong Huang
						Wenyong Huang