123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- {****************************************************************}
- { CODE GENERATOR TEST PROGRAM }
- {****************************************************************}
- { NODE TESTED : secondtypeconvert() -> second_load_smallset }
- {****************************************************************}
- { PRE-REQUISITES: secondload() }
- { secondassign() }
- { secondtypeconv() }
- { secondadd() for sets }
- { secondsetelement() }
- {****************************************************************}
- { DEFINES: }
- { FPC = Target is FreePascal compiler }
- {****************************************************************}
- { REMARKS: }
- { }
- { }
- { }
- {****************************************************************}
- type
- { DO NOT CHANGE THE VALUES OF THESE ENUMERATIONS! }
- { This will fit into a 32-bit small set }
- tsmallenum = (dA,dB,dC,dd,de,df,dg,dh,di,dj,dk,dl,dm,dn,dop,dp,dq,dr);
- { This will fit into a normal 32-byte set }
- tbigenum = (A_ABCD,
- A_ADD,A_ADDA,A_ADDI,A_ADDQ,A_ADDX,A_AND,A_ANDI,
- A_ASL,A_ASR,A_BCC,A_BCS,A_BEQ,A_BGE,A_BGT,A_BHI,
- A_BLE,A_BLS,A_BLT,A_BMI,A_BNE,A_BPL,A_BVC,A_BVS,
- A_BCHG,A_BCLR,A_BRA,A_BSET,A_BSR,A_BTST,A_CHK,
- A_CLR,A_CMP,A_CMPA,A_CMPI,A_CMPM,A_DBCC,A_DBCS,A_DBEQ,A_DBGE,
- A_DBGT,A_DBHI,A_DBLE,A_DBLS,A_DBLT,A_DBMI,A_DBNE,A_DBRA,
- A_DBPL,A_DBT,A_DBVC,A_DBVS,A_DBF,A_DIVS,A_DIVU,
- A_EOR,A_EORI,A_EXG,A_ILLEGAL,A_EXT,A_JMP,A_JSR,
- A_LEA,A_LINK,A_LSL,A_LSR,A_MOVE,A_MOVEA,A_MOVEI,A_MOVEQ,
- A_MOVEM,A_MOVEP,A_MULS,A_MULU,A_NBCD,A_NEG,A_NEGX,
- A_NOP,A_NOT,A_OR,A_ORI,A_PEA,A_ROL,A_ROR,A_ROXL,
- A_ROXR,A_RTR,A_RTS,A_SBCD,A_SCC,A_SCS,A_SEQ,A_SGE,
- A_SGT,A_SHI,A_SLE,A_SLS,A_SLT,A_SMI,A_SNE,
- A_SPL,A_ST,A_SVC,A_SVS,A_SF,A_SUB,A_SUBA,A_SUBI,A_SUBQ,
- A_SUBX,A_SWAP,A_TAS,A_TRAP,A_TRAPV,A_TST,A_UNLK,
- A_RTE,A_RESET,A_STOP,
- A_BKPT,A_MOVEC,A_MOVES,A_RTD,
- A_BFCHG,A_BFCLR,A_BFEXTS,A_BFEXTU,A_BFFFO,
- A_BFINS,A_BFSET,A_BFTST,A_CALLM,A_CAS,A_CAS2,
- A_CHK2,A_CMP2,A_DIVSL,A_DIVUL,A_EXTB,A_PACK,A_RTM,
- A_TRAPCC,A_TRACS,A_TRAPEQ,A_TRAPF,A_TRAPGE,A_TRAPGT,
- A_TRAPHI,A_TRAPLE,A_TRAPLS,A_TRAPLT,A_TRAPMI,A_TRAPNE,
- A_TRAPPL,A_TRAPT,A_TRAPVC,A_TRAPVS,A_UNPK,
- { FPU Processor instructions - directly supported only. }
- { IEEE aware and misc. condition codes not supported }
- A_FABS,A_FADD,
- A_FBEQ,A_FBNE,A_FBNGT,A_FBGT,A_FBGE,A_FBNGE,
- A_FBLT,A_FBNLT,A_FBLE,A_FBGL,A_FBNGL,A_FBGLE,A_FBNGLE,
- A_FDBEQ,A_FDBNE,A_FDBGT,A_FDBNGT,A_FDBGE,A_FDBNGE,
- A_FDBLT,A_FDBNLT,A_FDBLE,A_FDBGL,A_FDBNGL,A_FDBGLE,A_FBDNGLE,
- A_FSEQ,A_FSNE,A_FSGT,A_FSNGT,A_FSGE,A_FSNGE,
- A_FSLT,A_FSNLT,A_FSLE,A_FSGL,A_FSNGL,A_FSGLE,A_FSNGLE,
- A_FCMP,A_FDIV,A_FMOVE,A_FMOVEM,
- A_FMUL,A_FNEG,A_FNOP,A_FSQRT,A_FSUB,A_FSGLDIV,
- A_FSFLMUL,A_FTST,
- A_FTRAPEQ,A_FTRAPNE,A_FTRAPGT,A_FTRAPNGT,A_FTRAPGE,A_FTRAPNGE,
- A_FTRAPLT,A_FTRAPNLT,A_FTRAPLE,A_FTRAPGL,A_FTRAPNGL,A_FTRAPGLE,A_FTRAPNGLE,
- A_CPRESTORE,A_CPSAVE,
- A_FRESTORE,A_FSAVE,A_PFLUSH,A_PFLUSHA,A_PLOAD,A_PMOVE,A_PTEST,
- A_LABEL,A_NONE);
- type
- tnormalset = set of tbigenum;
- tsmallset = set of tsmallenum;
- procedure fail;
- begin
- Writeln('Failed!');
- halt(1);
- end;
- procedure SmallSet2NormalSet;
- var
- op1: set of A_ABCD..A_BCS;
- op2: tnormalset;
- passed : boolean;
- begin
- passed := true;
- Write('Small Set -> Normal set conversion...');
- op1 := [A_BCS];
- op2 := op1;
- if op2 <> [A_BCS] then
- passed := false;
- op1 := [A_ADDI..A_ADDX];
- op2 := op1;
- if op2 <> [A_ADDI..A_ADDX] then
- passed := false;
- op1 := [A_BCS];
- op2 := [A_MOVE];
- op2 := op2 + op1;
- if op2 <> [A_BCS,A_MOVE] then
- passed := false;
- if not passed then
- Fail
- else
- WriteLn('Success.');
- end;
- Begin
- SmallSet2NormalSet;
- end.
|