This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, AVR]: PR49313, fix PR29524
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: Denis Chertykov <chertykov at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, "Eric B. Weddington" <eric dot weddington at atmel dot com>, Anatoly Sokolov <aesok at post dot ru>, Ian Lance Taylor <iant at google dot com>
- Date: Wed, 15 Jun 2011 13:03:09 +0200
- Subject: Re: [Patch, AVR]: PR49313, fix PR29524
- References: <4DF87FAD.4090104@gjlay.de> <BANLkTimwLi6RXin6LM7F1Ave1umvatrtQw@mail.gmail.com>
Denis Chertykov schrieb:
> 2011/6/15 Georg-Johann Lay <avr@gjlay.de>:
>> This is a patch that implements some libgcc functions in assembler.
>> The functions are used only very seldom but if, they lead to an
>> unpleasant waste of resource. For example, some SF functions
>> eventually lead to __clz_tab being dragged in (PR29524).
>>
>> This patch avoids that by straight forward assembler implementation of
>> functions that are easy to implement.
>>
>> Tested without regression. Moreover, I tested functions in some
>> self-written code against the old C-implementation. HI/QI functions
>> tested for all possible inputs.
>>
>
> Approved for AVR.
> May be you need another approval for longlong.h
>
> Denis.
CCed Ian Taylor as libgcc maintainer (assuming this is his preferred
address).
Unfortunately, the original mail could not yet be delivered to
gcc-patches; I got a message reading something like (backtranslated to
en):
Subject: [Patch, AVR]: PR49313, fix PR29524
Sender: avr@gjlay.de
Attention: Mail could not be delivered since 1 hour.
Following receiver is affected:
gcc-patches@gcc.gnu.org
Error : 452 4.0.0 Insufficient system storage
Explanation: host gcc.gnu.org [209.132.180.131] said: Message
denied temporarily
Last try: Wednesday, 15. Juni 2011 12:47:22 +0200 (MEST)
I never got such message, and the patch is not really big.
As I cannot backlink to the original message :-(
copy-pasteing the relevant change inline:
--
gcc/
PR target/49313
PR target/29524
* longlong.h: Add AVR support:
(count_leading_zeros): New macro.
(count_trailing_zeros): New macro.
(COUNT_LEADING_ZEROS_0): New macro.
Index: gcc/longlong.h
===================================================================
--- gcc/longlong.h (Revision 175036)
+++ gcc/longlong.h (Arbeitskopie)
@@ -250,6 +250,12 @@ UDItype __umulsidi3 (USItype, USItype);
#define COUNT_LEADING_ZEROS_0 32
#endif
+#if defined (__AVR__) && W_TYPE_SIZE == 32
+#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzl (X))
+#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzl (X))
+#define COUNT_LEADING_ZEROS_0 32
+#endif /* defined (__AVR__) && W_TYPE_SIZE == 32 */
+
#if defined (__CRIS__) && __CRIS_arch_version >= 3
#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
#if __CRIS_arch_version >= 8