12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678 |
- {$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;
- {$push}
- {$warn 5057 off}
- function GetRealTime : Real;
- var
- st:TSystemTime;
- begin
- GetLocalTime(st);
- result:=GetRealTime(st);
- end;
- {$pop}
- function IIf(Condition: Boolean; TrueRes, FalseRes: Integer): Integer; inline;
- begin
- if Condition then
- Result := TrueRes
- else
- Result := FalseRes;
- end;
- const
- {$ifdef CONFORMANCE}
- ITERATIONS = $10000;
- {$else CONFORMANCE}
- ITERATIONS = 33554432;
- {$endif CONFORMANCE}
- 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[Byte(Index)] := 1;
- else FResultStorage[Byte(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[Byte(Index)] := 1;
- else FResultStorage[Byte(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[Byte(Index)] := 1;
- else FResultStorage[Byte(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
- {$push}
- {$r-}
- Index := (Iteration and $FFFF);
- Input := (Iteration and $1) - 1;
- {$pop}
- 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
- {$push}
- {$r-}
- Index := (Iteration and $FFFF);
- Input := (Iteration and $1) - 1;
- {$pop}
- 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;
- 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
- {$ifdef CONFORMANCE}
- WriteLn('Pass');
- {$else CONFORMANCE}
- AverageDuration := ((CurrentObject.RunTime * 1000000000.0) / ITERATIONS);
- WriteLn('Pass - average iteration duration: ', AverageDuration:1:3, ' ns');
- SummedUpAverageDuration := SummedUpAverageDuration + AverageDuration;
- {$endif CONFORMANCE}
- 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);
- {$ifdef CONFORMANCE}
- WriteLn(#10'ok');
- {$else CONFORMANCE}
- WriteLn(#10'- Sum of average durations: ', SummedUpAverageDuration:1:3, ' ns');
- WriteLn('- Overall average duration: ', (SummedUpAverageDuration / Length(TestClasses)):1:3, ' ns');
- {$endif CONFORMANCE}
- end.
|