On Tue, 25 Feb 2025 11:15:39 GMT, Ferenc Rakoczi <d...@openjdk.org> wrote:
>>> You might have to use an assembler from the latest binutils build (if the >>> system default isn't the latest) and add the path to the assembler in the >>> "AS" variable. Also you can run it something like - `python >>> aarch64-asmtest.py | expand > asmtest.out.h`. Please let me know if you >>> still face problems. >> >> People have been running this script for a decade now. >> >> Let's look at just one of these: >> >> >> aarch64ops.s:357:20: error: expected 'sxtx' 'uxtx' or 'lsl' with optional >> integer in range [0, 4] >> sub x1, x10, x23, sxth #2 >> >> >> From the AArch64 manual: >> >> SUB (extended register) >> SUB <Xd|SP>, <Xn|SP>, <R><m>{, <extend> {#<amount>}} >> >> It thinks this is a SUB (shifted register), bit it's really a SUB (extended >> register). >> >> >> fedora:aarch64 $ cat t.s >> sub x1, x10, x23, sxth #2 >> fedora:aarch64 $ as t.s >> fedora:aarch64 $ objdump -D a.out >> Disassembly of section .text: >> >> 0000000000000000 <.text>: >> 0: cb37a941 sub x1, x10, w23, sxth #2 >> >> >> So perhaps binutils expects w23 here, not x23. But the manual (ARM DDI >> 0487K.a) says x23 should be just fine, and, what's more, gives the x form >> preferred status. > > @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@ferakocz-mac aarch64 % cat t.s > sub x1, x10, w23, sxth #2 > ferakocz@ferakocz-mac aarch64 % cat > t1.s > sub x1, x10, x23, sxth #2 > ferakocz@ferakocz-mac aarch64 % cat t.s > sub x1, x10, w23, sxth #2 > ferakocz@ferakocz-mac aarch64 % cat t1.s > sub x1, x10, x23, sxth #2 > ferakocz@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@ferakocz-mac aarch64 % as t.s > ferakocz@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@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): ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23300#discussion_r1969760509