imul.asm 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. ;Testname=nowarn; Arguments=-fbin -oimul.bin; Files=stdout stderr imul.bin
  2. ;Testname=warn; Arguments=-DWARN -fbin -oimul.bin; Files=stdout stderr imul.bin
  3. %macro test 1-3 5 -2
  4. bits %1
  5. %undef MEM
  6. %if %1 == 16
  7. %define MEM [di]
  8. %elif %1 == 32
  9. %define MEM [edi]
  10. %elif %1 == 64
  11. %define MEM [rdi]
  12. %endif
  13. imul al
  14. imul byte MEM
  15. imul ax
  16. imul word MEM
  17. imul eax
  18. imul dword MEM
  19. %if %1 == 64
  20. imul rdx
  21. imul qword MEM
  22. %endif
  23. imul ax,cx
  24. imul ax,MEM
  25. imul ax,word MEM
  26. imul eax,ecx
  27. imul eax,MEM
  28. imul eax,dword MEM
  29. %if %1 == 64
  30. imul rax,rcx
  31. imul rax,MEM
  32. imul rax,qword MEM
  33. %endif
  34. imul ax,cx,%2
  35. imul ax,cx,byte %2
  36. imul ax,MEM,%2
  37. imul ax,word MEM,%2
  38. imul eax,ecx,%2
  39. imul eax,ecx,byte %2
  40. imul eax,MEM,%2
  41. imul eax,dword MEM,%2
  42. %if %1 == 64
  43. imul rax,rcx,%2
  44. imul rax,rcx,byte %2
  45. imul rax,MEM,%2
  46. imul rax,qword MEM,%2
  47. %endif
  48. imul ax,%2
  49. imul ax,byte %2
  50. imul eax,%2
  51. imul eax,byte %2
  52. %if %1 == 64
  53. imul rax,%2
  54. imul rax,byte %2
  55. %endif
  56. imul ax,cx,0x1234
  57. imul ax,MEM,0x1234
  58. imul ax,word MEM,0x1234
  59. imul eax,ecx,0x12345678
  60. imul eax,MEM,0x12345678
  61. imul eax,dword MEM,0x12345678
  62. %if %1 == 64
  63. imul rax,rcx,0x12345678
  64. imul rax,MEM,0x12345678
  65. imul rax,qword MEM,0x12345678
  66. %endif
  67. imul ax,0x1234
  68. imul eax,0x12345678
  69. %if %1 == 64
  70. imul rax,0x12345678
  71. %endif
  72. imul ax,cx,0xfffe
  73. imul ax,MEM,0xfffe
  74. imul ax,word MEM,0xfffe
  75. imul ax,cx,0xfe
  76. imul ax,MEM,0xfe
  77. imul ax,word MEM,0xfe
  78. imul eax,ecx,0xfffffffe
  79. imul eax,MEM,0xfffffffe
  80. imul eax,dword MEM,0xfffffffe
  81. imul eax,ecx,0xfffe
  82. imul eax,MEM,0xfffe
  83. imul eax,dword MEM,0xfffe
  84. %if %1 == 64
  85. imul rax,rcx,%3
  86. imul rax,MEM,%3
  87. imul rax,qword MEM,%3
  88. imul rax,rcx,0xfffe
  89. imul rax,MEM,0xfffe
  90. imul rax,qword MEM,0xfffe
  91. %endif
  92. imul ax,0xfffe
  93. imul eax,0xfffffffe
  94. %if %1 == 64
  95. imul rax,%3
  96. %endif
  97. %endmacro
  98. test 16
  99. test 32
  100. test 64
  101. %ifdef WARN
  102. test 16,0x999
  103. test 32,0x999999
  104. test 64,0x999999999,0xfffffffe
  105. %endif