1
0
Fork 0

vm_armv7l, vm_aarch64: use explicit argument register selection for ABI-dependent calls

vm_armv7l: potential fix for compatibility with -mfloat-abi=softfp
This commit is contained in:
ec- 2021-06-02 16:47:34 +03:00
parent 8f423a0c14
commit 7a35b5fbe2
2 changed files with 19 additions and 5 deletions

View File

@ -2459,7 +2459,7 @@ static qboolean ConstOptimize( vm_t *vm )
}
flush_volatile();
if ( ci->value == ~TRAP_SIN || ci->value == ~TRAP_COS ) {
sx[0] = alloc_sx( S0 );
sx[0] = S0; mask_sx( sx[0] );
rx[0] = alloc_rx( R16 );
emit(VLDRi(sx[0], rPROCBASE, 8)); // s0 = [procBase + 8]
if ( ci->value == ~TRAP_SIN )
@ -2467,8 +2467,8 @@ static qboolean ConstOptimize( vm_t *vm )
else
emit_MOVXi(rx[0], (intptr_t)cosf);
emit(BLR(rx[0]));
store_sx_opstack( sx[0] ); // *opstack = s0
unmask_rx( rx[0] );
store_sx_opstack( sx[0] ); // *opstack = s0
ip += 1; // OP_CALL
return qtrue;
}

View File

@ -2212,8 +2212,9 @@ static qboolean ConstOptimize( vm_t *vm )
}
flush_volatile();
if ( ci->value == ~TRAP_SIN || ci->value == ~TRAP_COS ) {
sx[0] = alloc_sx( S0 | TEMP );
#if (__ARM_PCS_VFP)
// -mfloat-abi=hard
sx[0] = S0; mask_sx( sx[0] );
rx[0] = alloc_rx( R12 );
emit(VLDRai(sx[0], rPROCBASE, 8)); // s0 = [procBase + 8]
if ( ci->value == ~TRAP_SIN )
@ -2221,8 +2222,21 @@ static qboolean ConstOptimize( vm_t *vm )
else
emit_MOVRxi(rx[0], (intptr_t)cosf);
emit(BLX(rx[0]));
store_sx_opstack( sx[0] ); // *opstack = s0
unmask_rx( rx[0] );
store_sx_opstack( sx[0] ); // *opstack = s0
#else
// -mfloat-abi=soft or softfp
rx[0] = R0; mask_rx( rx[0] );
rx[1] = R12; mask_rx( rx[1] );
emit(LDRai(rx[0], rPROCBASE, 8)); // r0 = [procBase + 8]
if ( ci->value == ~TRAP_SIN )
emit_MOVRxi(rx[1], (intptr_t)sinf);
else
emit_MOVRxi(rx[1], (intptr_t)cosf);
emit(BLX(rx[1]));
unmask_rx( rx[1] );
store_rx_opstack( rx[0] ); // *opstack = r0
#endif
ip += 1; // OP_CALL
return qtrue;
}