* [PATCH v1] LoongArch: Remove duplicate definition of CLZ_DEFINED_VALUE_AT_ZERO.
@ 2023-11-28 7:56 Li Wei
2023-11-29 1:53 ` Xi Ruoyao
0 siblings, 1 reply; 3+ messages in thread
From: Li Wei @ 2023-11-28 7:56 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, xuchenghua, chenglulu, Li Wei
In the r14-5547 commit, C[LT]Z_DEFINED_VALUE_AT_ZERO were defined at
the same time, but in fact, CLZ_DEFINED_VALUE_AT_ZERO has already been
defined, so remove the duplicate definition.
gcc/ChangeLog:
* config/loongarch/loongarch.h (CTZ_DEFINED_VALUE_AT_ZERO): Add
description.
(CLZ_DEFINED_VALUE_AT_ZERO): Remove duplicate definition.
---
gcc/config/loongarch/loongarch.h | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
index 115222e70fd..fa8a3f5582f 100644
--- a/gcc/config/loongarch/loongarch.h
+++ b/gcc/config/loongarch/loongarch.h
@@ -288,10 +288,12 @@ along with GCC; see the file COPYING3. If not see
/* Define if loading short immediate values into registers sign extends. */
#define SHORT_IMMEDIATES_SIGN_EXTEND 1
-/* The clz.{w/d} instructions have the natural values at 0. */
+/* The clz.{w/d}, ctz.{w/d} instructions have the natural values at 0. */
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
+#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
+ ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
/* Standard register usage. */
@@ -1239,8 +1241,3 @@ struct GTY (()) machine_function
#define TARGET_EXPLICIT_RELOCS \
(la_opt_explicit_relocs == EXPLICIT_RELOCS_ALWAYS)
-
-#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
- ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
-#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
- ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
--
2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] LoongArch: Remove duplicate definition of CLZ_DEFINED_VALUE_AT_ZERO.
2023-11-28 7:56 [PATCH v1] LoongArch: Remove duplicate definition of CLZ_DEFINED_VALUE_AT_ZERO Li Wei
@ 2023-11-29 1:53 ` Xi Ruoyao
2023-12-02 8:45 ` chenglulu
0 siblings, 1 reply; 3+ messages in thread
From: Xi Ruoyao @ 2023-11-29 1:53 UTC (permalink / raw)
To: Li Wei, gcc-patches; +Cc: i, xuchenghua, chenglulu
On Tue, 2023-11-28 at 15:56 +0800, Li Wei wrote:
> In the r14-5547 commit, C[LT]Z_DEFINED_VALUE_AT_ZERO were defined at
> the same time, but in fact, CLZ_DEFINED_VALUE_AT_ZERO has already been
> defined, so remove the duplicate definition.
>
> gcc/ChangeLog:
>
> * config/loongarch/loongarch.h (CTZ_DEFINED_VALUE_AT_ZERO): Add
> description.
> (CLZ_DEFINED_VALUE_AT_ZERO): Remove duplicate definition.
LGTM.
Interestingly the compiler does not give any warning when a macro is
redefined but with exactly same definition.
> ---
> gcc/config/loongarch/loongarch.h | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
> index 115222e70fd..fa8a3f5582f 100644
> --- a/gcc/config/loongarch/loongarch.h
> +++ b/gcc/config/loongarch/loongarch.h
> @@ -288,10 +288,12 @@ along with GCC; see the file COPYING3. If not see
> /* Define if loading short immediate values into registers sign extends. */
> #define SHORT_IMMEDIATES_SIGN_EXTEND 1
>
> -/* The clz.{w/d} instructions have the natural values at 0. */
> +/* The clz.{w/d}, ctz.{w/d} instructions have the natural values at 0. */
>
> #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
> ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
> +#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
> + ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
>
> /* Standard register usage. */
>
> @@ -1239,8 +1241,3 @@ struct GTY (()) machine_function
>
> #define TARGET_EXPLICIT_RELOCS \
> (la_opt_explicit_relocs == EXPLICIT_RELOCS_ALWAYS)
> -
> -#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
> - ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
> -#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
> - ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re:[pushed] [PATCH v1] LoongArch: Remove duplicate definition of CLZ_DEFINED_VALUE_AT_ZERO.
2023-11-29 1:53 ` Xi Ruoyao
@ 2023-12-02 8:45 ` chenglulu
0 siblings, 0 replies; 3+ messages in thread
From: chenglulu @ 2023-12-02 8:45 UTC (permalink / raw)
To: Xi Ruoyao, Li Wei, gcc-patches; +Cc: i, xuchenghua
Pushed to r14-6070.
在 2023/11/29 上午9:53, Xi Ruoyao 写道:
> On Tue, 2023-11-28 at 15:56 +0800, Li Wei wrote:
>> In the r14-5547 commit, C[LT]Z_DEFINED_VALUE_AT_ZERO were defined at
>> the same time, but in fact, CLZ_DEFINED_VALUE_AT_ZERO has already been
>> defined, so remove the duplicate definition.
>>
>> gcc/ChangeLog:
>>
>> * config/loongarch/loongarch.h (CTZ_DEFINED_VALUE_AT_ZERO): Add
>> description.
>> (CLZ_DEFINED_VALUE_AT_ZERO): Remove duplicate definition.
> LGTM.
>
> Interestingly the compiler does not give any warning when a macro is
> redefined but with exactly same definition.
>
>> ---
>> gcc/config/loongarch/loongarch.h | 9 +++------
>> 1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
>> index 115222e70fd..fa8a3f5582f 100644
>> --- a/gcc/config/loongarch/loongarch.h
>> +++ b/gcc/config/loongarch/loongarch.h
>> @@ -288,10 +288,12 @@ along with GCC; see the file COPYING3. If not see
>> /* Define if loading short immediate values into registers sign extends. */
>> #define SHORT_IMMEDIATES_SIGN_EXTEND 1
>>
>> -/* The clz.{w/d} instructions have the natural values at 0. */
>> +/* The clz.{w/d}, ctz.{w/d} instructions have the natural values at 0. */
>>
>> #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
>> ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
>> +#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
>> + ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
>>
>> /* Standard register usage. */
>>
>> @@ -1239,8 +1241,3 @@ struct GTY (()) machine_function
>>
>> #define TARGET_EXPLICIT_RELOCS \
>> (la_opt_explicit_relocs == EXPLICIT_RELOCS_ALWAYS)
>> -
>> -#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
>> - ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
>> -#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
>> - ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-02 8:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 7:56 [PATCH v1] LoongArch: Remove duplicate definition of CLZ_DEFINED_VALUE_AT_ZERO Li Wei
2023-11-29 1:53 ` Xi Ruoyao
2023-12-02 8:45 ` chenglulu
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).