@@ -3391,6 +3391,13 @@ simd_type_to_comp_op (int t)
3391
3391
case MONO_TYPE_I8 :
3392
3392
case MONO_TYPE_U8 :
3393
3393
return OP_PCMPEQQ ; // SSE 4.1
3394
+ case MONO_TYPE_I :
3395
+ case MONO_TYPE_U :
3396
+ #if TARGET_SIZEOF_VOID_P == 8
3397
+ return OP_PCMPEQQ ; // SSE 4.1
3398
+ #else
3399
+ return OP_PCMPEQD ;
3400
+ #endif
3394
3401
default :
3395
3402
g_assert_not_reached ();
3396
3403
return -1 ;
@@ -3413,6 +3420,13 @@ simd_type_to_sub_op (int t)
3413
3420
case MONO_TYPE_I8 :
3414
3421
case MONO_TYPE_U8 :
3415
3422
return OP_PSUBQ ;
3423
+ case MONO_TYPE_I :
3424
+ case MONO_TYPE_U :
3425
+ #if TARGET_SIZEOF_VOID_P == 8
3426
+ return OP_PSUBQ ;
3427
+ #else
3428
+ return OP_PSUBD ;
3429
+ #endif
3416
3430
default :
3417
3431
g_assert_not_reached ();
3418
3432
return -1 ;
@@ -3432,6 +3446,13 @@ simd_type_to_shl_op (int t)
3432
3446
case MONO_TYPE_I8 :
3433
3447
case MONO_TYPE_U8 :
3434
3448
return OP_PSHLQ ;
3449
+ case MONO_TYPE_I :
3450
+ case MONO_TYPE_U :
3451
+ #if TARGET_SIZEOF_VOID_P == 8
3452
+ return OP_PSHLD ;
3453
+ #else
3454
+ return OP_PSHLQ ;
3455
+ #endif
3435
3456
default :
3436
3457
g_assert_not_reached ();
3437
3458
return -1 ;
@@ -3454,6 +3475,13 @@ simd_type_to_gt_op (int t)
3454
3475
case MONO_TYPE_I8 :
3455
3476
case MONO_TYPE_U8 :
3456
3477
return OP_PCMPGTQ ; // SSE 4.2
3478
+ case MONO_TYPE_I :
3479
+ case MONO_TYPE_U :
3480
+ #if TARGET_SIZEOF_VOID_P == 8
3481
+ return OP_PCMPGTQ ; // SSE 4.2
3482
+ #else
3483
+ return OP_PCMPGTD ;
3484
+ #endif
3457
3485
default :
3458
3486
g_assert_not_reached ();
3459
3487
return -1 ;
@@ -3472,6 +3500,13 @@ simd_type_to_max_un_op (int t)
3472
3500
return OP_PMAXD_UN ; // SSE 4.1
3473
3501
//case MONO_TYPE_U8:
3474
3502
// return OP_PMAXQ_UN; // AVX
3503
+ #if TARGET_SIZEOF_VOID_P == 8
3504
+ //case MONO_TYPE_U:
3505
+ // return OP_PMAXQ_UN; // AVX
3506
+ #else
3507
+ case MONO_TYPE_U :
3508
+ return OP_PMAXD_UN ; // SSE 4.1
3509
+ #endif
3475
3510
default :
3476
3511
g_assert_not_reached ();
3477
3512
return -1 ;
@@ -3494,6 +3529,13 @@ simd_type_to_add_op (int t)
3494
3529
case MONO_TYPE_I8 :
3495
3530
case MONO_TYPE_U8 :
3496
3531
return OP_PADDQ ;
3532
+ case MONO_TYPE_I :
3533
+ case MONO_TYPE_U :
3534
+ #if TARGET_SIZEOF_VOID_P == 8
3535
+ return OP_PADDQ ;
3536
+ #else
3537
+ return OP_PADDD ;
3538
+ #endif
3497
3539
default :
3498
3540
g_assert_not_reached ();
3499
3541
return -1 ;
@@ -3518,6 +3560,15 @@ simd_type_to_min_op (int t)
3518
3560
return OP_PMIND_UN ; // SSE 4.1
3519
3561
// case MONO_TYPE_I8: // AVX
3520
3562
// case MONO_TYPE_U8:
3563
+ #if TARGET_SIZEOF_VOID_P == 8
3564
+ //case MONO_TYPE_I: // AVX
3565
+ //case MONO_TYPE_U:
3566
+ #else
3567
+ case MONO_TYPE_I :
3568
+ return OP_PMIND ; // SSE 4.1
3569
+ case MONO_TYPE_U :
3570
+ return OP_PMIND_UN ; // SSE 4.1
3571
+ #endif
3521
3572
default :
3522
3573
g_assert_not_reached ();
3523
3574
return -1 ;
@@ -3542,6 +3593,15 @@ simd_type_to_max_op (int t)
3542
3593
return OP_PMAXD_UN ; // SSE 4.1
3543
3594
// case MONO_TYPE_I8: // AVX
3544
3595
// case MONO_TYPE_U8:
3596
+ #if TARGET_SIZEOF_VOID_P == 8
3597
+ //case MONO_TYPE_I: // AVX
3598
+ //case MONO_TYPE_U:
3599
+ #else
3600
+ case MONO_TYPE_I :
3601
+ return OP_PMAXD ; // SSE 4.1
3602
+ case MONO_TYPE_U :
3603
+ return OP_PMAXD_UN ; // SSE 4.1
3604
+ #endif
3545
3605
default :
3546
3606
g_assert_not_reached ();
3547
3607
return -1 ;
@@ -3552,8 +3612,13 @@ static void
3552
3612
emit_simd_comp_op (MonoCompile * cfg , MonoBasicBlock * bb , MonoInst * ins , int type , int dreg , int sreg1 , int sreg2 )
3553
3613
{
3554
3614
MonoInst * temp ;
3615
+ gboolean is64BitNativeInt = FALSE;
3555
3616
3556
- if (!mono_hwcap_x86_has_sse42 && (ins -> inst_c1 == MONO_TYPE_I8 || ins -> inst_c1 == MONO_TYPE_U8 )) {
3617
+ #if TARGET_SIZEOF_VOID_P == 8
3618
+ is64BitNativeInt = ins -> inst_c1 == MONO_TYPE_I || ins -> inst_c1 == MONO_TYPE_U ;
3619
+ #endif
3620
+
3621
+ if (!mono_hwcap_x86_has_sse42 && (ins -> inst_c1 == MONO_TYPE_I8 || ins -> inst_c1 == MONO_TYPE_U8 || is64BitNativeInt )) {
3557
3622
int temp_reg1 = mono_alloc_ireg (cfg );
3558
3623
int temp_reg2 = mono_alloc_ireg (cfg );
3559
3624
@@ -3613,6 +3678,15 @@ emit_simd_gt_un_op (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, int typ
3613
3678
NEW_SIMD_INS (cfg , ins , temp , simd_type_to_sub_op (type ), temp_s2 , sreg2 , temp_c80 );
3614
3679
emit_simd_gt_op (cfg , bb , ins , type , dreg , temp_s1 , temp_s2 );
3615
3680
break ;
3681
+
3682
+ case MONO_TYPE_U :
3683
+ #if TARGET_SIZEOF_VOID_P == 8
3684
+ goto USE_SIGNED_GT ;
3685
+ #else
3686
+ if (mono_hwcap_x86_has_sse41 )
3687
+ goto USE_MAX ;
3688
+ goto USE_SIGNED_GT ;
3689
+ #endif
3616
3690
}
3617
3691
}
3618
3692
}
@@ -3621,8 +3695,13 @@ static void
3621
3695
emit_simd_gt_op (MonoCompile * cfg , MonoBasicBlock * bb , MonoInst * ins , int type , int dreg , int sreg1 , int sreg2 )
3622
3696
{
3623
3697
MonoInst * temp ;
3698
+ gboolean is64BitNativeInt = FALSE;
3699
+
3700
+ #if TARGET_SIZEOF_VOID_P == 8
3701
+ is64BitNativeInt = ins -> inst_c1 == MONO_TYPE_I || ins -> inst_c1 == MONO_TYPE_U ;
3702
+ #endif
3624
3703
3625
- if (!mono_hwcap_x86_has_sse42 && (type == MONO_TYPE_I8 || type == MONO_TYPE_U8 )) {
3704
+ if (!mono_hwcap_x86_has_sse42 && (type == MONO_TYPE_I8 || type == MONO_TYPE_U8 || is64BitNativeInt )) {
3626
3705
// Decompose 64-bit greater than to 32-bit
3627
3706
//
3628
3707
// t = (v1 > v2)
@@ -3663,11 +3742,16 @@ static void
3663
3742
emit_simd_min_op (MonoCompile * cfg , MonoBasicBlock * bb , MonoInst * ins , int type , int dreg , int sreg1 , int sreg2 )
3664
3743
{
3665
3744
MonoInst * temp ;
3745
+ gboolean is64BitNativeInt = FALSE;
3746
+
3747
+ #if TARGET_SIZEOF_VOID_P == 8
3748
+ is64BitNativeInt = ins -> inst_c1 == MONO_TYPE_I || ins -> inst_c1 == MONO_TYPE_U ;
3749
+ #endif
3666
3750
3667
3751
if (type == MONO_TYPE_I2 || type == MONO_TYPE_U2 ) {
3668
3752
// SSE2, so always available
3669
3753
NEW_SIMD_INS (cfg , ins , temp , simd_type_to_min_op (type ), dreg , sreg1 , sreg2 );
3670
- } else if (!mono_hwcap_x86_has_sse41 || type == MONO_TYPE_I8 || type == MONO_TYPE_U8 ) {
3754
+ } else if (!mono_hwcap_x86_has_sse41 || type == MONO_TYPE_I8 || type == MONO_TYPE_U8 || is64BitNativeInt ) {
3671
3755
// Decompose to t = (s1 > s2), d = (s1 & !t) | (s2 & t)
3672
3756
int temp_t = mono_alloc_ireg (cfg );
3673
3757
int temp_d1 = mono_alloc_ireg (cfg );
@@ -3689,11 +3773,16 @@ static void
3689
3773
emit_simd_max_op (MonoCompile * cfg , MonoBasicBlock * bb , MonoInst * ins , int type , int dreg , int sreg1 , int sreg2 )
3690
3774
{
3691
3775
MonoInst * temp ;
3776
+ gboolean is64BitNativeInt = FALSE;
3777
+
3778
+ #if TARGET_SIZEOF_VOID_P == 8
3779
+ is64BitNativeInt = ins -> inst_c1 == MONO_TYPE_I || ins -> inst_c1 == MONO_TYPE_U ;
3780
+ #endif
3692
3781
3693
3782
if (type == MONO_TYPE_I2 || type == MONO_TYPE_U2 ) {
3694
3783
// SSE2, so always available
3695
3784
NEW_SIMD_INS (cfg , ins , temp , simd_type_to_max_op (type ), dreg , sreg1 , sreg2 );
3696
- } else if (!mono_hwcap_x86_has_sse41 || type == MONO_TYPE_I8 || type == MONO_TYPE_U8 ) {
3785
+ } else if (!mono_hwcap_x86_has_sse41 || type == MONO_TYPE_I8 || type == MONO_TYPE_U8 || is64BitNativeInt ) {
3697
3786
// Decompose to t = (s1 > s2), d = (s1 & t) | (s2 & !t)
3698
3787
int temp_t = mono_alloc_ireg (cfg );
3699
3788
int temp_d1 = mono_alloc_ireg (cfg );
0 commit comments