This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[AArch64 costs 16/18] Cost TRUNCATE
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: richard dot earnshaw at arm dot com, marcus dot shawcroft at arm dot com, philipp dot tomsich at theobroma-systems dot com
- Date: Thu, 27 Mar 2014 17:33:40 +0000
- Subject: [AArch64 costs 16/18] Cost TRUNCATE
- Authentication-results: sourceware.org; auth=none
- References: <1395941622-22926-1-git-send-email-james dot greenhalgh at arm dot com>
Hi,
And now - TRUNCATE.
Tested in series on aarch64-none-elf
OK For stage 1?
Thanks,
James
---
2014-03-27 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* config/aarch64/aarch64.c (aarch64_rtx_costs): Cost TRUNCATE.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 3caff3a..7a6255b 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5671,6 +5671,39 @@ cost_plus:
}
return false;
+ case TRUNCATE:
+
+ /* Decompose <su>muldi3_highpart. */
+ if (/* (truncate:DI */
+ mode == DImode
+ /* (lshiftrt:TI */
+ && GET_MODE (XEXP (x, 0)) == TImode
+ && GET_CODE (XEXP (x, 0)) == LSHIFTRT
+ /* (mult:TI */
+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT
+ /* (ANY_EXTEND:TI (reg:DI))
+ (ANY_EXTEND:TI (reg:DI))) */
+ && ((GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == ZERO_EXTEND
+ && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == ZERO_EXTEND)
+ || (GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == SIGN_EXTEND
+ && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == SIGN_EXTEND))
+ && GET_MODE (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 0)) == DImode
+ && GET_MODE (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 1), 0)) == DImode
+ /* (const_int 64) */
+ && CONST_INT_P (XEXP (XEXP (x, 0), 1))
+ && UINTVAL (XEXP (XEXP (x, 0), 1)) == 64)
+ {
+ /* UMULH/SMULH. */
+ if (speed)
+ *cost += extra_cost->mult[mode == DImode].extend;
+ *cost += rtx_cost (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 0),
+ MULT, 0, speed);
+ *cost += rtx_cost (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 1), 0),
+ MULT, 1, speed);
+ return true;
+ }
+
+ /* Fall through. */
default:
break;
}