@@ -1207,6 +1207,126 @@ mov_r_to_r_f64(x86::Assembler &a, int32 reg_no_dst, int32 reg_no_src)
12071207
12081208/* Let compiler do the conversation job as much as possible */
12091209
1210+ /* *
1211+ * Encoding convert int8 immediate data to int32 register
1212+ *
1213+ * @param a the assembler to emit the code
1214+ * @param reg_no the dst register, need to be converted to int32
1215+ * @param data the src int8 immediate data
1216+ *
1217+ * @return true if success, false otherwise
1218+ */
1219+ static bool
1220+ convert_imm_i8_to_r_i32 (x86::Assembler &a, int32 reg_no, int8 data)
1221+ {
1222+ return mov_imm_to_r_i32 (a, reg_no, (int32)data);
1223+ }
1224+
1225+ /* *
1226+ * encoding convert int8 register to int32 register
1227+ *
1228+ * @param a the assembler to emit the code
1229+ * @param reg_no_dst the dst register
1230+ * @param reg_no_src the src register
1231+ *
1232+ * @return true if success, false otherwise
1233+ */
1234+ static bool
1235+ convert_r_i8_to_r_i32 (x86::Assembler &a, int32 reg_no_dst, int32 reg_no_src)
1236+ {
1237+ return extend_r8_to_r32 (a, reg_no_dst, reg_no_src, true );
1238+ }
1239+
1240+ /* *
1241+ * encoding convert int8 immediate data to int64 register
1242+ *
1243+ * @param a the assembler to emit the code
1244+ * @param reg_no the dst register, need to be converted to int64
1245+ * @param data the src int8 immediate data
1246+ *
1247+ * @return true if success, false otherwise
1248+ */
1249+ static bool
1250+ convert_imm_i8_to_r_i64 (x86::Assembler &a, int32 reg_no, int8 data)
1251+ {
1252+ return mov_imm_to_r_i64 (a, reg_no, (int64)data);
1253+ }
1254+
1255+ /* *
1256+ * encoding convert int8 register to int64 register
1257+ *
1258+ * @param a the assembler to emit the code
1259+ * @param reg_no_dst the dst register
1260+ * @param reg_no_src the src register
1261+ *
1262+ * @return true if success, false otherwise
1263+ */
1264+ static bool
1265+ convert_r_i8_to_r_i64 (x86::Assembler &a, int32 reg_no_dst, int32 reg_no_src)
1266+ {
1267+ return extend_r8_to_r64 (a, reg_no_dst, reg_no_src, true );
1268+ }
1269+
1270+ /* *
1271+ * Encoding convert int16 immediate data to int32 register
1272+ *
1273+ * @param a the assembler to emit the code
1274+ * @param reg_no the dst register, need to be converted to int32
1275+ * @param data the src int16 immediate data
1276+ *
1277+ * @return true if success, false otherwise
1278+ */
1279+ static bool
1280+ convert_imm_i16_to_r_i32 (x86::Assembler &a, int32 reg_no, int16 data)
1281+ {
1282+ return mov_imm_to_r_i32 (a, reg_no, (int32)data);
1283+ }
1284+
1285+ /* *
1286+ * encoding convert int16 register to int32 register
1287+ *
1288+ * @param a the assembler to emit the code
1289+ * @param reg_no_dst the dst register
1290+ * @param reg_no_src the src register
1291+ *
1292+ * @return true if success, false otherwise
1293+ */
1294+ static bool
1295+ convert_r_i16_to_r_i32 (x86::Assembler &a, int32 reg_no_dst, int32 reg_no_src)
1296+ {
1297+ return extend_r16_to_r32 (a, reg_no_dst, reg_no_src, true );
1298+ }
1299+
1300+ /* *
1301+ * encoding convert int16 immediate data to int64 register
1302+ *
1303+ * @param a the assembler to emit the code
1304+ * @param reg_no the dst register, need to be converted to int64
1305+ * @param data the src int16 immediate data
1306+ *
1307+ * @return true if success, false otherwise
1308+ */
1309+ static bool
1310+ convert_imm_i16_to_r_i64 (x86::Assembler &a, int32 reg_no, int16 data)
1311+ {
1312+ return mov_imm_to_r_i64 (a, reg_no, (int64)data);
1313+ }
1314+
1315+ /* *
1316+ * encoding convert int16 register to int64 register
1317+ *
1318+ * @param a the assembler to emit the code
1319+ * @param reg_no_dst the dst register
1320+ * @param reg_no_src the src register
1321+ *
1322+ * @return true if success, false otherwise
1323+ */
1324+ static bool
1325+ convert_r_i16_to_r_i64 (x86::Assembler &a, int32 reg_no_dst, int32 reg_no_src)
1326+ {
1327+ return extend_r16_to_r64 (a, reg_no_dst, reg_no_src, true );
1328+ }
1329+
12101330/* *
12111331 * Encoding convert int32 immediate data to int8 register
12121332 *
@@ -1441,7 +1561,7 @@ convert_imm_i32_to_r_f64(x86::Assembler &a, int32 reg_no, int32 data)
14411561static bool
14421562convert_imm_i64_to_r_i32 (x86::Assembler &a, int32 reg_no, int64 data)
14431563{
1444- return mov_imm_to_r_i32 (a, reg_no, (int32)data);
1564+ return mov_imm_to_r_i64 (a, reg_no, (int32)data);
14451565}
14461566
14471567/* *
@@ -1461,6 +1581,70 @@ convert_r_i64_to_r_i32(x86::Assembler &a, int32 reg_no_dst, int32 reg_no_src)
14611581 return true ;
14621582}
14631583
1584+ /* *
1585+ * Encode converting int64 immediate data to int8 register data
1586+ *
1587+ * @param a the assembler to emit the code
1588+ * @param reg_no the no of dst int32 register
1589+ * @param data the src immediate int64 data
1590+ *
1591+ * @return true if success, false otherwise
1592+ */
1593+ static bool
1594+ convert_imm_i64_to_r_i8 (x86::Assembler &a, int32 reg_no, int64 data)
1595+ {
1596+ return mov_imm_to_r_i64 (a, reg_no, (int8)data);
1597+ }
1598+
1599+ /* *
1600+ * Encode converting int64 register data to int8 register data
1601+ *
1602+ * @param a the assembler to emit the code
1603+ * @param reg_no_dst the no of dst int8 register
1604+ * @param reg_no_src the no of src int64 register
1605+ *
1606+ * @return true if success, false otherwise
1607+ */
1608+ static bool
1609+ convert_r_i64_to_r_i8 (x86::Assembler &a, int32 reg_no_dst, int32 reg_no_src)
1610+ {
1611+ mov_r_to_r_i64 (a, reg_no_dst, reg_no_src);
1612+ a.and_ (regs_i64[reg_no_dst], 0x00000000000000FFLL );
1613+ return true ;
1614+ }
1615+
1616+ /* *
1617+ * Encode converting int64 immediate data to int16 register data
1618+ *
1619+ * @param a the assembler to emit the code
1620+ * @param reg_no the no of dst int32 register
1621+ * @param data the src immediate int64 data
1622+ *
1623+ * @return true if success, false otherwise
1624+ */
1625+ static bool
1626+ convert_imm_i64_to_r_i16 (x86::Assembler &a, int32 reg_no, int64 data)
1627+ {
1628+ return mov_imm_to_r_i64 (a, reg_no, (int16)data);
1629+ }
1630+
1631+ /* *
1632+ * Encode converting int64 register data to int16 register data
1633+ *
1634+ * @param a the assembler to emit the code
1635+ * @param reg_no_dst the no of dst int16 register
1636+ * @param reg_no_src the no of src int64 register
1637+ *
1638+ * @return true if success, false otherwise
1639+ */
1640+ static bool
1641+ convert_r_i64_to_r_i16 (x86::Assembler &a, int32 reg_no_dst, int32 reg_no_src)
1642+ {
1643+ mov_r_to_r_i64 (a, reg_no_dst, reg_no_src);
1644+ a.and_ (regs_i64[reg_no_dst], 0x000000000000FFFFLL );
1645+ return true ;
1646+ }
1647+
14641648/* *
14651649 * Encode converting uint32 immediate data to int64 register data
14661650 *
@@ -5623,6 +5807,26 @@ jit_codegen_gen_native(JitCompContext *cc)
56235807 GOTO_FAIL;
56245808 break ;
56255809
5810+ case JIT_OP_I8TOI32:
5811+ LOAD_2ARGS ();
5812+ CONVERT_R_R (I32, I32, i32 , i8 , int8);
5813+ break ;
5814+
5815+ case JIT_OP_I8TOI64:
5816+ LOAD_2ARGS ();
5817+ CONVERT_R_R (I64, I64, i64 , i8 , int8);
5818+ break ;
5819+
5820+ case JIT_OP_I16TOI32:
5821+ LOAD_2ARGS ();
5822+ CONVERT_R_R (I32, I32, i32 , i16 , int16);
5823+ break ;
5824+
5825+ case JIT_OP_I16TOI64:
5826+ LOAD_2ARGS ();
5827+ CONVERT_R_R (I64, I64, i64 , i16 , int16);
5828+ break ;
5829+
56265830 case JIT_OP_I32TOI8:
56275831 LOAD_2ARGS ();
56285832 CONVERT_R_R (I32, I32, i8 , i32 , int32);
@@ -5670,7 +5874,17 @@ jit_codegen_gen_native(JitCompContext *cc)
56705874
56715875 case JIT_OP_U32TOF64:
56725876 LOAD_2ARGS ();
5673- CONVERT_R_R (F64, I32, f64 , u32 , int32);
5877+ CONVERT_R_R (F64, I32, f64 , u32 , uint32);
5878+ break ;
5879+
5880+ case JIT_OP_I64TOI8:
5881+ LOAD_2ARGS ();
5882+ CONVERT_R_R (I64, I64, i8 , i64 , int64);
5883+ break ;
5884+
5885+ case JIT_OP_I64TOI16:
5886+ LOAD_2ARGS ();
5887+ CONVERT_R_R (I64, I64, i16 , i64 , int64);
56745888 break ;
56755889
56765890 case JIT_OP_I64TOI32:
@@ -5690,12 +5904,12 @@ jit_codegen_gen_native(JitCompContext *cc)
56905904
56915905 case JIT_OP_F32TOI32:
56925906 LOAD_2ARGS ();
5693- CONVERT_R_R (I32, F32, i32 , f32 , int32 );
5907+ CONVERT_R_R (I32, F32, i32 , f32 , float32 );
56945908 break ;
56955909
56965910 case JIT_OP_F32TOI64:
56975911 LOAD_2ARGS ();
5698- CONVERT_R_R (I64, F32, i64 , f32 , int32 );
5912+ CONVERT_R_R (I64, F32, i64 , f32 , float32 );
56995913 break ;
57005914
57015915 case JIT_OP_F32TOF64:
@@ -5705,7 +5919,7 @@ jit_codegen_gen_native(JitCompContext *cc)
57055919
57065920 case JIT_OP_F32TOU32:
57075921 LOAD_2ARGS ();
5708- CONVERT_R_R (I32, F32, u32 , f32 , int32 );
5922+ CONVERT_R_R (I32, F32, u32 , f32 , float32 );
57095923 break ;
57105924
57115925 case JIT_OP_F64TOI32:
0 commit comments