123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658 |
- {$goto on}
- program bcase;
- {$mode objfpc}{$H+}
- uses
- SysUtils;
- { Utility functions }
- function GetRealTime(const st: TSystemTime): Real;
- begin
- Result := st.Hour*3600.0 + st.Minute*60.0 + st.Second + st.MilliSecond/1000.0;
- end;
- function GetRealTime : Real;
- var
- st:TSystemTime;
- begin
- GetLocalTime(st);
- result:=GetRealTime(st);
- end;
- function IIf(Condition: Boolean; TrueRes, FalseRes: Integer): Integer; inline;
- begin
- if Condition then
- Result := TrueRes
- else
- Result := FalseRes;
- end;
- const
- ITERATIONS = 33554432;
- AES_S_Box: array[Byte] of Byte = (
- $63, $7c, $77, $7b, $f2, $6b, $6f, $c5, $30, $01, $67, $2b, $fe, $d7, $ab, $76,
- $ca, $82, $c9, $7d, $fa, $59, $47, $f0, $ad, $d4, $a2, $af, $9c, $a4, $72, $c0,
- $b7, $fd, $93, $26, $36, $3f, $f7, $cc, $34, $a5, $e5, $f1, $71, $d8, $31, $15,
- $04, $c7, $23, $c3, $18, $96, $05, $9a, $07, $12, $80, $e2, $eb, $27, $b2, $75,
- $09, $83, $2c, $1a, $1b, $6e, $5a, $a0, $52, $3b, $d6, $b3, $29, $e3, $2f, $84,
- $53, $d1, $00, $ed, $20, $fc, $b1, $5b, $6a, $cb, $be, $39, $4a, $4c, $58, $cf,
- $d0, $ef, $aa, $fb, $43, $4d, $33, $85, $45, $f9, $02, $7f, $50, $3c, $9f, $a8,
- $51, $a3, $40, $8f, $92, $9d, $38, $f5, $bc, $b6, $da, $21, $10, $ff, $f3, $d2,
- $cd, $0c, $13, $ec, $5f, $97, $44, $17, $c4, $a7, $7e, $3d, $64, $5d, $19, $73,
- $60, $81, $4f, $dc, $22, $2a, $90, $88, $46, $ee, $b8, $14, $de, $5e, $0b, $db,
- $e0, $32, $3a, $0a, $49, $06, $24, $5c, $c2, $d3, $ac, $62, $91, $95, $e4, $79,
- $e7, $c8, $37, $6d, $8d, $d5, $4e, $a9, $6c, $56, $f4, $ea, $65, $7a, $ae, $08,
- $ba, $78, $25, $2e, $1c, $a6, $b4, $c6, $e8, $dd, $74, $1f, $4b, $bd, $8b, $8a,
- $70, $3e, $b5, $66, $48, $03, $f6, $0e, $61, $35, $57, $b9, $86, $c1, $1d, $9e,
- $e1, $f8, $98, $11, $69, $d9, $8e, $94, $9b, $1e, $87, $e9, $ce, $55, $28, $df,
- $8c, $a1, $89, $0d, $bf, $e6, $42, $68, $41, $99, $2d, $0f, $b0, $54, $bb, $16
- );
- FirstWeighted: array[0..255] of Byte = (
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63, $63,
- $ba, $78, $25, $2e, $1c, $a6, $b4, $c6, $e8, $dd, $74, $1f, $4b, $bd, $8b, $8a,
- $70, $3e, $b5, $66, $48, $03, $f6, $0e, $61, $35, $57, $b9, $86, $c1, $1d, $9e,
- $e1, $f8, $98, $11, $69, $d9, $8e, $94, $9b, $1e, $87, $e9, $ce, $55, $28, $df,
- $8c, $a1, $89, $0d, $bf, $e6, $42, $68, $41, $99, $2d, $0f, $b0, $54, $bb, $16
- );
- LastWeighted: array[0..255] of Byte = (
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16,
- $ba, $78, $25, $2e, $1c, $a6, $b4, $c6, $e8, $dd, $74, $1f, $4b, $bd, $8b, $8a,
- $70, $3e, $b5, $66, $48, $03, $f6, $0e, $61, $35, $57, $b9, $86, $c1, $1d, $9e,
- $e1, $f8, $98, $11, $69, $d9, $8e, $94, $9b, $1e, $87, $e9, $ce, $55, $28, $df,
- $8c, $a1, $89, $0d, $bf, $e6, $42, $68, $41, $99, $2d, $0f, $b0, $54, $bb, $16
- );
- AlmostFullExpected: array[0..255] of Byte = (
- $63, $7c, $77, $7b, $f2, $6b, $6f, $c5, $30, $01, $67, $2b, $fe, $d7, $ab, $76,
- $ca, $82, $c9, $7d, $fa, $59, $47, $f0, $ad, $d4, $a2, $af, $9c, $a4, $72, $c0,
- $b7, $fd, $93, $26, $36, $3f, $f7, $cc, $34, $a5, $e5, $f1, $71, $d8, $31, $15,
- $04, $c7, $23, $c3, $18, $96, $05, $9a, $07, $12, $80, $e2, $eb, $27, $b2, $75,
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
- $d0, $ef, $aa, $fb, $43, $4d, $33, $85, $45, $f9, $02, $7f, $50, $3c, $9f, $a8,
- $51, $a3, $40, $8f, $92, $9d, $38, $f5, $bc, $b6, $da, $21, $10, $ff, $f3, $d2,
- $cd, $0c, $13, $ec, $5f, $97, $44, $17, $c4, $a7, $7e, $3d, $64, $5d, $19, $73,
- $60, $81, $4f, $dc, $22, $2a, $90, $88, $46, $ee, $b8, $14, $de, $5e, $0b, $db,
- $e0, $32, $3a, $0a, $49, $06, $24, $5c, $c2, $d3, $ac, $62, $91, $95, $e4, $79,
- $e7, $c8, $37, $6d, $8d, $d5, $4e, $a9, $6c, $56, $f4, $ea, $65, $7a, $ae, $08,
- $ba, $78, $25, $2e, $1c, $a6, $b4, $c6, $e8, $dd, $74, $1f, $4b, $bd, $8b, $8a,
- $70, $3e, $b5, $66, $48, $03, $f6, $0e, $61, $35, $57, $b9, $86, $c1, $1d, $9e,
- $e1, $f8, $98, $11, $69, $d9, $8e, $94, $9b, $1e, $87, $e9, $ce, $55, $28, $df,
- $8c, $a1, $89, $0d, $bf, $e6, $42, $68, $41, $99, $2d, $0f, $b0, $54, $bb, $16
- );
- type
- TInstructionSet = ( { Truncated to 1024 entries }
- A_NONE = -512, A_ADC, A_ADD, A_AND, A_BSF, A_BSR, A_BSWAP, A_BT, A_BTC, A_BTR, A_BTS,
- A_CALL, A_CBW, A_CDQ, A_CLC, A_CLD, A_CLI, A_CLTS, A_CMC, A_CMP, A_CMPSB,
- A_CMPSD, A_CMPSW, A_CMPXCHG, A_CMPXCHG486, A_CMPXCHG8B, A_CPUID, A_CWD, A_CWDE,
- A_DEC, A_DIV, A_EMMS, A_ENTER, A_F2XM1, A_FABS, A_FADD, A_FADDP, A_FBLD, A_FBSTP,
- A_FCHS, A_FCLEX,A_FCMOVB, A_FCMOVBE, A_FCMOVE, A_FCMOVNB, A_FCMOVNBE, A_FCMOVNE,
- A_FCMOVNU, A_FCMOVU, A_FCOM, A_FCOMI, A_FCOMIP, A_FCOMP, A_FCOMPP, A_FCOS,
- A_FDECSTP, A_FDISI, A_FDIV, A_FDIVP, A_FDIVR, A_FDIVRP, A_FEMMS, A_FENI, A_FFREE,
- A_FIADD, A_FICOM, A_FICOMP, A_FIDIV, A_FIDIVR, A_FILD, A_FIMUL, A_FINCSTP,
- A_FINIT, A_FIST, A_FISTP, A_FISTTP, A_FISUB, A_FISUBR, A_FLD, A_FLD1, A_FLDCW,
- A_FLDENV, A_FLDL2E, A_FLDL2T, A_FLDLG2, A_FLDLN2, A_FLDPI, A_FLDZ, A_FMUL,
- A_FMULP, A_FNCLEX, A_FNDISI, A_FNENI, A_FNINIT, A_FNOP, A_FNSAVE, A_FNSTCW,
- A_FNSTENV, A_FNSTSW, A_FPATAN, A_FPREM, A_FPREM1, A_FPTAN, A_FRNDINT, A_FRSTOR,
- A_FSAVE, A_FSCALE, A_FSETPM, A_FSIN, A_FSINCOS, A_FSQRT, A_FST, A_FSTCW,
- A_FSTENV, A_FSTP, A_FSTSW, A_FSUB, A_FSUBP, A_FSUBR, A_FSUBRP, A_FTST, A_FUCOM,
- A_FUCOMI, A_FUCOMIP, A_FUCOMP, A_FUCOMPP, A_FWAIT, A_FXAM, A_FXCH, A_FXTRACT,
- A_FYL2X, A_FYL2XP1, A_HLT, A_IBTS, A_ICEBP, A_IDIV, A_IMUL, A_IN, A_INC, A_INSB,
- A_INSD, A_INSW, A_INT, A_INT01, A_INT1, A_INT03, A_INT3, A_INVD, A_INVLPG,
- A_IRET, A_IRETD, A_IRETW, A_IRETQ, A_JECXZ, A_JRCXZ, A_JMP, A_LAHF, A_LAR,
- A_LCALL, A_LEA, A_LEAVE, A_LFS, A_LGDT, A_LGS, A_LIDT, A_LJMP, A_LLDT, A_LMSW,
- A_LOADALL, A_LOADALL286, A_LOCK, A_LODSB, A_LODSD, A_LODSW, A_LOOP, A_LOOPE,
- A_LOOPNE, A_LOOPNZ, A_LOOPZ, A_LSL, A_LSS, A_LTR, A_MONITOR, A_MOV, A_MOVD,
- A_MOVQ, A_MOVSB, A_MOVSD, A_MOVSQ, A_MOVSW, A_MOVSX, A_MOVZX, A_MUL, A_MWAIT,
- A_NEG, A_NOP, A_NOT, A_OR, A_OUT, A_OUTSB, A_OUTSD, A_OUTSW, A_PACKSSDW,
- A_PACKSSWB, A_PACKUSWB, A_PADDB, A_PADDD, A_PADDSB, A_PADDSIW, A_PADDSW,
- A_PADDUSB, A_PADDUSW, A_PADDW, A_PAND, A_PANDN, A_PAVEB, A_PAVGUSB, A_PCMPEQB,
- A_PCMPEQD, A_PCMPEQW, A_PCMPGTB, A_PCMPGTD, A_PCMPGTW, A_PDISTIB, A_PF2ID,
- A_PFACC, A_PFADD, A_PFCMPEQ, A_PFCMPGE, A_PFCMPGT, A_PFMAX, A_PFMIN, A_PFMUL,
- A_PFRCP, A_PFRCPIT1, A_PFRCPIT2, A_PFRSQIT1, A_PFRSQRT, A_PFSUB, A_PFSUBR,
- A_PI2FD, A_PMACHRIW, A_PMADDWD, A_PMAGW, A_PMULHRIW, A_PMULHRWA, A_PMULHRWC,
- A_PMULHW, A_PMULLW, A_PMVGEZB, A_PMVLZB, A_PMVNZB, A_PMVZB, A_POP, A_POPF,
- A_POPFW, A_POPFQ, A_POR, A_PREFETCH, A_PREFETCHW, A_PSLLD, A_PSLLDQ, A_PSLLQ,
- A_PSLLW, A_PSRAD, A_PSRAW, A_PSRLD, A_PSRLQ, A_PSRLW, A_PSUBB, A_PSUBD, A_PSUBSB,
- A_PSUBSIW, A_PSUBSW, A_PSUBUSB, A_PSUBUSW, A_PSUBW, A_PUNPCKHBW, A_PUNPCKHDQ,
- A_PUNPCKHWD, A_PUNPCKLBW, A_PUNPCKLDQ, A_PUNPCKLWD, A_PUSH, A_PUSHF, A_PUSHFW,
- A_PUSHFQ, A_PXOR, A_RCL, A_RCR, A_RDSHR, A_RDMSR, A_RDPMC, A_RDTSC, A_REP,
- A_REPE, A_REPNE, A_REPNZ, A_REPZ, A_RET, A_RETF, A_RETN, A_RETW, A_RETFW,
- A_RETNW, A_RETFD, A_RETQ, A_RETFQ, A_RETNQ, A_ROL, A_ROR, A_RSDC, A_RSLDT, A_RSM,
- A_SAHF, A_SAL, A_SAR, A_SBB, A_SCASB, A_SCASD, A_SCASQ, A_SCASW, A_SEGCS,
- A_SEGDS, A_SEGES, A_SEGFS, A_SEGGS, A_SEGSS, A_SGDT, A_SHL, A_SHLD, A_SHR,
- A_SHRD, A_SIDT, A_SLDT, A_SMI, A_SMINT, A_SMINTOLD, A_SMSW, A_STC, A_STD, A_STI,
- A_STOSB, A_STOSD, A_STOSW, A_STR, A_SUB, A_SVDC, A_SVLDT, A_SVTS, A_SYSCALL,
- A_SYSENTER, A_SYSEXIT, A_SYSRET, A_TEST, A_UD1, A_UD2, A_UMOV, A_VERR, A_VERW,
- A_WAIT, A_WBINVD, A_WRSHR, A_WRMSR, A_XADD, A_XBTS, A_XCHG, A_XLAT, A_XLATB,
- A_XOR, A_XSTORE, A_XCRYPTECB, A_XCRYPTCBC, A_XCRYPTCFB, A_XCRYPTOFB, A_CMOVcc,
- A_Jcc, A_SETcc, A_MOVS, A_CMPS, A_SCAS, A_LODS, A_STOS, A_INS, A_OUTS, A_ADDPS,
- A_ADDSS, A_ANDNPS, A_ANDPS, A_CMPEQPS, A_CMPEQSS, A_CMPLEPS, A_CMPLESS,
- A_CMPLTPS, A_CMPLTSS, A_CMPNEQPS, A_CMPNEQSS, A_CMPNLEPS, A_CMPNLESS,
- A_CMPNLTPS, A_CMPNLTSS, A_CMPORDPS, A_CMPORDSS, A_CMPUNORDPS, A_CMPUNORDSS,
- A_CMPPS, A_CMPSS, A_COMISS, A_CVTPI2PS, A_CVTPS2PI, A_CVTSI2SS, A_CVTSS2SI,
- A_CVTTPS2PI, A_CVTTSS2SI, A_DIVPS, A_DIVSS, A_LDMXCSR, A_MAXPS, A_MAXSS, A_MINPS,
- A_MINSS, A_MOVAPS, A_MOVHPS, A_MOVLHPS, A_MOVLPS, A_MOVHLPS, A_MOVMSKPS,
- A_MOVNTPS, A_MOVSS, A_MOVUPS, A_MULPS, A_MULSS, A_ORPS, A_RCPPS, A_RCPSS,
- A_RSQRTPS, A_RSQRTSS, A_SHUFPS, A_SQRTPS, A_SQRTSS, A_STMXCSR, A_SUBPS, A_SUBSS,
- A_UCOMISS, A_UNPCKHPS, A_UNPCKLPS, A_XORPS, A_FXRSTOR, A_FXSAVE, A_PREFETCHNTA,
- A_PREFETCHT0, A_PREFETCHT1, A_PREFETCHT2, A_SFENCE, A_MASKMOVQ, A_MOVNTQ,
- A_PAVGB, A_PAVGW, A_PEXTRW, A_PINSRW, A_PMAXSW, A_PMAXUB, A_PMINSW, A_PMINUB,
- A_PMOVMSKB, A_PMULHUW, A_PSADBW, A_PSHUFW, A_PFNACC, A_PFPNACC, A_PI2FW, A_PF2IW,
- A_PSWAPD, A_FFREEP, A_MASKMOVDQU, A_CLFLUSH, A_MOVNTDQ, A_MOVNTI, A_MOVNTPD,
- A_PAUSE, A_LFENCE, A_MFENCE, A_MOVDQA, A_MOVDQU, A_MOVDQ2Q, A_MOVQ2DQ, A_PADDQ,
- A_PMULUDQ, A_PSHUFD, A_PSHUFHW, A_PSHUFLW, A_PSRLDQ, A_PSUBQ, A_PUNPCKHQDQ,
- A_PUNPCKLQDQ, A_ADDPD, A_ADDSD, A_ANDNPD, A_ANDPD, A_CMPEQPD, A_CMPEQSD,
- A_CMPLEPD, A_CMPLESD, A_CMPLTPD, A_CMPLTSD, A_CMPNEQPD, A_CMPNEQSD, A_CMPNLEPD,
- A_CMPNLESD, A_CMPNLTPD, A_CMPNLTSD, A_CMPORDPD, A_CMPORDSD, A_CMPUNORDPD,
- A_CMPUNORDSD, A_CMPPD, A_COMISD, A_CVTDQ2PD, A_CVTDQ2PS, A_CVTPD2DQ, A_CVTPD2PI,
- A_CVTPD2PS, A_CVTPI2PD, A_CVTPS2DQ, A_CVTPS2PD, A_CVTSD2SI, A_CVTSD2SS,
- A_CVTSI2SD, A_CVTSS2SD, A_CVTTPD2PI, A_CVTTPD2DQ, A_CVTTPS2DQ, A_CVTTSD2SI,
- A_DIVPD, A_DIVSD, A_MAXPD, A_MAXSD, A_MINPD, A_MINSD, A_MOVAPD, A_MOVHPD,
- A_MOVLPD, A_MOVMSKPD, A_MOVUPD, A_MULPD, A_MULSD, A_ORPD, A_SHUFPD, A_SQRTPD,
- A_SQRTSD, A_SUBPD, A_SUBSD, A_UCOMISD, A_UNPCKHPD, A_UNPCKLPD, A_XORPD,
- A_ADDSUBPD, A_ADDSUBPS, A_HADDPD, A_HADDPS, A_HSUBPD, A_HSUBPS, A_LDDQU,
- A_MOVDDUP, A_MOVSHDUP, A_MOVSLDUP, A_VMREAD, A_VMWRITE, A_VMCALL, A_VMLAUNCH,
- A_VMRESUME, A_VMXOFF, A_VMXON, A_VMCLEAR, A_VMPTRLD, A_VMPTRST, A_VMRUN,
- A_VMMCALL, A_VMLOAD, A_VMSAVE, A_STGI, A_CLGI, A_SKINIT, A_INVLPGA, A_MONTMUL,
- A_XSHA1, A_XSHA256, A_DMINT, A_RDM, A_MOVABS, A_MOVSXD, A_CQO, A_CDQE,
- A_CMPXCHG16B, A_MOVNTSS, A_MOVNTSD, A_INSERTQ, A_EXTRQ, A_LZCNT, A_PABSB,
- A_PABSW, A_PABSD, A_PALIGNR, A_PHADDW, A_PHADDD, A_PHADDSW, A_PHSUBW, A_PHSUBD,
- A_PHSUBSW, A_PMADDUBSW, A_PMULHRSW, A_PSHUFB, A_PSIGNB, A_PSIGNW, A_PSIGND,
- A_BLENDPS, A_BLENDPD, A_BLENDVPS, A_BLENDVPD, A_DPPS, A_DPPD, A_EXTRACTPS,
- A_INSERTPS, A_MOVNTDQA, A_MPSADBW, A_PACKUSDW, A_PBLENDVB, A_PBLENDW, A_PCMPEQQ,
- A_PEXTRB, A_PEXTRD, A_PEXTRQ, A_PHMINPOSUW, A_PINSRB, A_PINSRD, A_PINSRQ, A_PMAXSB,
- A_PMAXSD, A_PMAXUD, A_PMAXUW, A_PMINSB, A_PMINSD, A_PMINUW, A_PMINUD, A_PMOVSXBW,
- A_PMOVSXBD, A_PMOVSXBQ, A_PMOVSXWD, A_PMOVSXWQ, A_PMOVSXDQ, A_PMOVZXBW, A_PMOVZXBD,
- A_PMOVZXBQ, A_PMOVZXWD, A_PMOVZXWQ, A_PMOVZXDQ, A_PMULDQ, A_PMULLD, A_PTEST,
- A_ROUNDPS, A_ROUNDPD, A_ROUNDSS, A_ROUNDSD, A_CRC32, A_PCMPESTRI, A_PCMPESTRM,
- A_PCMPISTRI, A_PCMPISTRM, A_PCMPGTQ, A_POPCNT, A_AESENC, A_AESENCLAST, A_AESDEC,
- A_AESDECLAST, A_AESIMC, A_AESKEYGENASSIST, A_RDTSCP, A_STOSQ, A_LODSQ, A_CMPSQ,
- A_VADDPD, A_VADDPS, A_VADDSD, A_VADDSS, A_VADDSUBPD, A_VADDSUBPS, A_VAESDEC,
- A_VAESDECLAST, A_VAESENC, A_VAESENCLAST, A_VAESIMC, A_VAESKEYGENASSIST, A_VANDNPD,
- A_VANDNPS, A_VANDPD, A_VANDPS, A_VBLENDPD, A_VBLENDPS, A_VBLENDVPD, A_VBLENDVPS,
- A_VBROADCASTF128, A_VBROADCASTSD, A_VBROADCASTSS, A_VCMPEQPS, A_VCMPLTPS,
- A_VCMPLEPS, A_VCMPUNORDPS, A_VCMPNEQPS, A_VCMPNLTPS, A_VCMPNLEPS, A_VCMPORDPS,
- A_VCMPEQ_UQPS, A_VCMPNGEPS, A_VCMPNGTPS, A_VCMPFALSEPS, A_VCMPNEQ_OQPS,
- A_VCMPGEPS, A_VCMPGTPS, A_VCMPTRUEPS, A_VCMPEQ_OSPS, A_VCMPLT_OQPS, A_VCMPLE_OQPS,
- A_VCMPUNORD_SPS, A_VCMPNEQ_USPS, A_VCMPNLT_UQPS, A_VCMPNLE_UQPS, A_VCMPORD_SPS,
- A_VCMPEQ_USPS, A_VCMPNGE_UQPS, A_VCMPNGT_UQPS, A_VCMPFALSE_OSPS, A_VCMPNEQ_OSPS,
- A_VCMPGE_OQPS, A_VCMPGT_OQPS, A_VCMPTRUE_USPS, A_VCMPEQPD, A_VCMPLTPD, A_VCMPLEPD,
- A_VCMPUNORDPD, A_VCMPNEQPD, A_VCMPNLTPD, A_VCMPNLEPD, A_VCMPORDPD, A_VCMPEQ_UQPD,
- A_VCMPNGEPD, A_VCMPNGTPD, A_VCMPFALSEPD, A_VCMPNEQ_OQPD, A_VCMPGEPD, A_VCMPGTPD,
- A_VCMPTRUEPD, A_VCMPEQ_OSPD, A_VCMPLT_OQPD, A_VCMPLE_OQPD, A_VCMPUNORD_SPD,
- A_VCMPNEQ_USPD, A_VCMPNLT_UQPD, A_VCMPNLE_UQPD, A_VCMPORD_SPD, A_VCMPEQ_USPD,
- A_VCMPNGE_UQPD, A_VCMPNGT_UQPD, A_VCMPFALSE_OSPD, A_VCMPNEQ_OSPD, A_VCMPGE_OQPD,
- A_VCMPGT_OQPD, A_VCMPTRUE_USPD, A_VCMPPD, A_VCMPPS, A_VCMPSD, A_VCMPSS, A_VCOMISD,
- A_VCOMISS, A_VCVTDQ2PD, A_VCVTDQ2PS, A_VCVTPD2DQ, A_VCVTPD2PS, A_VCVTPS2DQ,
- A_VCVTPS2PD, A_VCVTSD2SI, A_VCVTSD2SS, A_VCVTSI2SD, A_VCVTSI2SS, A_VCVTSS2SD,
- A_VCVTSS2SI, A_VCVTTPD2DQ, A_VCVTTPS2DQ, A_VCVTTSD2SI, A_VCVTTSS2SI, A_VDIVPD,
- A_VDIVPS, A_VDIVSD, A_VDIVSS, A_VDPPD, A_VDPPS, A_VEXTRACTF128, A_VEXTRACTPS,
- A_VHADDPD, A_VHADDPS, A_VHSUBPD, A_VHSUBPS, A_VINSERTF128, A_VINSERTPS, A_VLDDQU,
- A_VLDMXCSR, A_VMASKMOVDQU, A_VMASKMOVPD, A_VMASKMOVPS, A_VMAXPD, A_VMAXPS,
- A_VMAXSD, A_VMAXSS, A_VMINPD, A_VMINPS, A_VMINSD, A_VMINSS, A_VMOVAPD, A_VMOVAPS,
- A_VMOVD, A_VMOVDDUP, A_VMOVDQA, A_VMOVDQU, A_VMOVHLPS, A_VMOVHPD, A_VMOVHPS,
- A_VMOVLHPS, A_VMOVLPD, A_VMOVLPS, A_VMOVMSKPD, A_VMOVMSKPS, A_VMOVNTDQ,
- A_VMOVNTDQA, A_VMOVNTPD, A_VMOVNTPS, A_VMOVQ, A_VMOVSD, A_VMOVSHDUP, A_VMOVSLDUP,
- A_VMOVSS, A_VMOVUPD, A_VMOVUPS, A_VMPSADBW, A_VMULPD, A_VMULPS, A_VMULSD,
- A_VMULSS, A_VORPD, A_VORPS, A_VPABSB, A_VPABSD, A_VPABSW, A_VPACKSSDW,
- A_VPACKSSWB, A_VPACKUSDW, A_VPACKUSWB, A_VPADDB, A_VPADDD, A_VPADDQ, A_VPADDSB,
- A_VPADDSW, A_VPADDUSB, A_VPADDUSW, A_VPADDW, A_VPALIGNR, A_VPAND, A_VPANDN,
- A_VPAVGB, A_VPAVGW, A_VPBLENDVB, A_VPBLENDW, A_VPCLMULQDQ, A_VPCMPEQB, A_VPCMPEQD,
- A_VPCMPEQQ, A_VPCMPEQW, A_VPCMPESTRI, A_VPCMPESTRM, A_VPCMPGTB, A_VPCMPGTD,
- A_VPCMPGTQ, A_VPCMPGTW, A_VPCMPISTRI, A_VPCMPISTRM, A_VPERM2F128, A_VPERMILPD,
- A_VPERMILPS, A_VPEXTRB, A_VPEXTRD, A_VPEXTRQ, A_VPEXTRW, A_VPHADDD, A_VPHADDSW,
- A_VPHADDW, A_VPHMINPOSUW, A_VPHSUBD, A_VPHSUBSW, A_VPHSUBW, A_VPINSRB, A_VPINSRD,
- A_VPINSRQ, A_VPINSRW, A_VPMADDUBSW, A_VPMADDWD, A_VPMAXSB, A_VPMAXSD, A_VPMAXSW,
- A_VPMAXUB, A_VPMAXUD, A_VPMAXUW, A_VPMINSB, A_VPMINSD, A_VPMINSW, A_VPMINUB,
- A_VPMINUD, A_VPMINUW, A_VPMOVMSKB, A_VPMOVSXBD, A_VPMOVSXBQ, A_VPMOVSXBW,
- A_VPMOVSXDQ, A_VPMOVSXWD, A_VPMOVSXWQ, A_VPMOVZXBD, A_VPMOVZXBQ, A_VPMOVZXBW,
- A_VPMOVZXDQ, A_VPMOVZXWD, A_VPMOVZXWQ, A_VPMULDQ, A_VPMULHRSW, A_VPMULHUW,
- A_VPMULHW, A_VPMULLD, A_VPMULLW, A_VPMULUDQ, A_VPOR, A_VPSADBW, A_VPSHUFB,
- A_VPSHUFD, A_VPSHUFHW, A_VPSHUFLW, A_VPSIGNB, A_VPSIGND, A_VPSIGNW, A_VPSLLD,
- A_VPSLLDQ, A_VPSLLQ, A_VPSLLW, A_VPSRAD, A_VPSRAW, A_VPSRLD, A_VPSRLDQ, A_VPSRLQ,
- A_VPSRLW, A_VPSUBB, A_VPSUBD, A_VPSUBQ, A_VPSUBSB, A_VPSUBSW, A_VPSUBUSB,
- A_VPSUBUSW, A_VPSUBW, A_VPTEST, A_VPUNPCKHBW, A_VPUNPCKHDQ, A_VPUNPCKHQDQ,
- A_VPUNPCKHWD, A_VPUNPCKLBW, A_VPUNPCKLDQ, A_VPUNPCKLQDQ, A_VPUNPCKLWD, A_VPXOR,
- A_VRCPPS, A_VRCPSS, A_VROUNDPD, A_VROUNDPS, A_VROUNDSD, A_VROUNDSS, A_VRSQRTPS,
- A_VRSQRTSS, A_VSHUFPD, A_VSHUFPS, A_VSQRTPD, A_VSQRTPS, A_VSQRTSD, A_VSQRTSS,
- A_VSTMXCSR, A_VSUBPD, A_VSUBPS, A_VSUBSD, A_VSUBSS, A_VTESTPD, A_VTESTPS,
- A_VUCOMISD, A_VUCOMISS, A_VUNPCKHPD, A_VUNPCKHPS, A_VUNPCKLPD, A_VUNPCKLPS,
- A_VXORPD, A_VXORPS, A_VZEROALL, A_VZEROUPPER, A_ANDN, A_BEXTR, A_TZCNT, A_BZHI,
- A_MULX, A_PDEP, A_PEXT, A_RORX, A_SARX, A_SHLX, A_SHRX, A_VBROADCASTI128,
- A_VEXTRACTI128, A_VINSERTI128, A_VPBLENDD, A_VPBROADCASTB, A_VPBROADCASTD,
- A_VPBROADCASTQ, A_VPBROADCASTW, A_VPERM2I128, A_VPERMD);
- const
- ExtremeRange1Expected: array[0..1023] of Byte = (
- $00, $00, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 0 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 16 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 32 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 48 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 64 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 80 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 96 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 112 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 128 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $09, { 144 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 160 }
- $00, $00, $00, $00, $00, $00, $00, $02, $00, $00, $00, $08, $00, $00, $03, $03, { 176 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 192 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 208 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 224 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 240 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 256 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 272 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 288 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0B, $00, $00, $00, $00, { 304 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $0B, $00, $00, $00, $00, $00, $00, { 320 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0A, $00, $00, $00, $00, $00, { 336 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 352 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $0C, $00, $00, $00, $00, $00, $00, { 368 }
- $00, $00, $07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 384 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 400 }
- $00, $00, $00, $00, $00, $05, $00, $00, $00, $00, $00, $00, $08, $05, $00, $07, { 416 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 432 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 448 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 464 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 480 }
- $07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 496 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 512 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $05, $00, $00, $00, $05, { 528 }
- $00, $07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 544 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 560 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 576 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 592 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 608 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 624 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 640 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 656 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $06, $06, $00, $00, $00, $00, { 672 }
- $00, $00, $00, $00, $00, $00, $06, $06, $00, $00, $00, $00, $00, $00, $00, $00, { 688 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 704 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 720 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 736 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 752 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 768 }
- $00, $00, $00, $00, $00, $00, $00, $06, $06, $00, $00, $00, $00, $00, $00, $00, { 784 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 800 }
- $04, $04, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 816 }
- $00, $00, $00, $08, $00, $00, $08, $04, $04, $00, $00, $00, $06, $06, $06, $06, { 832 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 848 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 864 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 880 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 896 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 912 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 928 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 944 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 960 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $06, $06, $00, { 976 }
- $00, $00, $00, $00, $00, $00, $00, $06, $06, $00, $00, $00, $00, $00, $00, $00, { 992 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 { 1008 }
- );
- ExtremeRange2Expected: array[0..1023] of Byte = (
- $00, $00, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 0 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 16 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 32 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 48 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 64 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 80 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 96 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 112 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 128 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $09, { 144 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 160 }
- $00, $00, $00, $00, $00, $00, $00, $02, $00, $00, $00, $26, $00, $00, $0D, $03, { 176 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 192 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 208 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 224 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 240 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 256 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 272 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 288 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0B, $00, $00, $00, $00, { 304 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $27, $00, $00, $00, $00, $00, $00, { 320 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0A, $00, $00, $00, $00, $00, { 336 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 352 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $0C, $00, $00, $00, $00, $00, $00, { 368 }
- $00, $00, $07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 384 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 400 }
- $00, $00, $00, $00, $00, $12, $00, $00, $00, $00, $00, $00, $08, $05, $00, $22, { 416 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 432 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 448 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 464 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 480 }
- $23, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 496 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 512 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $11, $00, $00, $00, $13, { 528 }
- $00, $21, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 544 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 560 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 576 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 592 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 608 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 624 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 640 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 656 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1A, $1B, $00, $00, $00, $00, { 672 }
- $00, $00, $00, $00, $00, $00, $1C, $1D, $00, $00, $00, $00, $00, $00, $00, $00, { 688 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 704 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 720 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 736 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 752 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 768 }
- $00, $00, $00, $00, $00, $00, $00, $14, $15, $00, $00, $00, $00, $00, $00, $00, { 784 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 800 }
- $0F, $0E, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 816 }
- $00, $00, $00, $24, $00, $00, $25, $04, $10, $00, $00, $00, $18, $19, $1E, $1F, { 832 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 848 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 864 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 880 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 896 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 912 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 928 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 944 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 960 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $16, $17, $00, { 976 }
- $00, $00, $00, $00, $00, $00, $00, $20, $06, $00, $00, $00, $00, $00, $00, $00, { 992 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 { 1008 }
- );
- ExtremeRange3Expected: array[0..1023] of Byte = (
- $00, $00, $44, $01, $3F, $40, $00, $00, $00, $41, $42, $00, $00, $00, $00, $00, { 0 }
- $00, $00, $00, $45, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 16 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 32 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 48 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 64 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 80 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 96 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 112 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 128 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $09, { 144 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 160 }
- $00, $00, $00, $00, $00, $00, $00, $02, $00, $00, $00, $26, $00, $00, $0D, $03, { 176 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 192 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 208 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 224 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 240 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 256 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 272 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 288 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0B, $00, $00, $00, $00, { 304 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $27, $00, $00, $00, $00, $00, $00, { 320 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0A, $00, $00, $00, $00, $00, { 336 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 352 }
- $00, $43, $00, $00, $00, $00, $00, $00, $00, $0C, $00, $00, $00, $00, $00, $00, { 368 }
- $00, $00, $07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 384 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 400 }
- $00, $00, $00, $00, $00, $12, $00, $00, $00, $00, $00, $00, $08, $05, $00, $22, { 416 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 432 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 448 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 464 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 480 }
- $23, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 496 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 512 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $11, $00, $00, $00, $13, { 528 }
- $00, $21, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 544 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 560 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 576 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 592 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $33, $34, $00, $00, $00, { 608 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 624 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 640 }
- $00, $00, $00, $2E, $2F, $30, $31, $32, $00, $00, $00, $00, $00, $00, $00, $00, { 656 }
- $00, $00, $00, $00, $00, $00, $00, $00, $2C, $2D, $1A, $1B, $00, $00, $35, $36, { 672 }
- $37, $38, $39, $3A, $00, $00, $1C, $1D, $00, $00, $00, $00, $29, $00, $00, $00, { 688 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 704 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 720 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 736 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 752 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 768 }
- $00, $00, $00, $00, $00, $00, $00, $14, $15, $00, $00, $00, $00, $00, $00, $00, { 784 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 800 }
- $0F, $0E, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 816 }
- $00, $00, $00, $24, $00, $00, $25, $04, $10, $00, $00, $00, $18, $19, $1E, $1F, { 832 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 848 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 864 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 880 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 896 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 912 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $3B, $3C, $3D, $3E, $00, $00, $00, { 928 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 944 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, { 960 }
- $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $16, $17, $00, { 976 }
- $00, $00, $00, $00, $00, $00, $00, $20, $06, $00, $00, $00, $00, $00, $00, $28, { 992 }
- $00, $00, $00, $00, $46, $47, $2A, $00, $00, $00, $00, $00, $00, $00, $00, $2B { 1008 }
- );
- { TTestAncestor }
- type
- TTestAncestor = class
- private
- FStartTime: Real;
- FEndTime: Real;
- FAvgTime: Real;
- procedure SetStartTime;
- procedure SetEndTime;
- protected
- procedure DoTestIteration(Iteration: Integer); virtual; abstract;
- public
- constructor Create; virtual;
- destructor Destroy; override;
- procedure Run;
- function TestTitle: shortstring; virtual; abstract;
- function WriteResults: Boolean; virtual; abstract;
- property RunTime: Real read FAvgTime;
- end;
- TTestClass = class of TTestAncestor;
- TByteTest = class(TTestAncestor)
- protected
- FResultStorage: array[Byte] of Byte;
- end;
- TWordTest = class(TTestAncestor)
- protected
- FResultStorage: array[Word] of Byte;
- end;
- TMappedTest = class(TByteTest)
- protected
- procedure DoMapping(Index, Input: Integer); virtual; abstract;
- end;
- TCompleteByteRange = class(TMappedTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- procedure DoMapping(Index, Input: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TCompleteByteRangeFirstWeighted = class(TCompleteByteRange)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TCompleteByteRangeLastWeighted = class(TCompleteByteRange)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TAlmostFullByteRange = class(TMappedTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- procedure DoMapping(Index, Input: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TAlmostFullByteRangeFirstWeighted = class(TAlmostFullByteRange)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TAlmostFullByteRangeLastWeighted = class(TAlmostFullByteRange)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWithDefault = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWithDefaultUnlikely = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWithDefaultWeighted = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWithElse = class(TSingleEntryWithDefault)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- end;
- TSingleEntryWithElseUnlikely = class(TSingleEntryWithDefaultUnlikely)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- end;
- TSingleEntryWithElseWeighted = class(TSingleEntryWithDefaultWeighted)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- end;
- TSingleEntryAtZeroWithElse = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryAtMinus1WithDefault = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryAtMinus4WithElse = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWith0To5RangeWithElse = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWith0To50RangeWithElse = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWith1To5RangeWithElse = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWith1To50RangeWithElse = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWithMinus1To5RangeWithElse = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSingleEntryWithMinus1To50RangeWithElse = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TExtremeRange1 = class(TWordTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TExtremeRange2 = class(TWordTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TExtremeRange3 = class(TWordTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TExtremeRange4 = class(TWordTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSparseDataTest1 = class(TWordTest)
- protected
- procedure DoCaseBlock(Index: Integer; Input: TInstructionSet); inline;
- end;
- TSparseDataEqual1 = class(TSparseDataTest1)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSparseDataMOVWeighted1 = class(TSparseDataTest1)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSparseDataMidpointWeighted1 = class(TSparseDataTest1)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSparseDataTest2 = class(TWordTest)
- protected
- procedure DoCaseBlock(Index: Integer; Input: TInstructionSet); inline;
- end;
- TSparseDataEqual2 = class(TSparseDataTest2)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSparseDataMOVWeighted2 = class(TSparseDataTest2)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSparseDataMidpointWeighted2 = class(TSparseDataTest2)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSparseDataTest3 = class(TWordTest)
- protected
- procedure DoCaseBlock(Index: Integer; Input: TInstructionSet); inline;
- end;
- TSparseDataEqual3 = class(TSparseDataTest3)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSparseDataMOVWeighted3 = class(TSparseDataTest3)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TSparseDataMidpointWeighted3 = class(TSparseDataTest3)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TLinearListDependsOnInput = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- TCStyleCascade = class(TByteTest)
- protected
- procedure DoTestIteration(Iteration: Integer); override;
- public
- function TestTitle: shortstring; override;
- function WriteResults: Boolean; override;
- end;
- { TTestAncestor }
- constructor TTestAncestor.Create;
- begin
- FStartTime := 0;
- FEndTime := 0;
- FAvgTime := 0;
- end;
- destructor TTestAncestor.Destroy;
- begin
- inherited Destroy;
- end;
- procedure TTestAncestor.SetStartTime;
- begin
- FStartTime := GetRealTime();
- end;
- procedure TTestAncestor.SetEndTime;
- begin
- FEndTime := GetRealTime();
- if FEndTime < FStartTime then { Happens if the test runs past midnight }
- FEndTime := FEndTime + 86400.0;
- end;
- procedure TTestAncestor.Run;
- var
- X: Integer;
- begin
- SetStartTime;
- for X := 0 to ITERATIONS - 1 do
- DoTestIteration(X);
- SetEndTime;
- FAvgTime := FEndTime - FStartTime;
- end;
- { TCompleteByteRange }
- function TCompleteByteRange.TestTitle: shortstring;
- begin
- Result := 'Byte domain, entirely covered; equal polling';
- end;
- function TCompleteByteRange.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 255 do
- if FResultStorage[X] <> AES_S_Box[X] then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(AES_S_Box[X], 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TCompleteByteRange.DoMapping(Index, Input: Integer);
- begin
- case Input of
- { First row of S-Box (except zero) }
- $00: FResultStorage[Index] := $63;
- $01: FResultStorage[Index] := $7c;
- $02: FResultStorage[Index] := $77;
- $03: FResultStorage[Index] := $7b;
- $04: FResultStorage[Index] := $f2;
- $05: FResultStorage[Index] := $6b;
- $06: FResultStorage[Index] := $6f;
- $07: FResultStorage[Index] := $c5;
- $08: FResultStorage[Index] := $30;
- $09: FResultStorage[Index] := $01;
- $0A: FResultStorage[Index] := $67;
- $0B: FResultStorage[Index] := $2b;
- $0C: FResultStorage[Index] := $fe;
- $0D: FResultStorage[Index] := $d7;
- $0E: FResultStorage[Index] := $ab;
- $0F: FResultStorage[Index] := $76;
- {Last row of S-Box }
- $F0: FResultStorage[Index] := $8c;
- $F1: FResultStorage[Index] := $a1;
- $F2: FResultStorage[Index] := $89;
- $F3: FResultStorage[Index] := $0d;
- $F4: FResultStorage[Index] := $bf;
- $F5: FResultStorage[Index] := $e6;
- $F6: FResultStorage[Index] := $42;
- $F7: FResultStorage[Index] := $68;
- $F8: FResultStorage[Index] := $41;
- $F9: FResultStorage[Index] := $99;
- $FA: FResultStorage[Index] := $2d;
- $FB: FResultStorage[Index] := $0f;
- $FC: FResultStorage[Index] := $b0;
- $FD: FResultStorage[Index] := $54;
- $FE: FResultStorage[Index] := $bb;
- $FF: FResultStorage[Index] := $16;
- { Everything else }
- $10..$EF: FResultStorage[Index] := AES_S_Box[Input];
- end;
- end;
- procedure TCompleteByteRange.DoTestIteration(Iteration: Integer);
- var
- Input: Byte;
- begin
- Input := Iteration and $FF;
- DoMapping(Input, Input);
- end;
- { TCompleteByteRangeFirstWeighted }
- function TCompleteByteRangeFirstWeighted.TestTitle: shortstring;
- begin
- Result := 'Byte domain, entirely covered; first weighted';
- end;
- function TCompleteByteRangeFirstWeighted.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 255 do
- if FResultStorage[X] <> FirstWeighted[X] then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(FirstWeighted[X], 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TCompleteByteRangeFirstWeighted.DoTestIteration(Iteration: Integer);
- var
- Input: Byte;
- begin
- Input := Iteration and $FF;
- if Input < $C0 then
- DoMapping(Input, 0)
- else
- DoMapping(Input, Input);
- end;
- { TCompleteByteRangeLastWeighted }
- function TCompleteByteRangeLastWeighted.TestTitle: shortstring;
- begin
- Result := 'Byte domain, entirely covered; last weighted';
- end;
- function TCompleteByteRangeLastWeighted.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 255 do
- if FResultStorage[X] <> LastWeighted[X] then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(LastWeighted[X], 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TCompleteByteRangeLastWeighted.DoTestIteration(Iteration: Integer);
- var
- Input: Byte;
- begin
- Input := Iteration and $FF;
- if Input < $C0 then
- DoMapping(Input, $FF)
- else
- DoMapping(Input, Input);
- end;
- { TAlmostFullByteRange }
- function TAlmostFullByteRange.TestTitle: shortstring;
- begin
- Result := 'Byte domain, almost entirely covered; equal polling';
- end;
- function TAlmostFullByteRange.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 255 do
- if FResultStorage[X] <> AlmostFullExpected[X] then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(AlmostFullExpected[X], 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TAlmostFullByteRange.DoMapping(Index, Input: Integer);
- begin
- case Input of
- { First row of S-Box }
- $00: FResultStorage[Index] := $63;
- $01: FResultStorage[Index] := $7c;
- $02: FResultStorage[Index] := $77;
- $03: FResultStorage[Index] := $7b;
- $04: FResultStorage[Index] := $f2;
- $05: FResultStorage[Index] := $6b;
- $06: FResultStorage[Index] := $6f;
- $07: FResultStorage[Index] := $c5;
- $08: FResultStorage[Index] := $30;
- $09: FResultStorage[Index] := $01;
- $0A: FResultStorage[Index] := $67;
- $0B: FResultStorage[Index] := $2b;
- $0C: FResultStorage[Index] := $fe;
- $0D: FResultStorage[Index] := $d7;
- $0E: FResultStorage[Index] := $ab;
- $0F: FResultStorage[Index] := $76;
- { Other rows }
- $10..$3F: FResultStorage[Index] := AES_S_Box[Input];
- $60..$FF: FResultStorage[Index] := AES_S_Box[Input];
- { Zeroed rows }
- else FResultStorage[Index] := $00;
- end;
- end;
- procedure TAlmostFullByteRange.DoTestIteration(Iteration: Integer);
- var
- Input: Byte;
- begin
- Input := Iteration and $FF;
- DoMapping(Input, Input);
- end;
- { TAlmostFullByteRangeFirstWeighted }
- function TAlmostFullByteRangeFirstWeighted.TestTitle: shortstring;
- begin
- Result := 'Byte domain, almost entirely covered; first weighted';
- end;
- function TAlmostFullByteRangeFirstWeighted.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 255 do
- if FResultStorage[X] <> FirstWeighted[X] then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(FirstWeighted[X], 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TAlmostFullByteRangeFirstWeighted.DoTestIteration(Iteration: Integer);
- var
- Input: Byte;
- begin
- Input := Iteration and $FF;
- if Input < $C0 then
- DoMapping(Input, 0)
- else
- DoMapping(Input, Input);
- end;
- { TAlmostFullByteRangeLastWeighted }
- function TAlmostFullByteRangeLastWeighted.TestTitle: shortstring;
- begin
- Result := 'Byte domain, almost entirely covered; last weighted';
- end;
- function TAlmostFullByteRangeLastWeighted.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 255 do
- if FResultStorage[X] <> LastWeighted[X] then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(LastWeighted[X], 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TAlmostFullByteRangeLastWeighted.DoTestIteration(Iteration: Integer);
- var
- Input: Byte;
- begin
- Input := Iteration and $FF;
- if Input < $C0 then
- DoMapping(Input, $FF)
- else
- DoMapping(Input, Input);
- end;
- { TSingleEntryWithDefault }
- function TSingleEntryWithDefault.TestTitle: shortstring;
- begin
- Result := 'Single entry with default value; 1/256 match chance';
- end;
- function TSingleEntryWithDefault.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 255 do
- if FResultStorage[X] <> IIf(X = 71, 1, 0) then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(IIf(X = 71, 1, 0), 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryWithDefault.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- FResultStorage[Index] := 0;
- case Index of
- 71: FResultStorage[Index] := 1;
- end;
- end;
- { TSingleEntryWithDefaultUnlikely }
- function TSingleEntryWithDefaultUnlikely.TestTitle: shortstring;
- begin
- Result := 'Single entry with default value; 75% match chance';
- end;
- function TSingleEntryWithDefaultUnlikely.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 255 do
- if FResultStorage[X] <> IIf(((X and $2) shr 1) or (X and $1) = 1, 1, 0) then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(IIf(((X and $2) shr 1) or (X and $1) = 1, 1, 0), 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryWithDefaultUnlikely.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- FResultStorage[Index] := 0;
- case ((Index and $2) shr 1) or (Index and $1) of
- 1: FResultStorage[Index] := 1;
- end;
- end;
- { TSingleEntryWithDefaultWeighted }
- function TSingleEntryWithDefaultWeighted.TestTitle: shortstring;
- begin
- Result := 'Single entry with default value; 25% match chance';
- end;
- function TSingleEntryWithDefaultWeighted.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 255 do
- if FResultStorage[X] <> IIf(((X and $2) shr 1) and (X and $1) = 1, 1, 0) then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(IIf(((X and $2) shr 1) and (X and $1) = 1, 1, 0), 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryWithDefaultWeighted.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- FResultStorage[Index] := 0;
- case ((Index and $2) shr 1) and (Index and $1) of
- 1: FResultStorage[Index] := 1;
- end;
- end;
- { TSingleEntryWithElse }
- function TSingleEntryWithElse.TestTitle: shortstring;
- begin
- Result := 'Single entry with else block; 1/256 match chance';
- end;
- procedure TSingleEntryWithElse.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Index] := $FF;
- case Index of
- 71: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryWithElseUnlikely }
- function TSingleEntryWithElseUnlikely.TestTitle: shortstring;
- begin
- Result := 'Single entry with else block; 75% match chance';
- end;
- procedure TSingleEntryWithElseUnlikely.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Index] := $FF;
- case ((Index and $2) shr 1) or (Index and $1) of
- 1: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryWithElseWeighted }
- function TSingleEntryWithElseWeighted.TestTitle: shortstring;
- begin
- Result := 'Single entry with else block; 25% match chance';
- end;
- procedure TSingleEntryWithElseWeighted.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Index] := $FF;
- case ((Index and $2) shr 1) and (Index and $1) of
- 1: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryAtZeroWithElse }
- function TSingleEntryAtZeroWithElse.TestTitle: shortstring;
- begin
- Result := 'Single entry of "0:" and else block';
- end;
- function TSingleEntryAtZeroWithElse.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- if FResultStorage[0] <> 1 then
- begin
- WriteLn('FAIL - Index 0; expected $01 got $', hexstr(FResultStorage[0], 2));
- Result := False;
- Exit;
- end;
- for X := 1 to $FF do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryAtZeroWithElse.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Index] := $FF;
- case Index of
- 0: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryAtMinus1WithDefault }
- function TSingleEntryAtMinus1WithDefault.TestTitle: shortstring;
- begin
- Result := 'Single entry of "-1:" with default value';
- end;
- function TSingleEntryAtMinus1WithDefault.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to $FE do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- if FResultStorage[255] <> 1 then
- begin
- WriteLn('FAIL - Index 255; expected $01 got $', hexstr(FResultStorage[0], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryAtMinus1WithDefault.DoTestIteration(Iteration: Integer);
- var
- Index: ShortInt;
- begin
- Index := ShortInt(Iteration and $FF);
- FResultStorage[Byte(Index)] := 0;
- case Index of
- -1: FResultStorage[255] := 1;
- end;
- end;
- { TSingleEntryAtMinus4WithElse }
- function TSingleEntryAtMinus4WithElse.TestTitle: shortstring;
- begin
- Result := 'Single entry of "-4:" and else block';
- end;
- function TSingleEntryAtMinus4WithElse.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to 251 do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- if FResultStorage[252] <> 1 then
- begin
- WriteLn('FAIL - Index 0; expected $01 got $', hexstr(FResultStorage[252], 2));
- Result := False;
- Exit;
- end;
- for X := 253 to 255 do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryAtMinus4WithElse.DoTestIteration(Iteration: Integer);
- var
- Index: ShortInt;
- begin
- Index := ShortInt(Iteration and $FF);
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Byte(Index)] := $FF;
- case Index of
- -4: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryWith0To5RangeWithElse }
- function TSingleEntryWith0To5RangeWithElse.TestTitle: shortstring;
- begin
- Result := 'Single entry of "0..5" and else block';
- end;
- function TSingleEntryWith0To5RangeWithElse.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to 5 do
- if FResultStorage[X] <> 1 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $01 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- for X := 6 to $FF do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryWith0To5RangeWithElse.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Index] := $FF;
- case Index of
- 0..5: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryWith0To50RangeWithElse }
- function TSingleEntryWith0To50RangeWithElse.TestTitle: shortstring;
- begin
- Result := 'Single entry of "0..50" and else block';
- end;
- function TSingleEntryWith0To50RangeWithElse.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to 50 do
- if FResultStorage[X] <> 1 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $01 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- for X := 51 to $FF do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryWith0To50RangeWithElse.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Index] := $FF;
- case Index of
- 0..50: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryWith1To5RangeWithElse }
- function TSingleEntryWith1To5RangeWithElse.TestTitle: shortstring;
- begin
- Result := 'Single entry of "1..5" and else block';
- end;
- function TSingleEntryWith1To5RangeWithElse.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- if FResultStorage[0] <> 0 then
- begin
- WriteLn('FAIL - Index 0; expected $00 got $', hexstr(FResultStorage[0], 2));
- Result := False;
- Exit;
- end;
- for X := 1 to 5 do
- if FResultStorage[X] <> 1 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $01 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- for X := 6 to $FF do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryWith1To5RangeWithElse.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Index] := $FF;
- case Index of
- 1..5: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryWith1To50RangeWithElse }
- function TSingleEntryWith1To50RangeWithElse.TestTitle: shortstring;
- begin
- Result := 'Single entry of "1..50" and else block';
- end;
- function TSingleEntryWith1To50RangeWithElse.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- if FResultStorage[0] <> 0 then
- begin
- WriteLn('FAIL - Index 0; expected $00 got $', hexstr(FResultStorage[0], 2));
- Result := False;
- Exit;
- end;
- for X := 1 to 50 do
- if FResultStorage[X] <> 1 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $01 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- for X := 51 to $FF do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryWith1To50RangeWithElse.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Index] := $FF;
- case Index of
- 1..50: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryWithMinus1To5RangeWithElse }
- function TSingleEntryWithMinus1To5RangeWithElse.TestTitle: shortstring;
- begin
- Result := 'Single entry of "-1..5" and else block';
- end;
- function TSingleEntryWithMinus1To5RangeWithElse.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to 5 do
- if FResultStorage[X] <> 1 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $01 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- for X := 6 to $FE do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- if FResultStorage[$FF] <> 1 then
- begin
- WriteLn('FAIL - Index 255; expected $00 got $', hexstr(FResultStorage[0], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryWithMinus1To5RangeWithElse.DoTestIteration(Iteration: Integer);
- var
- Index: ShortInt;
- begin
- Index := ShortInt(Iteration and $FF);
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Byte(Index)] := $FF;
- case Index of
- -1..5: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TSingleEntryWithMinus1To50RangeWithElse }
- function TSingleEntryWithMinus1To50RangeWithElse.TestTitle: shortstring;
- begin
- Result := 'Single entry of "-1..50" and else block';
- end;
- function TSingleEntryWithMinus1To50RangeWithElse.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to 50 do
- if FResultStorage[X] <> 1 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $01 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- for X := 51 to $FE do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- if FResultStorage[$FF] <> 1 then
- begin
- WriteLn('FAIL - Index 255; expected $00 got $', hexstr(FResultStorage[0], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSingleEntryWithMinus1To50RangeWithElse.DoTestIteration(Iteration: Integer);
- var
- Index: ShortInt;
- begin
- Index := ShortInt(Iteration and $FF);
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Byte(Index)] := $FF;
- case Index of
- -1..50: FResultStorage[Index] := 1;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TExtremeRange1 }
- function TExtremeRange1.TestTitle: shortstring;
- begin
- Result := 'Two labels, one with extreme spread, equal polling';
- end;
- function TExtremeRange1.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- if FResultStorage[0] <> 1 then
- begin
- WriteLn('FAIL - Index 0; expected $01 got $', hexstr(FResultStorage[0], 2));
- Result := False;
- Exit;
- end;
- for X := 1 to $FFFE do
- if FResultStorage[X] <> 2 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $02 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- if FResultStorage[65535] <> 0 then
- begin
- WriteLn('FAIL - Index 65535; expected $02 got $', hexstr(FResultStorage[65535], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TExtremeRange1.DoTestIteration(Iteration: Integer);
- var
- Index: Word;
- begin
- Index := Iteration and $FFFF;
- FResultStorage[Index] := 0; { Covers $FFFF }
- case Index of
- 0:
- FResultStorage[Index] := 1;
- 1..$FFFE:
- FResultStorage[Index] := 2;
- end;
- end;
- { TExtremeRange2 }
- function TExtremeRange2.TestTitle: shortstring;
- begin
- Result := 'Two labels, one with extreme spread, 50% else chance';
- end;
- function TExtremeRange2.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to $FFFF do
- if FResultStorage[X] <> (X and $1) then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(X and $1, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TExtremeRange2.DoTestIteration(Iteration: Integer);
- var
- Index, Input: Word;
- begin
- Index := (Iteration and $FFFF);
- Input := (Iteration and $1) - 1;
- FResultStorage[Index] := 0; { Covers $FFFF }
- case Input of
- 0..$FFFD:
- FResultStorage[Index] := 1;
- $FFFE:
- FResultStorage[Index] := 2;
- end;
- end;
- { TExtremeRange3 }
- function TExtremeRange3.TestTitle: shortstring;
- begin
- Result := 'Two labels, sparse values, equal polling across range';
- end;
- function TExtremeRange3.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- if FResultStorage[0] <> 1 then
- begin
- WriteLn('FAIL - Index 0; expected $01 got $', hexstr(FResultStorage[0], 2));
- Result := False;
- Exit;
- end;
- for X := 1 to $FFFE do
- if FResultStorage[X] <> 2 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $02 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- if FResultStorage[65535] <> 0 then
- begin
- WriteLn('FAIL - Index 65535; expected $02 got $', hexstr(FResultStorage[65535], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TExtremeRange3.DoTestIteration(Iteration: Integer);
- var
- Index: Word;
- begin
- Index := Iteration and $FFFF;
- FResultStorage[Index] := 2; { Covers 1..$FFFE }
- case Index of
- 0:
- FResultStorage[Index] := 1;
- $FFFF:
- FResultStorage[Index] := 0;
- end;
- end;
- { TExtremeRange4 }
- function TExtremeRange4.TestTitle: shortstring;
- begin
- Result := 'Two labels, sparse values, always triggered';
- end;
- function TExtremeRange4.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to $FFFF do
- if FResultStorage[X] <> (X and $1) then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(X and $1, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TExtremeRange4.DoTestIteration(Iteration: Integer);
- var
- Index, Input: Word;
- begin
- Index := (Iteration and $FFFF);
- Input := (Iteration and $1) - 1;
- FResultStorage[Index] := 2; { Covers 1..$FFFE }
- case Input of
- 0:
- FResultStorage[Index] := 1;
- $FFFF:
- FResultStorage[Index] := 0;
- end;
- end;
- { TSparseDataTest1 }
- procedure TSparseDataTest1.DoCaseBlock(Index: Integer; Input: TInstructionSet);
- begin
- case Input of
- A_AND:
- FResultStorage[Index] := 1;
- A_MOV:
- FResultStorage[Index] := 2;
- A_MOVSX,
- A_MOVZX:
- FResultStorage[Index] := 3;
- A_VMOVAPS,
- A_VMOVAPD,
- A_VMOVUPS,
- A_VMOVUPD:
- FResultStorage[Index] := 4;
- A_MOVAPD,
- A_MOVAPS,
- A_MOVUPD,
- A_MOVUPS:
- FResultStorage[Index] := 5;
- A_VDIVSD,
- A_VDIVSS,
- A_VSUBSD,
- A_VSUBSS,
- A_VMULSD,
- A_VMULSS,
- A_VADDSD,
- A_VADDSS,
- A_VANDPD,
- A_VANDPS,
- A_VORPD,
- A_VORPS,
- A_VXORPD,
- A_VXORPS:
- FResultStorage[Index] := 6;
- A_MULSD,
- A_MULSS,
- A_ADDSD,
- A_ADDSS:
- FResultStorage[Index] := 7;
- A_VMOVSD,
- A_VMOVSS,
- A_MOVSD,
- A_MOVSS:
- FResultStorage[Index] := 8;
- A_LEA:
- FResultStorage[Index] := 9;
- A_SUB:
- FResultStorage[Index] := 10;
- A_SHL,A_SAL:
- FResultStorage[Index] := 11;
- A_SETcc:
- FResultStorage[Index] := 12;
- else
- FResultStorage[Index] := 0;
- end;
- end;
- { TSparseDataEqual1 }
- function TSparseDataEqual1.TestTitle: shortstring;
- begin
- Result := 'Domain of 1024, 12 sparse labels, equal polling';
- end;
- function TSparseDataEqual1.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to 1023 do
- if FResultStorage[X] <> ExtremeRange1Expected[X] then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(ExtremeRange1Expected[X], 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSparseDataEqual1.DoTestIteration(Iteration: Integer);
- var
- X: SmallInt;
- begin
- X := Iteration and 1023;
- DoCaseBlock(X, TInstructionSet(X - 512))
- end;
- { TSparseDataMOVWeightedl }
- function TSparseDataMOVWeighted1.TestTitle: shortstring;
- begin
- Result := 'Domain of 1024, 12 sparse labels, 75% particular match';
- end;
- function TSparseDataMOVWeighted1.WriteResults: Boolean;
- var
- X, Expected: Word;
- begin
- Result := True;
- for X := 0 to 1023 do
- begin
- Expected := IIf((X and $3) = 0, ExtremeRange1Expected[X], 2);
- if FResultStorage[X] <> Expected then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(Expected, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- end;
- procedure TSparseDataMOVWeighted1.DoTestIteration(Iteration: Integer);
- var
- X: SmallInt; P: TInstructionSet;
- begin
- X := Iteration and 1023;
- P := TInstructionSet(IIf((X and $3) = 0, X - 512, Ord(A_MOV)));
- DoCaseBlock(X, P);
- end;
- { TSparseDataMidpointWeighted1 }
- function TSparseDataMidpointWeighted1.TestTitle: shortstring;
- begin
- Result := 'Domain of 1024, 12 sparse labels, 75% midpoint match';
- end;
- function TSparseDataMidpointWeighted1.WriteResults: Boolean;
- var
- X, Expected: Word;
- begin
- Result := True;
- for X := 0 to 1023 do
- begin
- Expected := IIf((X and $3) = 0, ExtremeRange1Expected[X], 6);
- if FResultStorage[X] <> Expected then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(Expected, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- end;
- procedure TSparseDataMidpointWeighted1.DoTestIteration(Iteration: Integer);
- var
- X: Word; P: TInstructionSet;
- begin
- X := Iteration and 1023;
- P := TInstructionSet(IIf((X and $3) = 0, X - 512, Ord(A_VADDSD)));
- DoCaseBlock(X, P);
- end;
- { TSparseDataTest2 }
- procedure TSparseDataTest2.DoCaseBlock(Index: Integer; Input: TInstructionSet);
- begin
- case Input of
- A_AND:
- FResultStorage[Index] := 1;
- A_MOV:
- FResultStorage[Index] := 2;
- A_MOVSX:
- FResultStorage[Index] := 13;
- A_MOVZX:
- FResultStorage[Index] := 3;
- A_VMOVAPS:
- FResultStorage[Index] := 14;
- A_VMOVAPD:
- FResultStorage[Index] := 15;
- A_VMOVUPS:
- FResultStorage[Index] := 16;
- A_VMOVUPD:
- FResultStorage[Index] := 4;
- A_MOVAPD:
- FResultStorage[Index] := 17;
- A_MOVAPS:
- FResultStorage[Index] := 18;
- A_MOVUPD:
- FResultStorage[Index] := 19;
- A_MOVUPS:
- FResultStorage[Index] := 5;
- A_VDIVSD:
- FResultStorage[Index] := 20;
- A_VDIVSS:
- FResultStorage[Index] := 21;
- A_VSUBSD:
- FResultStorage[Index] := 22;
- A_VSUBSS:
- FResultStorage[Index] := 23;
- A_VMULSD:
- FResultStorage[Index] := 24;
- A_VMULSS:
- FResultStorage[Index] := 25;
- A_VADDSD:
- FResultStorage[Index] := 26;
- A_VADDSS:
- FResultStorage[Index] := 27;
- A_VANDPD:
- FResultStorage[Index] := 28;
- A_VANDPS:
- FResultStorage[Index] := 29;
- A_VORPD:
- FResultStorage[Index] := 30;
- A_VORPS:
- FResultStorage[Index] := 31;
- A_VXORPD:
- FResultStorage[Index] := 32;
- A_VXORPS:
- FResultStorage[Index] := 6;
- A_MULSD:
- FResultStorage[Index] := 33;
- A_MULSS:
- FResultStorage[Index] := 34;
- A_ADDSD:
- FResultStorage[Index] := 35;
- A_ADDSS:
- FResultStorage[Index] := 7;
- A_VMOVSD:
- FResultStorage[Index] := 36;
- A_VMOVSS:
- FResultStorage[Index] := 37;
- A_MOVSD:
- FResultStorage[Index] := 38;
- A_MOVSS:
- FResultStorage[Index] := 8;
- A_LEA:
- FResultStorage[Index] := 9;
- A_SUB:
- FResultStorage[Index] := 10;
- A_SHL:
- FResultStorage[Index] := 39;
- A_SAL:
- FResultStorage[Index] := 11;
- A_SETcc:
- FResultStorage[Index] := 12;
- else
- FResultStorage[Index] := 0;
- end;
- end;
- { TSparseDataEqual2 }
- function TSparseDataEqual2.TestTitle: shortstring;
- begin
- Result := 'Domain of 1024, 39 sparse labels, equal polling';
- end;
- function TSparseDataEqual2.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to 1023 do
- if FResultStorage[X] <> ExtremeRange2Expected[X] then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(ExtremeRange2Expected[X], 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSparseDataEqual2.DoTestIteration(Iteration: Integer);
- var
- X: SmallInt;
- begin
- X := Iteration and 1023;
- DoCaseBlock(X, TInstructionSet(X - 512))
- end;
- { TSparseDataMOVWeighted2 }
- function TSparseDataMOVWeighted2.TestTitle: shortstring;
- begin
- Result := 'Domain of 1024, 39 sparse labels, 75% particular match';
- end;
- function TSparseDataMOVWeighted2.WriteResults: Boolean;
- var
- X, Expected: Word;
- begin
- Result := True;
- for X := 0 to 1023 do
- begin
- Expected := IIf((X and $3) = 0, ExtremeRange2Expected[X], 2);
- if FResultStorage[X] <> Expected then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(Expected, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- end;
- procedure TSparseDataMOVWeighted2.DoTestIteration(Iteration: Integer);
- var
- X: SmallInt; P: TInstructionSet;
- begin
- X := Iteration and 1023;
- P := TInstructionSet(IIf((X and $3) = 0, X - 512, Ord(A_MOV)));
- DoCaseBlock(X, P);
- end;
- { TSparseDataMidpointWeighted2 }
- function TSparseDataMidpointWeighted2.TestTitle: shortstring;
- begin
- Result := 'Domain of 1024, 39 sparse labels, 75% midpoint match';
- end;
- function TSparseDataMidpointWeighted2.WriteResults: Boolean;
- var
- X, Expected: Word;
- begin
- Result := True;
- for X := 0 to 1023 do
- begin
- Expected := IIf((X and $3) = 0, ExtremeRange2Expected[X], 26);
- if FResultStorage[X] <> Expected then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(Expected, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- end;
- procedure TSparseDataMidpointWeighted2.DoTestIteration(Iteration: Integer);
- var
- X: SmallInt; P: TInstructionSet;
- begin
- X := Iteration and 1023;
- P := TInstructionSet(IIf((X and $3) = 0, X - 512, Ord(A_VADDSD)));
- DoCaseBlock(X, P);
- end;
- { TSparseDataTest3 }
- procedure TSparseDataTest3.DoCaseBlock(Index: Integer; Input: TInstructionSet);
- begin
- case Input of
- A_AND:
- FResultStorage[Index] := 1;
- A_MOV:
- FResultStorage[Index] := 2;
- A_MOVSX:
- FResultStorage[Index] := 13;
- A_MOVZX:
- FResultStorage[Index] := 3;
- A_VMOVAPS:
- FResultStorage[Index] := 14;
- A_VMOVAPD:
- FResultStorage[Index] := 15;
- A_VMOVUPS:
- FResultStorage[Index] := 16;
- A_VMOVUPD:
- FResultStorage[Index] := 4;
- A_MOVAPD:
- FResultStorage[Index] := 17;
- A_MOVAPS:
- FResultStorage[Index] := 18;
- A_MOVUPD:
- FResultStorage[Index] := 19;
- A_MOVUPS:
- FResultStorage[Index] := 5;
- A_VDIVSD:
- FResultStorage[Index] := 20;
- A_VDIVSS:
- FResultStorage[Index] := 21;
- A_VSUBSD:
- FResultStorage[Index] := 22;
- A_VSUBSS:
- FResultStorage[Index] := 23;
- A_VMULSD:
- FResultStorage[Index] := 24;
- A_VMULSS:
- FResultStorage[Index] := 25;
- A_VADDSD:
- FResultStorage[Index] := 26;
- A_VADDSS:
- FResultStorage[Index] := 27;
- A_VANDPD:
- FResultStorage[Index] := 28;
- A_VANDPS:
- FResultStorage[Index] := 29;
- A_VORPD:
- FResultStorage[Index] := 30;
- A_VORPS:
- FResultStorage[Index] := 31;
- A_VXORPD:
- FResultStorage[Index] := 32;
- A_VXORPS:
- FResultStorage[Index] := 6;
- A_MULSD:
- FResultStorage[Index] := 33;
- A_MULSS:
- FResultStorage[Index] := 34;
- A_ADDSD:
- FResultStorage[Index] := 35;
- A_ADDSS:
- FResultStorage[Index] := 7;
- A_VMOVSD:
- FResultStorage[Index] := 36;
- A_VMOVSS:
- FResultStorage[Index] := 37;
- A_MOVSD:
- FResultStorage[Index] := 38;
- A_MOVSS:
- FResultStorage[Index] := 8;
- A_LEA:
- FResultStorage[Index] := 9;
- A_SUB:
- FResultStorage[Index] := 10;
- A_SHL:
- FResultStorage[Index] := 39;
- A_SAL:
- FResultStorage[Index] := 11;
- A_SETcc:
- FResultStorage[Index] := 12;
- A_MULX:
- FResultStorage[Index] := 40;
- A_VBROADCASTF128:
- FResultStorage[Index] := 41;
- A_VBROADCASTI128:
- FResultStorage[Index] := 42;
- A_VPERMD:
- FResultStorage[Index] := 43;
- A_VADDPD:
- FResultStorage[Index] := 44;
- A_VADDPS:
- FResultStorage[Index] := 45;
- A_ROUNDPS:
- FResultStorage[Index] := 46;
- A_ROUNDPD:
- FResultStorage[Index] := 47;
- A_ROUNDSS:
- FResultStorage[Index] := 48;
- A_ROUNDSD:
- FResultStorage[Index] := 49;
- A_CRC32:
- FResultStorage[Index] := 50;
- A_DPPS:
- FResultStorage[Index] := 51;
- A_DPPD:
- FResultStorage[Index] := 52;
- A_VAESDEC:
- FResultStorage[Index] := 53;
- A_VAESDECLAST:
- FResultStorage[Index] := 54;
- A_VAESENC:
- FResultStorage[Index] := 55;
- A_VAESENCLAST:
- FResultStorage[Index] := 56;
- A_VAESIMC:
- FResultStorage[Index] := 57;
- A_VAESKEYGENASSIST:
- FResultStorage[Index] := 58;
- A_VPSHUFB:
- FResultStorage[Index] := 59;
- A_VPSHUFD:
- FResultStorage[Index] := 60;
- A_VPSHUFHW:
- FResultStorage[Index] := 61;
- A_VPSHUFLW:
- FResultStorage[Index] := 62;
- A_BSF:
- FResultStorage[Index] := 63;
- A_BSR:
- FResultStorage[Index] := 64;
- A_BTR:
- FResultStorage[Index] := 65;
- A_BTS:
- FResultStorage[Index] := 66;
- A_XOR:
- FResultStorage[Index] := 67;
- A_ADD:
- FResultStorage[Index] := 68;
- A_CMP:
- FResultStorage[Index] := 69;
- A_SHLX:
- FResultStorage[Index] := 70;
- A_SHRX:
- FResultStorage[Index] := 71;
- else
- FResultStorage[Index] := 0;
- end;
- end;
- { TSparseDataEqual3 }
- function TSparseDataEqual3.TestTitle: shortstring;
- begin
- Result := 'Domain of 1024, 71 sparse labels, equal polling';
- end;
- function TSparseDataEqual3.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- for X := 0 to 1023 do
- if FResultStorage[X] <> ExtremeRange3Expected[X] then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(ExtremeRange3Expected[X], 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TSparseDataEqual3.DoTestIteration(Iteration: Integer);
- var
- X: SmallInt;
- begin
- X := Iteration and 1023;
- DoCaseBlock(X, TInstructionSet(X - 512))
- end;
- { TSparseDataMOVWeightedl }
- function TSparseDataMOVWeighted3.TestTitle: shortstring;
- begin
- Result := 'Domain of 1024, 71 sparse labels, 75% particular match';
- end;
- function TSparseDataMOVWeighted3.WriteResults: Boolean;
- var
- X, Expected: Word;
- begin
- Result := True;
- for X := 0 to 1023 do
- begin
- Expected := IIf((X and $3) = 0, ExtremeRange3Expected[X], 2);
- if FResultStorage[X] <> Expected then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(Expected, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- end;
- procedure TSparseDataMOVWeighted3.DoTestIteration(Iteration: Integer);
- var
- X: SmallInt; P: TInstructionSet;
- begin
- X := Iteration and 1023;
- P := TInstructionSet(IIf((X and $3) = 0, X - 512, Ord(A_MOV)));
- DoCaseBlock(X, P);
- end;
- { TSparseDataMidpointWeighted3 }
- function TSparseDataMidpointWeighted3.TestTitle: shortstring;
- begin
- Result := 'Domain of 1024, 71 sparse labels, 75% midpoint match';
- end;
- function TSparseDataMidpointWeighted3.WriteResults: Boolean;
- var
- X, Expected: Word;
- begin
- Result := True;
- for X := 0 to 1023 do
- begin
- Expected := IIf((X and $3) = 0, ExtremeRange3Expected[X], 26);
- if FResultStorage[X] <> Expected then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(Expected, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- end;
- procedure TSparseDataMidpointWeighted3.DoTestIteration(Iteration: Integer);
- var
- X: SmallInt; P: TInstructionSet;
- begin
- X := Iteration and 1023;
- P := TInstructionSet(IIf((X and $3) = 0, X - 512, Ord(A_VADDSD)));
- DoCaseBlock(X, P);
- end;
- { TLinearListDependsOnInput }
- function TLinearListDependsOnInput.TestTitle: shortstring;
- begin
- Result := 'Linear list depends on input';
- end;
- function TLinearListDependsOnInput.WriteResults: Boolean;
- var
- X: Word;
- begin
- Result := True;
- if FResultStorage[0] <> 0 then
- begin
- WriteLn('FAIL - Index 0; expected $00 got $', hexstr(FResultStorage[0], 2));
- Result := False;
- Exit;
- end;
- for X := 1 to 7 do
- if FResultStorage[X] <> (X and $3) then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr(X and $3, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- for X := 8 to 11 do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- if FResultStorage[12] <> $10 then
- begin
- WriteLn('FAIL - Index 12; expected $10 got $', hexstr(FResultStorage[12], 2));
- Result := False;
- Exit;
- end;
- for X := 13 to $FF do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TLinearListDependsOnInput.DoTestIteration(Iteration: Integer);
- var
- Index: Byte;
- begin
- Index := Iteration and $FF;
- { This helps catch errors where all branches, including else, are skipped }
- FResultStorage[Index] := $FF;
- case Index of
- 1..3: FResultStorage[Index] := Index;
- 4..7: FResultStorage[Index] := Index - 4;
- 12: FResultStorage[Index] := $10;
- else FResultStorage[Index] := 0;
- end;
- end;
- { TCStyleCascade }
- function TCStyleCascade.TestTitle: shortstring;
- begin
- Result := 'C-style cascade using ''goto''';
- end;
- function TCStyleCascade.WriteResults: Boolean;
- var
- X: Byte;
- begin
- Result := True;
- for X := 0 to 5 do
- if FResultStorage[X] <> ((1 shl X) - 1) then
- begin
- WriteLn('FAIL - Index ', X, '; expected $', hexstr((1 shl X) - 1, 2), ' got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- for X := 6 to $FF do
- if FResultStorage[X] <> 0 then
- begin
- WriteLn('FAIL - Index ', X, '; expected $00 got $', hexstr(FResultStorage[X], 2));
- Result := False;
- Exit;
- end;
- end;
- procedure TCStyleCascade.DoTestIteration(Iteration: Integer);
- var
- X, Tmp: Byte; P: TInstructionSet;
- label
- Set1, Set2, Set3, Set4, Default;
- begin
- X := Iteration and $FF;
- Tmp := 0;
- case X of
- $1: goto Set1;
- $2: goto Set2;
- $3: goto Set3;
- $4: goto Set4;
- $5: Tmp := 16;
- else
- goto Default;
- end;
- Set4:
- Tmp := Tmp or $8;
- Set3:
- Tmp := Tmp or $4;
- Set2:
- Tmp := Tmp or $2;
- Set1:
- Tmp := Tmp or $1;
- Default:
- FResultStorage[X] := Tmp;
- end;
- { Main function }
- const
- { TCompleteByteRange and descendants
- - Entirely-covered jump tree
- - 33 labels, no else block; full coverage (all 256 byte values covered)
- - Root: values are polled with equal probability
- - FirstWeighted: first branch is polled 3 times as often
- - LastWeighted: last branch is polled 3 times as often
- TAlmostFullByteRange
- - Almost full jump tree - 18 labels, else block covers 32 values; 224 byte values covered
- - Root: values are polled with equal probability
- - FirstWeighted: first branch is polled 3 times as often
- - LastWeighted: last branch is polled 3 times as often
- }
- TestClasses: array[0..35] of TTestClass = (
- TCompleteByteRange,
- TCompleteByteRangeFirstWeighted,
- TCompleteByteRangeLastWeighted,
- TAlmostFullByteRange,
- TAlmostFullByteRangeFirstWeighted,
- TAlmostFullByteRangeLastWeighted,
- TSingleEntryWithDefault,
- TSingleEntryWithDefaultUnlikely,
- TSingleEntryWithDefaultWeighted,
- TSingleEntryWithElse,
- TSingleEntryWithElseUnlikely,
- TSingleEntryWithElseWeighted,
- TSingleEntryAtZeroWithElse,
- TSingleEntryAtMinus1WithDefault,
- TSingleEntryAtMinus4WithElse,
- TSingleEntryWith0To5RangeWithElse,
- TSingleEntryWith0To50RangeWithElse,
- TSingleEntryWith1To5RangeWithElse,
- TSingleEntryWith1To50RangeWithElse,
- TSingleEntryWithMinus1To5RangeWithElse,
- TSingleEntryWithMinus1To50RangeWithElse,
- TExtremeRange1,
- TExtremeRange2,
- TExtremeRange3,
- TExtremeRange4,
- TSparseDataEqual1,
- TSparseDataMOVWeighted1,
- TSparseDataMidpointWeighted1,
- TSparseDataEqual2,
- TSparseDataMOVWeighted2,
- TSparseDataMidpointWeighted2,
- TSparseDataEqual3,
- TSparseDataMOVWeighted3,
- TSparseDataMidpointWeighted3,
- TLinearListDependsOnInput,
- TCStyleCascade
- );
- var
- CurrentObject: TTestAncestor;
- Failed: Boolean;
- X: Integer;
- SummedUpAverageDuration, AverageDuration : Double;
- begin
- SummedUpAverageDuration := 0.0;
- Failed := False;
- WriteLn('Case node compilation and timing test');
- WriteLn('-------------------------------------');
- for X := low(TestClasses) to High(TestClasses) do
- begin
- try
- CurrentObject := TestClasses[X].Create;
- try
- Write(CurrentObject.TestTitle:56, ' - ');
- CurrentObject.Run;
- if CurrentObject.WriteResults then
- begin
- AverageDuration := ((CurrentObject.RunTime * 1000000000.0) / ITERATIONS);
- WriteLn('Pass - average iteration duration: ', AverageDuration:1:3, ' ns');
- SummedUpAverageDuration := SummedUpAverageDuration + AverageDuration;
- end
- else
- { Final average isn't processed if a test failed, so there's no need
- to calculate and add the average duration to it }
- Failed := True;
- finally
- CurrentObject.Free;
- end;
- except on E: Exception do
- begin
- WriteLn('Exception "', E.ClassName, '" raised while running test object of class "', TestClasses[X].ClassName, '"');
- Failed := True;
- end;
- end;
- end;
- if Failed then
- Halt(1);
- WriteLn(#10'ok');
- WriteLn('- Sum of average durations: ', SummedUpAverageDuration:1:3, ' ns');
- WriteLn('- Overall average duration: ', (SummedUpAverageDuration / Length(TestClasses)):1:3, ' ns');
- end.
|