Optimizing primes generating program in C++
I'm not sure what your optimizations are doing(comments would be nice), but I did notice several inefficiencies:

Never include a calculation in the limit test in a for loop.  It get's re-calculated on every iteration.  In this case set the limit to sqrt(limit).  the calculation is kind of expensive but it's done only once.

The same goes for the iteration step, calculate it once before you enter the loop.

In the tests, in the first set of loops, you use 3*x*x twice and y*y 3 times.  putting these in variables would be a lot cheaper.