[Patch] More minor compiler optimizations
Original Reporter info from Mantis: CuriousKit @CuriousKit
-
Reporter name: J. Gareth Moreton
Original Reporter info from Mantis: CuriousKit @CuriousKit
- Reporter name: J. Gareth Moreton
Description:
The "Minor_mod_refactoring" patch serves to clean up the code slightly for the new 'mod' optimizations, as well as fix a minor bug with one of the new test programs. The code produced for 'mod' hasn't changed, but the compiler source has been refactored a little bit.
The "Minor_div_improvement" patch reorganises the produced machine code for large unsigned divisions so as to make better use of 64-bit execution ports and reduce pipeline stalls (also reduces the size of the binary very slightly), and also switches out SBB for SETAE if possible - while the instruction change doesn't decrease code size or increase speed, it allows for future optimisations such as combining div and mod better, because SETAE doesn't modify the CPU flags, whereas SBB does.
Steps to reproduce:
Compile "tests/test/cg/tmoddiv3.pp" and evaluate the produced assembly. Apply the patch and compile again, comparing the produced assembly with the original for when dividing by 32-bit integers greater than $80000000.
Additional information:
None currently.
Mantis conversion info:
- Mantis ID: 32984
- OS: Windows 7 (64-bit)
- OS Build: Enterprise
- Build: x86_64-win64-win32/win64
- Platform: Win64
- Version: 3.1.1
- Fixed in version: 3.1.1
- Fixed in revision: 37950 (#4a98fcb9)
- Monitored by: » @CuriousKit (J. Gareth Moreton)