Ayonam Ray <ayonam@xxxxxxxxx> writes: > I'm wondering whether the compiler upon seeing an enum and an > immediate value as the arguments to the builtin is assuming that the > builtin does not have or create any dependence on the rest of the > code. That by itself should not do it unless you mark the builtin function as pure or const, which you did not do. I suspect that what is happening is something related but slightly different. The problem is not the arguments you are passing to the builtin function, it's the fact that your other code does not depend on memory, and gcc knows that a function call can only affect memory, nothing else. So gcc thinks that your other operations are independent of your builtin function. I think you are going to have to expand your builtin function into an asm very early on, and that asm is going to have to clobber all registers. There may be some other way to implement this, but offhand I don't know of one. Ian