diff mbox

[AARCH64] Fix AArch64 CLZ_DEFINED_AT_ZERO and CTZ_DEFINED_AT_ZERO definition.

Message ID 54884398.4020907@arm.com
State New
Headers show

Commit Message

Renlin Li Dec. 10, 2014, 12:59 p.m. UTC
Hi all,

This patch update the CTZ_DEFINED_VALUE_AT_ZERO definition to support 
more modes. In addition, those two macros should both return 2 in 
aarch64 back-end.

Here are the explanations from GCC documentation:

CLZ_DEFINED_VALUE_AT_ZERO (mode, value)
CTZ_DEFINED_VALUE_AT_ZERO (mode, value)
A C expression that indicates whether the architecture defines a value
for @code{clz} or @code{ctz} with a zero operand.
A result of 0 indicates the value is undefined.
If the value is defined for only the RTL expression, the macro should
evaluate to 1; if the value applies also to the corresponding optab
entry (which is normally the case if it expands directly into
the corresponding RTL), then the macro should evaluate to 2.
In the cases where the value is defined, @var{value} should be set to
this value.


aarch64-none-elf has been test on the model, no new issue.
Okay for trunk?

Regards,
Renlin Li

gcc/ChangeLog:

2014-12-10 Renlin Li <renlin.li@arm.com>

         * config/aarch64/aarch64.h (CLZ_DEFINED_VALUE_AT_ZERO): make it 
return 2.
         (CTZ_DEFINED_VALUE_AT_ZERO): Update to support more modes.

Comments

Richard Earnshaw Dec. 13, 2014, 12:25 p.m. UTC | #1
On Wed, 2014-12-10 at 12:59 +0000, Renlin Li wrote:
> Hi all,
> 
> This patch update the CTZ_DEFINED_VALUE_AT_ZERO definition to support 
> more modes. In addition, those two macros should both return 2 in 
> aarch64 back-end.
> 
> Here are the explanations from GCC documentation:
> 
> CLZ_DEFINED_VALUE_AT_ZERO (mode, value)
> CTZ_DEFINED_VALUE_AT_ZERO (mode, value)
> A C expression that indicates whether the architecture defines a value
> for @code{clz} or @code{ctz} with a zero operand.
> A result of 0 indicates the value is undefined.
> If the value is defined for only the RTL expression, the macro should
> evaluate to 1; if the value applies also to the corresponding optab
> entry (which is normally the case if it expands directly into
> the corresponding RTL), then the macro should evaluate to 2.
> In the cases where the value is defined, @var{value} should be set to
> this value.
> 
> 
> aarch64-none-elf has been test on the model, no new issue.
> Okay for trunk?
> 
> Regards,
> Renlin Li
> 
> gcc/ChangeLog:
> 
> 2014-12-10 Renlin Li <renlin.li@arm.com>
> 
>          * config/aarch64/aarch64.h (CLZ_DEFINED_VALUE_AT_ZERO): make it 
> return 2.
>          (CTZ_DEFINED_VALUE_AT_ZERO): Update to support more modes.

OK.

R.
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index bbe33a9..3bc416a 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -804,9 +804,9 @@  do {									     \
    : reverse_condition (CODE))
 
 #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
-  ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE))
+  ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
 #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
-  ((VALUE) = ((MODE) == SImode ? 32 : 64), 2)
+  ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
 
 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, LR_REGNUM)