public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: "roger@nextmovesoftware.com" <roger@nextmovesoftware.com>,
	       java-patches@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [JAVA PATCH] Builtin support for popcount* and bswap* functions
Date: Thu, 19 May 2016 18:09:00 -0000	[thread overview]
Message-ID: <106cccd3-68ed-6df7-1915-10cb817936a3@redhat.com> (raw)
In-Reply-To: <A2FAACD0-FA5D-4C85-82F6-42AEECBF0322@nextmovesoftware.com>

On 02/22/2016 11:13 AM, roger@nextmovesoftware.com wrote:
>
> The following patch provides builtin support for byte swapping and bit counting.
> On suitable hardware, these generate the x86 popcount instructions, as also
> generated by the SUN HotSpot JIT/JVM for these method calls.
>
> java.lang.Integer.bitCount -> __builtin_popcount
> java.lang.Long.bitCount -> __builtin_popcountl
>
> java.lang.Short.reverseBytes -> __builtin_bswap16
> java.lang.Integer.reverseBytes -> __builtin_bswap32
> java.lang.Long.reverseBytes -> __builtin_bswap64
>
> New test cases have been added to libjava to double check nothing breaks.
> Whist I was there I noticed that the math builtins (many of which I added support for
> back in 2003/2004) weren't marked as ECF_LEAF, indicating that they don't/can't
> invoke any user specified functions.   This has also been fixed in the patch below.
>
> The following patch has been tested on x86_64-pc-linux-gnu with a full make bootstrap
> and make check with no new failures/regressions.
>
> Ok for stage1 once it reopens?
>
> Cheers,
>
> Roger
> --
> Roger Sayle, Ph.D.
> CEO and founder
> NextMove Software Limited
> Registered in England No. 07588305
> Registered Office: Innovation Centre (Unit 23), Cambridge Science Park, Cambridge CB4 0EY
>
> 2016-02-21  Roger Sayle  <roger@nextmovesoftware.com>
>
> gcc/java:
> 	* builtins.c (java_builtins): Use popcount* and bswap* builtins to
> 	implement bitCount() and reverseBytes() methods in java.lang.Integer
> 	and friends.
> 	(initialize_builtins): Annotate math builtins with ECF_LEAF.  Call
> 	define_builtin for the new popcount* and bswap* builtins.
>
> libjava:
> 	* testsuite/libjava.lang/BuiltinBitCount.java: New test case.
> 	* testsuite/libjava.lang/BuiltinReverseBytes.java: Likewise.
OK for the trunk.

Thanks,
Jeff

      parent reply	other threads:[~2016-05-19 18:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 18:13 roger
2016-02-22 18:16 ` Andrew Haley
2016-05-19 18:09 ` Jeff Law [this message]

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=106cccd3-68ed-6df7-1915-10cb817936a3@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=java-patches@gcc.gnu.org \
    --cc=roger@nextmovesoftware.com \
    /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).