Revision 9a5c57fd

b/tcg/tcg-op.h
1297 1297
    tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31);
1298 1298
}
1299 1299

  
1300
/* Note: we assume the six high bytes are set to zero */
1301
static inline void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg)
1302
{
1303
    tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
1304
    tcg_gen_bswap16_i32(TCGV_LOW(ret), TCGV_LOW(arg));
1305
}
1306

  
1307
/* Note: we assume the four high bytes are set to zero */
1308
static inline void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg)
1309
{
1310
    tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
1311
    tcg_gen_bswap32_i32(TCGV_LOW(ret), TCGV_LOW(arg));
1312
}
1313

  
1300 1314
static inline void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg)
1301 1315
{
1302 1316
    TCGv_i32 t0, t1;
......
1378 1392
    tcg_gen_ext32s_i64(ret, MAKE_TCGV_I64(GET_TCGV_I32(arg)));
1379 1393
}
1380 1394

  
1395
/* Note: we assume the six high bytes are set to zero */
1396
static inline void tcg_gen_bswap16_i64(TCGv_i64 ret, TCGv_i64 arg)
1397
{
1398
#ifdef TCG_TARGET_HAS_bswap16_i64
1399
    tcg_gen_op2_i64(INDEX_op_bswap16_i64, ret, arg);
1400
#else
1401
    TCGv_i64 t0 = tcg_temp_new_i64();
1402

  
1403
    tcg_gen_ext8u_i64(t0, arg);
1404
    tcg_gen_shli_i64(t0, t0, 8);
1405
    tcg_gen_shri_i64(ret, arg, 8);
1406
    tcg_gen_or_i64(ret, ret, t0);
1407
    tcg_temp_free_i64(t0);
1408
#endif
1409
}
1410

  
1411
/* Note: we assume the four high bytes are set to zero */
1412
static inline void tcg_gen_bswap32_i64(TCGv_i64 ret, TCGv_i64 arg)
1413
{
1414
#ifdef TCG_TARGET_HAS_bswap32_i64
1415
    tcg_gen_op2_i64(INDEX_op_bswap32_i64, ret, arg);
1416
#else
1417
    TCGv_i64 t0, t1;
1418
    t0 = tcg_temp_new_i64();
1419
    t1 = tcg_temp_new_i64();
1420

  
1421
    tcg_gen_shli_i64(t0, arg, 24);
1422
    tcg_gen_ext32u_i64(t0, t0);
1423

  
1424
    tcg_gen_andi_i64(t1, arg, 0x0000ff00);
1425
    tcg_gen_shli_i64(t1, t1, 8);
1426
    tcg_gen_or_i64(t0, t0, t1);
1427

  
1428
    tcg_gen_shri_i64(t1, arg, 8);
1429
    tcg_gen_andi_i64(t1, t1, 0x0000ff00);
1430
    tcg_gen_or_i64(t0, t0, t1);
1431

  
1432
    tcg_gen_shri_i64(t1, arg, 24);
1433
    tcg_gen_or_i64(ret, t0, t1);
1434
    tcg_temp_free_i64(t0);
1435
    tcg_temp_free_i64(t1);
1436
#endif
1437
}
1438

  
1381 1439
static inline void tcg_gen_bswap64_i64(TCGv_i64 ret, TCGv_i64 arg)
1382 1440
{
1383 1441
#ifdef TCG_TARGET_HAS_bswap64_i64
b/tcg/tcg-opc.h
152 152
#ifdef TCG_TARGET_HAS_ext32s_i64
153 153
DEF2(ext32s_i64, 1, 1, 0, 0)
154 154
#endif
155
#ifdef TCG_TARGET_HAS_bswap16_i64
156
DEF2(bswap16_i64, 1, 1, 0, 0)
157
#endif
158
#ifdef TCG_TARGET_HAS_bswap32_i64
159
DEF2(bswap32_i64, 1, 1, 0, 0)
160
#endif
155 161
#ifdef TCG_TARGET_HAS_bswap64_i64
156 162
DEF2(bswap64_i64, 1, 1, 0, 0)
157 163
#endif

Also available in: Unified diff