abs insn with QI and HI mode

Ying Yi M.Yi@ed.ac.uk
Tue Jul 10 09:35:00 GMT 2007


Hi Jim,

Thanks very much for your email. Will gcc add the optimization support  
in the future (method 1)? For method 2, if abs accept short/char, may  
I give the function names as sabs and qabs? Gcc does already have cabs  
as complex abs, doesn't it?

Best regards

Maggie

Quoting Jim Wilson <wilson@specifix.com>:

> Ying Yi wrote:
>> The generated codes do the following operations: 1) extend variable  
>>  a_HI (HImode) to temp variable SImode, and do abs operation with   
>> SImode operators. I find the gimple intermedia represention as   
>> shown below:
>
> abs is a standard library function that takes an int as an argument.
> So if you call abs(), then gcc must convert the argument to type int
> before generating code for the abs.
>
> To get your special char/short abs instructions, we need one of two things
> 1) Optimization support to recognize a sign-extend followed by an abs,
> where the target has an abs instruction that operates on the
> pre-extended value.  We can then optimize away the sign extend
> instruction.  This optimization support apparently does not exist at
> the moment, perhaps because no one has needed it before.
> 2)  Alternative abs function calls that accept short/char.  We already
> have abs (int), labs (long), llabs(long long), fabs (double), fabsf
> (float) and fabsl (long double).
> -- 
> Jim Wilson, GNU Tools Support, http://www.specifix.com





More information about the Gcc mailing list