tcnvset.pp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {****************************************************************}
  2. { CODE GENERATOR TEST PROGRAM }
  3. {****************************************************************}
  4. { NODE TESTED : secondtypeconvert() -> second_load_smallset }
  5. {****************************************************************}
  6. { PRE-REQUISITES: secondload() }
  7. { secondassign() }
  8. { secondtypeconv() }
  9. { secondadd() for sets }
  10. { secondsetelement() }
  11. {****************************************************************}
  12. { DEFINES: }
  13. { FPC = Target is FreePascal compiler }
  14. {****************************************************************}
  15. { REMARKS: }
  16. { }
  17. { }
  18. { }
  19. {****************************************************************}
  20. type
  21. { DO NOT CHANGE THE VALUES OF THESE ENUMERATIONS! }
  22. { This will fit into a 32-bit small set }
  23. tsmallenum = (dA,dB,dC,dd,de,df,dg,dh,di,dj,dk,dl,dm,dn,dop,dp,dq,dr);
  24. { This will fit into a normal 32-byte set }
  25. tbigenum = (A_ABCD,
  26. A_ADD,A_ADDA,A_ADDI,A_ADDQ,A_ADDX,A_AND,A_ANDI,
  27. A_ASL,A_ASR,A_BCC,A_BCS,A_BEQ,A_BGE,A_BGT,A_BHI,
  28. A_BLE,A_BLS,A_BLT,A_BMI,A_BNE,A_BPL,A_BVC,A_BVS,
  29. A_BCHG,A_BCLR,A_BRA,A_BSET,A_BSR,A_BTST,A_CHK,
  30. A_CLR,A_CMP,A_CMPA,A_CMPI,A_CMPM,A_DBCC,A_DBCS,A_DBEQ,A_DBGE,
  31. A_DBGT,A_DBHI,A_DBLE,A_DBLS,A_DBLT,A_DBMI,A_DBNE,A_DBRA,
  32. A_DBPL,A_DBT,A_DBVC,A_DBVS,A_DBF,A_DIVS,A_DIVU,
  33. A_EOR,A_EORI,A_EXG,A_ILLEGAL,A_EXT,A_JMP,A_JSR,
  34. A_LEA,A_LINK,A_LSL,A_LSR,A_MOVE,A_MOVEA,A_MOVEI,A_MOVEQ,
  35. A_MOVEM,A_MOVEP,A_MULS,A_MULU,A_NBCD,A_NEG,A_NEGX,
  36. A_NOP,A_NOT,A_OR,A_ORI,A_PEA,A_ROL,A_ROR,A_ROXL,
  37. A_ROXR,A_RTR,A_RTS,A_SBCD,A_SCC,A_SCS,A_SEQ,A_SGE,
  38. A_SGT,A_SHI,A_SLE,A_SLS,A_SLT,A_SMI,A_SNE,
  39. A_SPL,A_ST,A_SVC,A_SVS,A_SF,A_SUB,A_SUBA,A_SUBI,A_SUBQ,
  40. A_SUBX,A_SWAP,A_TAS,A_TRAP,A_TRAPV,A_TST,A_UNLK,
  41. A_RTE,A_RESET,A_STOP,
  42. A_BKPT,A_MOVEC,A_MOVES,A_RTD,
  43. A_BFCHG,A_BFCLR,A_BFEXTS,A_BFEXTU,A_BFFFO,
  44. A_BFINS,A_BFSET,A_BFTST,A_CALLM,A_CAS,A_CAS2,
  45. A_CHK2,A_CMP2,A_DIVSL,A_DIVUL,A_EXTB,A_PACK,A_RTM,
  46. A_TRAPCC,A_TRACS,A_TRAPEQ,A_TRAPF,A_TRAPGE,A_TRAPGT,
  47. A_TRAPHI,A_TRAPLE,A_TRAPLS,A_TRAPLT,A_TRAPMI,A_TRAPNE,
  48. A_TRAPPL,A_TRAPT,A_TRAPVC,A_TRAPVS,A_UNPK,
  49. { FPU Processor instructions - directly supported only. }
  50. { IEEE aware and misc. condition codes not supported }
  51. A_FABS,A_FADD,
  52. A_FBEQ,A_FBNE,A_FBNGT,A_FBGT,A_FBGE,A_FBNGE,
  53. A_FBLT,A_FBNLT,A_FBLE,A_FBGL,A_FBNGL,A_FBGLE,A_FBNGLE,
  54. A_FDBEQ,A_FDBNE,A_FDBGT,A_FDBNGT,A_FDBGE,A_FDBNGE,
  55. A_FDBLT,A_FDBNLT,A_FDBLE,A_FDBGL,A_FDBNGL,A_FDBGLE,A_FBDNGLE,
  56. A_FSEQ,A_FSNE,A_FSGT,A_FSNGT,A_FSGE,A_FSNGE,
  57. A_FSLT,A_FSNLT,A_FSLE,A_FSGL,A_FSNGL,A_FSGLE,A_FSNGLE,
  58. A_FCMP,A_FDIV,A_FMOVE,A_FMOVEM,
  59. A_FMUL,A_FNEG,A_FNOP,A_FSQRT,A_FSUB,A_FSGLDIV,
  60. A_FSFLMUL,A_FTST,
  61. A_FTRAPEQ,A_FTRAPNE,A_FTRAPGT,A_FTRAPNGT,A_FTRAPGE,A_FTRAPNGE,
  62. A_FTRAPLT,A_FTRAPNLT,A_FTRAPLE,A_FTRAPGL,A_FTRAPNGL,A_FTRAPGLE,A_FTRAPNGLE,
  63. A_CPRESTORE,A_CPSAVE,
  64. A_FRESTORE,A_FSAVE,A_PFLUSH,A_PFLUSHA,A_PLOAD,A_PMOVE,A_PTEST,
  65. A_LABEL,A_NONE);
  66. type
  67. tnormalset = set of tbigenum;
  68. tsmallset = set of tsmallenum;
  69. procedure fail;
  70. begin
  71. Writeln('Failed!');
  72. halt(1);
  73. end;
  74. procedure SmallSet2NormalSet;
  75. var
  76. op1: set of A_ABCD..A_BCS;
  77. op2: tnormalset;
  78. passed : boolean;
  79. begin
  80. passed := true;
  81. Write('Small Set -> Normal set conversion...');
  82. op1 := [A_BCS];
  83. op2 := op1;
  84. if op2 <> [A_BCS] then
  85. passed := false;
  86. op1 := [A_ADDI..A_ADDX];
  87. op2 := op1;
  88. if op2 <> [A_ADDI..A_ADDX] then
  89. passed := false;
  90. op1 := [A_BCS];
  91. op2 := [A_MOVE];
  92. op2 := op2 + op1;
  93. if op2 <> [A_BCS,A_MOVE] then
  94. passed := false;
  95. if not passed then
  96. Fail
  97. else
  98. WriteLn('Success.');
  99. end;
  100. Begin
  101. SmallSet2NormalSet;
  102. end.