2008/7/4 xiaoming gu <[EMAIL PROTECTED]>: > Hi, Aleksey. With a quick look I think the problem is in code > generation/selection and there are two files in jitrino - > Ia32CodeGenerator.cpp and Ia32CodeSelector.cpp. I'm planning to use the > simple case you mentioned to do some tracing and hope to find the problem. > Any comments? Actually I see two ways: 1. Patch InstCodeSelector::divOp (Ia32InstCodeSelector.cpp:850) to handle division by 2^k immediates. Need the quotient: do "shl reg, <value>", need the remainder: do "and reg, <mask>" (just came up with this, you'll need to investigate it). 2. Handle IDIV in peephole (Ia32Peephole.cpp), but there you should test whether you use quotient or remainder.
I think (1) is easier. Thanks, Aleksey.
