lower cost for a bit test in a compare

This commit is contained in:
bebbo 2024-04-18 21:39:35 +02:00
parent bdfbc089f6
commit 0b183a61db
4 changed files with 19 additions and 4 deletions

View File

@ -88,7 +88,13 @@ m68k_68000_10_costs (rtx x, machine_mode mode, int outer_code,
case LE:
case LT:
case CC0:
return false;
case ZERO_EXTRACT:
if (outer_code == COMPARE && GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 1)
{
*total = 2;
return true;
}
return false;
case POST_INC:
case TRUNCATE:

View File

@ -106,7 +106,10 @@ m68k_68020_costs (rtx x, machine_mode mode, int outer_code, int opno,
return true;
case SIGN_EXTRACT:
case ZERO_EXTRACT:
*total = 8;
if (outer_code == COMPARE && GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 1)
*total = 2;
else;
*total = 8;
return true;
case TRUNCATE:
case ZERO_EXTEND:

View File

@ -106,8 +106,11 @@ m68k_68030_costs (rtx x, machine_mode mode, int outer_code, int opno,
return true;
case SIGN_EXTRACT:
case ZERO_EXTRACT:
*total = 10;
return true;
if (outer_code == COMPARE && GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 1)
*total = 2;
else;
*total = 10;
return true;
case TRUNCATE:
case ZERO_EXTEND:
*total = GET_MODE_SIZE(mode) > 2 ? 4 : 2;

View File

@ -103,7 +103,10 @@ __m68k_68040_costs (rtx x, machine_mode mode, int outer_code, int opno,
return true;
case SIGN_EXTRACT:
case ZERO_EXTRACT:
*total = 4;
if (outer_code == COMPARE && GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 1)
*total = 2;
else;
*total = 4;
return true;
case TRUNCATE:
case ZERO_EXTEND: