public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Meissner <meissner@linux.vnet.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>,
	       Segher Boessenkool <segher@kernel.crashing.org>,
	       David Edelsohn <dje.gcc@gmail.com>
Subject: [PATCH] Add attribute((target_clone(...))) to PowerPC
Date: Thu, 25 May 2017 18:54:00 -0000	[thread overview]
Message-ID: <20170525182549.GA29828@ibm-tiger.the-meissners.org> (raw)

This patch adds the initial attribute((target_clone(...))) support to the
PowerPC.  It looks at the HWCAP bits for ISA 2.05 (power6), ISA 2.06 (power7),
ISA 2.07 (power8) and ISA 3.0 (power9) to determine which clone function to
run.  The implementation used the existing i386/x86_64 support for target_clone
as a template.

At the moment, it has the same basic flaw that the i386/x86_64 implementation
has, which is outside of the current module, the default version of the
function is exported.  It is only in the module that the function is defined in
that supports calling the different target clones.  I hope to add support in
the future to make the exported function be the ifunc handler and not the
default version.  However, I wanted to get the basic framework into the
compiler before tackling that issue.

I have tested these patches on a little endian power8 system and there were no
regressions.  Can I install it into the trunk?

[gcc]
2017-05-24  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* config/rs6000/rs6000.c (toplevel): Include attribs.h.
	(enum clone_list): New enumeration to give the target clones
	processors we generate code for.
	(rs6000_clone_map): New array to identify which clone processors
	the current program is running on.
	(TARGET_COMPARE_VERSION_PRIORITY): Define to enable the
	target_clone attribute.
	(TARGET_GENERATE_VERSION_DISPATCHER_BODY): Likewise.
	(TARGET_GET_FUNCTION_VERSIONS_DISPATCHER): Likewise.
	(TARGET_OPTION_FUNCTION_VERSIONS): Likewise.
	(cpu_expand_builtin): Add support for target_clone attribute.
	(rs6000_valid_attribute_p): Allow "default" attribute.
	(get_decl_name): New debug function to simplify printing the
	current function name in debugging statements.
	(rs6000_clone_priority): New functions to support the target_clone
	attribute, and be able to generate code to switch between ISA 2.05
	through ISA 3.0 (power6 through power9).
	(rs6000_compare_version_priority): Likewise.
	(rs6000_get_function_versions_dispatcher): Likewise.
	(make_resolver_func): Likewise.
	(add_condition_to_bb): Likewise.
	(dispatch_function_versions): Likewise.
	(rs6000_generate_version_dispatcher_body): Likewise.
	(rs6000_can_inline_p): Call get_decl_name for debugging usage.
	* doc/extend.texi (Common Function Attributes): Document that the
	PowerPC supports the target_clone attribute.

[gcc/testsuite]
2017-05-24  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* gcc.target/powerpc/clone1.c: New test.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

             reply	other threads:[~2017-05-25 18:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 18:54 Michael Meissner [this message]
2017-05-25 20:05 ` Florian Weimer
2017-05-25 20:18   ` Michael Meissner
2017-05-30 22:04     ` Segher Boessenkool
2017-05-31  2:22       ` Michael Meissner
2017-05-31 23:15       ` Michael Meissner
2017-06-01  0:20         ` Michael Meissner
2017-06-01 20:43         ` Segher Boessenkool
2017-06-02 14:16           ` Michael Meissner
2017-06-02 16:56             ` Segher Boessenkool
2017-06-02 17:39               ` Michael Meissner
2017-06-02 17:41                 ` Segher Boessenkool
2017-06-05 21:20                   ` Michael Meissner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170525182549.GA29828@ibm-tiger.the-meissners.org \
    --to=meissner@linux.vnet.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).