RFR: 8348561: Add aarch64 intrinsics for ML-DSA [v5]

Andrew Haley aph at openjdk.org
Tue Feb 25 13:19:03 UTC 2025


On Tue, 25 Feb 2025 13:14:52 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> @theRealAlph, maybe we are not reading the same manual (ARM DDI 0487K.a). In my copy:
>> SUB (extended register) is defined as
>> SUB <Xd|SP>, <Xn|SP>, <R><m>{, <extend> {#<amount>}}
>> and <R> should be W when <extend> is SXTH
>> and the as I have enforces this: 
>> 
>> ferakocz at ferakocz-mac aarch64 % cat t.s  
>> sub x1, x10, w23, sxth #2
>> ferakocz at ferakocz-mac aarch64 % cat > t1.s
>> sub x1, x10, x23, sxth #2
>> ferakocz at ferakocz-mac aarch64 % cat t.s
>> sub x1, x10, w23, sxth #2
>> ferakocz at ferakocz-mac aarch64 % cat t1.s
>> sub x1, x10, x23, sxth #2
>> ferakocz at ferakocz-mac aarch64 % as --version
>> Apple clang version 16.0.0 (clang-1600.0.26.6)
>> Target: arm64-apple-darwin24.3.0
>> Thread model: posix
>> InstalledDir: /Library/Developer/CommandLineTools/usr/bin
>> ferakocz at ferakocz-mac aarch64 % as t.s
>> ferakocz at ferakocz-mac aarch64 % objdump -D t.o
>> 
>> t.o:	file format mach-o arm64
>> 
>> Disassembly of section __TEXT,__text:
>> 
>> 0000000000000000 <ltmp0>:
>>        0: cb37a941     	sub	x1, x10, w23, sxth #2
>> ferakocz at ferakocz-mac aarch64 % as t1.s
>> t1.s:1:19: error: expected 'sxtx' 'uxtx' or 'lsl' with optional integer in range [0, 4]
>> sub x1, x10, x23, sxth #2
>>                     ^
>> 
>> I have not found the place in the manual where it allows/encourages the use of x<n> instead of w<n>, but I admit I haven't read through all of the 14568 pages.
>> 
>> So I'm stuck for now. What 'as' are you using?
>
>> I have not found the place in the manual where it allows/encourages the use of x instead of w, but I admit I > haven't read through all of the 14568 pages.
> 
> Yes, you've got a point, but it's always worked. Is this a macos thing, maybe?
> 
>> So I'm stuck for now. What 'as' are you using?
> 
> Latest binutils, today. I checked it out half an hour ago.
> 
> GNU assembler (GNU Binutils) 2.44.50.20250225
> Copyright (C) 2025 Free Software Foundation, Inc.
> 
> Try this:
> 
> 
> diff --git a/test/hotspot/gtest/aarch64/aarch64-asmtest.py b/test/hotspot/gtest/aarch64/aarch64-asmtest.py
> index 9c770632e25..b1674fff04d 100644
> --- a/test/hotspot/gtest/aarch64/aarch64-asmtest.py
> +++ b/test/hotspot/gtest/aarch64/aarch64-asmtest.py
> @@ -476,8 +476,13 @@ class AddSubExtendedOp(ThreeRegInstruction):
>                     + ", " + str(self.amount) + ");"))
>  
>      def astr(self):
> -        return (super(AddSubExtendedOp, self).astr()
> -                + (", " + AddSubExtendedOp.optNames[self.option]
> +        prefix = self.asmRegPrefix
> +        return (super(ThreeRegInstruction, self).astr()
> +                + ('%s, %s, %s'
> +                   % (self.reg[0].astr(prefix),
> +                      self.reg[1].astr(prefix),
> +                      self.reg[1].astr("w"))
> +                + ", " + AddSubExtendedOp.optNames[self.option]
>                     + " #" + str(self.amount)))
>  
>  class AddSubImmOp(TwoRegImmedInstruction):

I just tried it with top-of trunk latest binutils:

fedora:aarch64 $ ~/binutils-gdb-install/bin/as -march=armv9-a+sha3+sve2-bitperm aarch64ops.s
fedora:aarch64 $ ~/binutils-gdb-install/bin/as --version
GNU assembler (GNU Binutils) 2.44.50.20250225

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23300#discussion_r1969761898


More information about the hotspot-dev mailing list