]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Improve costs for DImode shifts of interger constants.
authorJohn David Anglin <danglin@gcc.gnu.org>
Sun, 13 Sep 2020 18:50:07 +0000 (18:50 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 13 Sep 2020 18:50:07 +0000 (18:50 +0000)
2020-09-13  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* config/pa/pa.c (hppa_rtx_costs) [ASHIFT, ASHIFTRT, LSHIFTRT]:
Provide accurate costs for DImode shifts of integer constants.

gcc/config/pa/pa.c

index 55185aab65044e67bcf430af635f17a0713222e6..2461f2ed7161b01bdd8feb33c632170c1206443a 100644 (file)
@@ -1630,13 +1630,16 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code,
     case ASHIFT:
       if (mode == DImode)
        {
-         if (TARGET_64BIT)
-           *total = COSTS_N_INSNS (3);
-         else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1)))
+         if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1)))
            {
-             *total = COSTS_N_INSNS (2);
+             if (TARGET_64BIT)
+               *total = COSTS_N_INSNS (1);
+             else
+               *total = COSTS_N_INSNS (2);
              return true;
            }
+         else if (TARGET_64BIT)
+           *total = COSTS_N_INSNS (3);
          else if (speed)
            *total = COSTS_N_INSNS (13);
          else
@@ -1653,13 +1656,16 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code,
     case ASHIFTRT:
       if (mode == DImode)
        {
-         if (TARGET_64BIT)
-           *total = COSTS_N_INSNS (3);
-         else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1)))
+         if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1)))
            {
-             *total = COSTS_N_INSNS (2);
+             if (TARGET_64BIT)
+               *total = COSTS_N_INSNS (1);
+             else
+               *total = COSTS_N_INSNS (2);
              return true;
            }
+         else if (TARGET_64BIT)
+           *total = COSTS_N_INSNS (3);
          else if (speed)
            *total = COSTS_N_INSNS (14);
          else
@@ -1676,13 +1682,16 @@ hppa_rtx_costs (rtx x, machine_mode mode, int outer_code,
     case LSHIFTRT:
       if (mode == DImode)
        {
-         if (TARGET_64BIT)
-           *total = COSTS_N_INSNS (2);
-         else if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1)))
+         if (REG_P (XEXP (x, 0)) && CONST_INT_P (XEXP (x, 1)))
            {
-             *total = COSTS_N_INSNS (2);
+             if (TARGET_64BIT)
+               *total = COSTS_N_INSNS (1);
+             else
+               *total = COSTS_N_INSNS (2);
              return true;
            }
+         else if (TARGET_64BIT)
+           *total = COSTS_N_INSNS (2);
          else if (speed)
            *total = COSTS_N_INSNS (12);
          else