@@ -40,6 +40,10 @@ interface
4040 ClpBinPolyX86Backend,
4141 ClpBinPolySimd,
4242{ $ENDIF CRYPTOLIB_X86_SIMD}
43+ { $IFDEF CRYPTOLIB_AARCH64_ASM}
44+ ClpBinPolyArmBackend,
45+ ClpBinPolySimd,
46+ { $ENDIF CRYPTOLIB_AARCH64_ASM}
4347 ClpBinPolyMulBaseBinomialReduce,
4448 CryptoLibTestBase;
4549
@@ -191,6 +195,20 @@ TTestBinPolyX86 = class(TBinPolyBackendTestBase)
191195 end ;
192196{ $ENDIF CRYPTOLIB_X86_SIMD}
193197
198+ { $IFDEF CRYPTOLIB_AARCH64_ASM}
199+ // / <summary>
200+ // / ARM (PMULL) instantiation of the BinPoly backend suite. Registered
201+ // / only when CRYPTOLIB_AARCH64_ASM is defined.
202+ // / </summary>
203+ TTestBinPolyArm = class (TBinPolyBackendTestBase)
204+ strict protected
205+ function BackendSupported : Boolean; override;
206+ function CreateBackendMul (AN: Int32; const AReduce: IBinPolyReduce)
207+ : IBinPolyMul; override;
208+ function BackendLabel : String; override;
209+ end ;
210+ { $ENDIF CRYPTOLIB_AARCH64_ASM}
211+
194212implementation
195213
196214const
@@ -1783,6 +1801,29 @@ function TTestBinPolyX86.BackendLabel: String;
17831801
17841802{ $ENDIF CRYPTOLIB_X86_SIMD}
17851803
1804+ { $IFDEF CRYPTOLIB_AARCH64_ASM}
1805+
1806+ { TTestBinPolyArm }
1807+
1808+ function TTestBinPolyArm.BackendSupported : Boolean;
1809+ begin
1810+ Result := TBinPolyArmBackend.IsSupported;
1811+ end ;
1812+
1813+ function TTestBinPolyArm.CreateBackendMul (AN: Int32;
1814+ const AReduce: IBinPolyReduce): IBinPolyMul;
1815+ begin
1816+ if not TBinPolySimd.TryCreateBinPolyMul(AN, AReduce, Result) then
1817+ Result := nil ;
1818+ end ;
1819+
1820+ function TTestBinPolyArm.BackendLabel : String;
1821+ begin
1822+ Result := ' ARM' ;
1823+ end ;
1824+
1825+ { $ENDIF CRYPTOLIB_AARCH64_ASM}
1826+
17861827initialization
17871828
17881829{ $IFDEF FPC}
@@ -1799,4 +1840,12 @@ initialization
17991840{ $ENDIF FPC}
18001841{ $ENDIF CRYPTOLIB_X86_SIMD}
18011842
1843+ { $IFDEF CRYPTOLIB_AARCH64_ASM}
1844+ { $IFDEF FPC}
1845+ RegisterTest(TTestBinPolyArm);
1846+ { $ELSE}
1847+ RegisterTest(TTestBinPolyArm.Suite);
1848+ { $ENDIF FPC}
1849+ { $ENDIF CRYPTOLIB_AARCH64_ASM}
1850+
18021851end .
0 commit comments