* [Patch, microblaze]: Add support for the CLZ insn
@ 2013-02-11 6:39 David Holsgrove
2013-02-19 23:10 ` Michael Eager
0 siblings, 1 reply; 2+ messages in thread
From: David Holsgrove @ 2013-02-11 6:39 UTC (permalink / raw)
To: gcc-patches
Cc: Michael Eager (eager@eagercon.com),
John Williams, Edgar E. Iglesias (edgar.iglesias@gmail.com),
Vinod Kathail, Vidhumouli Hunsigida, Nagaraju Mekala, Tom Shui
[-- Attachment #1: Type: text/plain, Size: 500 bytes --]
Add support for the CLZ insn
Will be used if pattern-compare is enabled and the targeted
core is newer than v8.10.a.
Changelog
2013-02-11 Edgar E. Iglesias <edgar.iglesias@gmail.com>
* config/microblaze/microblaze.c: microblaze_has_clz = 0
Add version check for v8.10.a to enable microblaze_has_clz
* config/microblaze/microblaze.h: Add TARGET_HAS_CLZ as
combined version and TARGET_PATTERN_COMPARE check
* config/microblaze/microblaze.md: New clzsi2 instruction
[-- Attachment #2: 0006-microblaze-Add-support-for-the-CLZ-insn.patch --]
[-- Type: application/octet-stream, Size: 3606 bytes --]
From 3b997deabea0bbf7c492c7f00c49a44dbfb59c16 Mon Sep 17 00:00:00 2001
From: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Date: Fri, 4 Nov 2011 01:40:31 +0100
Subject: [PATCH] microblaze: Add support for the CLZ insn
Will be used if pattern-compare is enabled and the targeted
core is newer than v8.10.a.
Changelog
2013-02-11 Edgar E. Iglesias <edgar.iglesias@gmail.com>
* gcc/config/microblaze/microblaze.c: microblaze_has_clz = 0
Add version check for v8.10.a to enable microblaze_has_clz
* gcc/config/microblaze/microblaze.h: Add TARGET_HAS_CLZ as
combined version and TARGET_PATTERN_COMPARE check
* gcc/config/microblaze/microblaze.md: New clzsi2 instruction
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
gcc/config/microblaze/microblaze.c | 11 +++++++++++
gcc/config/microblaze/microblaze.h | 4 ++++
gcc/config/microblaze/microblaze.md | 10 ++++++++++
3 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index 449626b..fc0296e 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -143,6 +143,9 @@ int microblaze_section_threshold = -1;
delay slots. -mcpu=v3.00.a or v4.00.a turns this on. */
int microblaze_no_unsafe_delay;
+/* Set to one if the targeted core has the CLZ insn. */
+int microblaze_has_clz = 0;
+
/* Which CPU pipeline do we use. We haven't really standardized on a CPU
version having only a particular type of pipeline. There can still be
options on the CPU to scale pipeline features up or down. :(
@@ -1369,6 +1372,14 @@ microblaze_option_override (void)
"-mxl-multiply-high can be used only with -mcpu=v6.00.a or greater");
}
+ ver = MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v8.10.a");
+ microblaze_has_clz = 1;
+ if (ver < 0)
+ {
+ /* MicroBlaze prior to 8.10.a didn't have clz. */
+ microblaze_has_clz = 0;
+ }
+
if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL)
error ("-mxl-multiply-high requires -mno-xl-soft-mul");
diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
index b552665..a188a2e 100644
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -42,6 +42,7 @@ extern int microblaze_section_threshold;
extern int microblaze_dbx_regno[];
extern int microblaze_no_unsafe_delay;
+extern int microblaze_has_clz;
extern enum pipeline_type microblaze_pipe;
#define OBJECT_FORMAT_ELF
@@ -58,6 +59,9 @@ extern enum pipeline_type microblaze_pipe;
#define TARGET_DEFAULT (MASK_SOFT_MUL | MASK_SOFT_DIV | MASK_SOFT_FLOAT \
| TARGET_ENDIAN_DEFAULT)
+/* Do we have CLZ? */
+#define TARGET_HAS_CLZ (TARGET_PATTERN_COMPARE && microblaze_has_clz)
+
/* The default is to support PIC. */
#define TARGET_SUPPORTS_PIC 1
diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
index b3d0514..1b42003 100644
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -2200,3 +2200,13 @@
[(set_attr "type" "multi")
(set_attr "length" "12")])
+;; This insn gives the count of leading number of zeros for the second
+;; operand and stores the result in first operand.
+(define_insn "clzsi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (clz:SI (match_operand:SI 1 "register_operand" "r")))]
+ "TARGET_HAS_CLZ"
+ "clz\t%0,%1"
+ [(set_attr "type" "arith")
+ (set_attr "mode" "SI")
+ (set_attr "length" "4")])
--
1.7.3.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch, microblaze]: Add support for the CLZ insn
2013-02-11 6:39 [Patch, microblaze]: Add support for the CLZ insn David Holsgrove
@ 2013-02-19 23:10 ` Michael Eager
0 siblings, 0 replies; 2+ messages in thread
From: Michael Eager @ 2013-02-19 23:10 UTC (permalink / raw)
To: David Holsgrove
Cc: gcc-patches, Michael Eager (eager@eagercon.com),
John Williams, Edgar E. Iglesias (edgar.iglesias@gmail.com),
Vinod Kathail, Vidhumouli Hunsigida, Nagaraju Mekala, Tom Shui
On 02/10/2013 10:39 PM, David Holsgrove wrote:
> Add support for the CLZ insn
>
> Will be used if pattern-compare is enabled and the targeted
> core is newer than v8.10.a.
>
> Changelog
>
> 2013-02-11 Edgar E. Iglesias <edgar.iglesias@gmail.com>
>
> * config/microblaze/microblaze.c: microblaze_has_clz = 0
> Add version check for v8.10.a to enable microblaze_has_clz
> * config/microblaze/microblaze.h: Add TARGET_HAS_CLZ as
> combined version and TARGET_PATTERN_COMPARE check
> * config/microblaze/microblaze.md: New clzsi2 instruction
Committed revision 196158.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-19 23:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-11 6:39 [Patch, microblaze]: Add support for the CLZ insn David Holsgrove
2013-02-19 23:10 ` Michael Eager
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).