This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [GCC][PATCH] Add __artificial__ attribute to Aarch64 NEON intrinsics




On 05/09/16 22:37, Andrew Pinski wrote:
On Mon, Sep 5, 2016 at 4:53 AM, Tamar Christina <Tamar.Christina@arm.com> wrote:
Hi all,

This patch adds __artificial__ attribute to the intrinsics
in arm_neon.h so that costs are associated to the user
function during profiling and during the intrinsics are
are hidden in trace.

The attribute does not affect code generation.

No new tests for this since it would require a gdb test
but regression tests on aarch64-none-elf was performed.
I think this is obvious.  Note I would change it one more step to be:
__extension__ extern__inline TYPE
__attribute__  ((__always_inline__, __gnu_inline__, __artificial__))

The main reason is because in C++98 (and I can't remember if C++11),
template are not supposed to consider a static function being a
candidate (though GCC does not get it right is no reason why not to
change it).

Hi Andrew,

I've updated the script and patch. New script is:

#!/bin/bash

# first apply to the ones in #define blocks and add extra \ at the end
sed -i -r 's/(__inline.+)(__attribute__\s*)\(\((.+)\)\)\s*\\/\1\\\n\2 \(\(\3, __gnu_inline__,__artificial__\)\) \\/m' \
 gcc/config/aarch64/arm_neon.h

# Then write all normal functions
sed -i -r 's/(__inline.+)(__attribute__\s*)\(\((.+)\)\)/\1\n\2 \(\(\3, __gnu_inline__, __artificial__\)\)/m' \
 gcc/config/aarch64/arm_neon.h

# Then correct any trailing whitespaces we might have introduced
sed -i 's/[ \t]*$//' \
 gcc/config/aarch64/arm_neon.h

# And then finish up by correcting some attribute values which don't fit the patterns above. sed -i -r 's/(__attribute__\s+)\(\((__always_inline__)\)\)\s+\\/\1\(\(\2, __gnu_inline__, __artificial__\)\) \\/m' \
 gcc/config/aarch64/arm_neon.h

# Replace static definitions with extern
sed -i -r 's/(__extension__\s+)static(.+)/\1extern\2/m' \
 gcc/config/aarch64/arm_neon.h

I've also update the patch.

Tamar


Thanks,
Andrew Pinski



The attribute was added with the following bash script:

#!/bin/bash

# first apply to the ones in #define blocks and add extra \ at the end
sed -i -r 's/(__inline.+)(__attribute__\s*)\(\((.+)\)\)\s*\\/\1\\\n\2 \(\(\3, __artificial__\)\) \\/m' \
  gcc/config/aarch64/arm_neon.h

# Then write all normal functions
sed -i -r 's/(__inline.+)(__attribute__\s*)\(\((.+)\)\)/\1\n\2 \(\(\3, __artificial__\)\)/m' \
  gcc/config/aarch64/arm_neon.h

# Then correct any trailing whitespaces we might have introduced
sed -i 's/[ \t]*$//' \
  gcc/config/aarch64/arm_neon.h

# And then finish up by correcting some attribute values which don't fit the patterns above.
sed -i -r 's/(__attribute__\s+)\(\((__always_inline__)\)\)\s+\\/\1\(\(\2, __artificial__\)\) \\/m' \
  gcc/config/aarch64/arm_neon.h

It would be easier I think to review/run the script than the changes.
But just for completeness I have attached the G-zipped patch file.

Ok for trunk?

PS. I don't have commit rights, so if OK can someone apply it for me?

Thanks,
Tamar

gcc/
2016-08-19  Tamar Christina  <tamar.christina@arm.com>

         * config/aarch64/arm_neon.h: Add __artificial__ attribute
           to all inlined functions

Attachment: attr.gzip
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]