[Patch, AVR]: PR49313, fix PR29524

Georg-Johann Lay avr@gjlay.de
Wed Jun 15 11:59:00 GMT 2011


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



More information about the Gcc-patches mailing list