This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][AArch64][2/2] Add rtx cost function handling of clz, clrsb, rbit
- From: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>
- Date: Tue, 22 Jul 2014 12:23:41 +0100
- Subject: [PATCH][AArch64][2/2] Add rtx cost function handling of clz, clrsb, rbit
- Authentication-results: sourceware.org; auth=none
Hi all,
Following up on patch "[1/2] Remove UNSPEC_CLS and use clrsb RTL code in its' place" this patch adds rtx costs handling of the CLZ, CLRSB RTL codes as well as the UNSPEC_RBIT unspec.
The CLZ and CLRSB cases are handled identically (they are implemented by the clz and cls instructions respectively).
Bootstrapped and tested on aarch64-linux.
Ok for trunk?
Thanks,
Kyrill
2014-07-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.c (aarch64_rtx_costs): Handle CLRSB, CLZ.
(case UNSPEC): Handle UNSPEC_RBIT.
commit 8f54ebbfb9622dc53c30db11fdcd4d4602aa9d69
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date: Tue Jul 15 15:10:19 2014 +0100
[AArch64] RTX cost handling for clz, rbit, cls
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 9f42e20..7f67b6a 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5154,6 +5154,13 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
return false;
+ case CLRSB:
+ case CLZ:
+ if (speed)
+ *cost += extra_cost->alu.clz;
+
+ return false;
+
case COMPARE:
op0 = XEXP (x, 0);
op1 = XEXP (x, 1);
@@ -5799,6 +5806,14 @@ cost_plus:
return false;
}
+
+ if (XINT (x, 1) == UNSPEC_RBIT)
+ {
+ if (speed)
+ *cost += extra_cost->alu.rev;
+
+ return false;
+ }
break;
case TRUNCATE: