Most arithmetic/logica instructions don't support X/WZR as operand (since you should use movk with the calculated constant in that case) Resolves #39372
@@ -346,6 +346,8 @@ Implementation
) and
{$ifdef AARCH64}
(taicpu(p).oper[1]^.reg<>NR_SP) and
+ { in this case you have to transform it to movk or the like }
+ (getsupreg(taicpu(p).oper[1]^.reg)<>RS_XZR) and
{$endif AARCH64}
not(RegUsedBetween(taicpu(p).oper[1]^.reg,p,hp1)) then
begin
@@ -0,0 +1,22 @@
+{ %norun }
+{ %opt=-O-1 }
+
+{ helpers can extend type parameters if they can only be classes }
+program Arm64Peep;
+{$ifdef fpc}
+ {$mode delphi}
+{$endif}
+type bob = class
+ function doInc: integer;
+end;
+function bob.doInc: integer;
+begin
+Result := 0;
+Inc(Result, 32);
+end.