Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v4]

2021-07-02 Thread Joe Darcy
On Fri, 2 Jul 2021 16:41:16 GMT, Brian Burkhalter wrote: >> Please consider this proposal to add a method >> `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and >> `java.lang.StrictMath`. > > Brian Burkhalter has refreshed the contents of this pull request, and > previous commits

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v4]

2021-07-02 Thread Brian Burkhalter
> Please consider this proposal to add a method > `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and > `java.lang.StrictMath`. Brian Burkhalter has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences com

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v4]

2021-07-02 Thread Andrew Haley
On Fri, 2 Jul 2021 16:37:21 GMT, Brian Burkhalter wrote: >> Please consider this proposal to add a method >> `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and >> `java.lang.StrictMath`. > > Brian Burkhalter has refreshed the contents of this pull request, and > previous commits

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v3]

2021-07-02 Thread Brian Burkhalter
> Please consider this proposal to add a method > `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and > `java.lang.StrictMath`. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8188044: Use multiplyHigh() to glevera

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Andrew Haley
On 7/2/21 4:30 PM, Raffaello Giulietti wrote: > FWIW, adinn's branchless code together with > PR https://git.openjdk.java.net/jdk/pull/4660 > make both methods less vulnerable to timing attacks. I doubt it, because HotSpot generates conditional select instructions for the popular systems, at least

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Andrew Dinn
On 02/07/2021 16:30, Raffaello Giulietti wrote: FWIW, adinn's branchless code together with PR https://git.openjdk.java.net/jdk/pull/4660 make both methods less vulnerable to timing attacks. That was indeed the point of the change. However, I doubt the difference in timing is going to be signifi

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Raffaello Giulietti
FWIW, adinn's branchless code together with PR https://git.openjdk.java.net/jdk/pull/4660 make both methods less vulnerable to timing attacks. Greetings Raffaello On 2021-07-02 15:50, Andrew Haley wrote: On Fri, 2 Jul 2021 11:06:06 GMT, Andrew Dinn wrote: You can also do that branchlessly

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Andrew Haley
On 7/2/21 12:26 PM, Raffaello Giulietti wrote: > ... or even as a one liner, like in the test > > return Math.multiplyHigh(x, y) + ((x >> (Long.SIZE - 1)) & y) + ((y >> > (Long.SIZE - 1)) & x); It was hard to write, so it should be hard to read too! :-)

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Andrew Haley
On Fri, 2 Jul 2021 13:47:40 GMT, Andrew Haley wrote: >> You can also do that branchlessly which might prove better >> >> long result = Math.multiplyHigh(x, y); >> result += (y & (x >> 63)); >> result += (x & (y >> 63)); >> return result; > >> You can also do t

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Andrew Haley
On Fri, 2 Jul 2021 11:06:06 GMT, Andrew Dinn wrote: > You can also do that branchlessly which might prove better > > ``` > long result = Math.multiplyHigh(x, y); > result += (y & (x >> 63)); > result += (x & (y >> 63)); > return result; > ``` I doubt very much that it would b

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Raffaello Giulietti
... or even as a one liner, like in the test return Math.multiplyHigh(x, y) + ((x >> (Long.SIZE - 1)) & y) + ((y >> (Long.SIZE - 1)) & x); On 2021-07-02 13:08, Andrew Dinn wrote: On Fri, 2 Jul 2021 09:39:46 GMT, Andrew Haley wrote: src/java.base/share/classes/java/lang/Math.java line 12

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Andrew Dinn
On Fri, 2 Jul 2021 09:39:46 GMT, Andrew Haley wrote: >> src/java.base/share/classes/java/lang/Math.java line 1211: >> >>> 1209: long z1 = t >>> 32; >>> 1210: >>> 1211: return x1 * y1 + z1 + (z0 >>> 32); >> >> Suggestion: >> >> long result = Math.multiplyHigh(x, y); >>

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Andrew Haley
On Fri, 2 Jul 2021 09:37:47 GMT, Andrew Haley wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8188044: Add @see links between multiplyHigh() and unsignedMultiplyHigh(). > > src/java.base/share/classes/java/lang

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-02 Thread Andrew Haley
On Thu, 1 Jul 2021 18:08:22 GMT, Brian Burkhalter wrote: >> Please consider this proposal to add a method >> `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and >> `java.lang.StrictMath`. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-01 Thread Eamonn McManus
On Thu, 1 Jul 2021 18:08:22 GMT, Brian Burkhalter wrote: >> Please consider this proposal to add a method >> `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and >> `java.lang.StrictMath`. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-01 Thread Brian Burkhalter
On Thu, 1 Jul 2021 18:08:22 GMT, Brian Burkhalter wrote: >> Please consider this proposal to add a method >> `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and >> `java.lang.StrictMath`. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-01 Thread Eamonn McManus
On Thu, 1 Jul 2021 18:08:22 GMT, Brian Burkhalter wrote: >> Please consider this proposal to add a method >> `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and >> `java.lang.StrictMath`. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh [v2]

2021-07-01 Thread Brian Burkhalter
> Please consider this proposal to add a method > `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and > `java.lang.StrictMath`. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision: 8188044: Add @see links between multip

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh

2021-07-01 Thread Roger Riggs
On Wed, 30 Jun 2021 23:13:06 GMT, Brian Burkhalter wrote: > Please consider this proposal to add a method > `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and > `java.lang.StrictMath`. Looks good. - Marked as reviewed by rriggs (Reviewer). PR: https://git.openjdk.

Re: RFR: 8188044: We need Math.unsignedMultiplyHigh

2021-06-30 Thread Brian Burkhalter
On Wed, 30 Jun 2021 23:13:06 GMT, Brian Burkhalter wrote: > Please consider this proposal to add a method > `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and > `java.lang.StrictMath`. This PR does not address intrinsics for the proposed method; that aspect can be handled subse

RFR: 8188044: We need Math.unsignedMultiplyHigh

2021-06-30 Thread Brian Burkhalter
Please consider this proposal to add a method `unsignedMultiplyHigh(long,long)` to each of `java.lang.Math` and `java.lang.StrictMath`. - Commit messages: - 8188044: We need Math.unsignedMultiplyHigh Changes: https://git.openjdk.java.net/jdk/pull/4644/files Webrev: https://webrevs