Commit c77f83d5 by Edgar E. Iglesias Committed by Michael Eager

Add support for the CLZ insn

Add support for the CLZ insn
* 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

From-SVN: r196158
parent 959434e6
2012-02-19 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
2012-02-19 Edgar E. Iglesias <edgar.iglesias@gmail.com>
* config/microblaze/microblaze.md (call_value_intern): Check symbol is
function before branching.
......
......@@ -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");
......
......@@ -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
......
......@@ -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")])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment