optimization.asm 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. ;Testname=O0; Arguments=-O0 -fbin -ooptimization.bin; Files=stdout stderr optimization.bin
  2. ;Testname=O1; Arguments=-O1 -fbin -ooptimization.bin; Files=stdout stderr optimization.bin
  3. ;Testname=Ox; Arguments=-Ox -fbin -ooptimization.bin; Files=stdout stderr optimization.bin
  4. BITS 32
  5. ; Simple
  6. jmp foo
  7. times 124 nop
  8. foo:
  9. ; Must start short to converge optimally
  10. jmp car
  11. times 127 nop
  12. car:
  13. ; Always near
  14. jmp cdr
  15. times 128 nop
  16. cdr:
  17. ; Simple
  18. add eax, quux2 - quux1
  19. quux1:
  20. times 127 nop
  21. quux2:
  22. ; Must start short
  23. corge1:
  24. add eax, corge2 - corge1
  25. times 127 - 3 nop
  26. corge2:
  27. ; Simple
  28. lea eax, [bolug2-bolug1]
  29. bolug1:
  30. times 127 nop
  31. bolug2:
  32. ; Must start short
  33. calog1:
  34. lea eax, [calog2-calog1]
  35. times 127 - 3 nop
  36. calog2:
  37. ; Simple
  38. lea eax, [eax+dolug2-dolug1]
  39. dolug1:
  40. times 127 nop
  41. dolug2:
  42. ; Must start short
  43. ealog1:
  44. lea eax, [eax+ealog2-ealog1]
  45. times 127 - 3 nop
  46. ealog2:
  47. ; Must stay long!
  48. lea eax, [eax+folug2-folug1]
  49. folug1:
  50. times 128 nop
  51. folug2:
  52. ; Must stay long!
  53. galog1:
  54. lea eax, [eax+galog2-galog1]
  55. times 128 - 3 nop
  56. galog2:
  57. ; Sbyte tests...
  58. onetwentysix equ 126
  59. onetwentynine equ 129
  60. add eax,onetwentyseven ; sbyte (forward)
  61. add eax,onetwentyeight ; not sbyte (forward)
  62. add eax,onetwentyseven ; sbyte (forward)
  63. add eax,onetwentysix ; sbyte (backward)
  64. add eax,onetwentynine ; not sbyte (backward)
  65. add ecx,onetwentyseven ; sbyte (forward)
  66. add ecx,onetwentyeight ; not sbyte (forward)
  67. add ecx,onetwentyseven ; sbyte (forward)
  68. add ecx,onetwentysix ; sbyte (backward)
  69. add ecx,onetwentynine ; not sbyte (backward)
  70. onetwentyseven equ 127
  71. onetwentyeight equ 128
  72. ; Simple
  73. add eax, holug2-holug1
  74. holug1:
  75. times 127 nop
  76. holug2:
  77. ; Must start short
  78. ialog1:
  79. add eax, ialog2-ialog1
  80. times 127 - 3 nop
  81. ialog2:
  82. ; Do not confuse forward references and segmentless addresses!
  83. jmp 12345