On Saturday 19 March 2011 10:22:37 Ignacy Gawedzki wrote: > On Sat, Mar 19, 2011 at 03:03:06AM +0100, thus spake Christian Lamparter: > > On Saturday 19 March 2011 02:22:44 Ignacy Gawedzki wrote: > > > If you define the global variables as volatile, then the optimization is > > > forbidden and you should get the bogus results. > > > > ??? > > No, "global" is enough. As long as you don't select "const". > > (In fact there's more of a story behind "const volatile" > > than you might think, or have you ever wondered why carl9170 > > still ships with gcc 4.4 instead of 4.5? Anyway that's OT) > > As a rule of thumb, I remembered that "volatile" tells the compiler "you're > not the only one to manage that variable, don't make any assumptions about its > current value", as could be the case if the variable is allocated in some > shared memory segment/register/whatever and might change "on its own". > Anyway, in the case at hand, it seems to make a difference. why not give it a try ;). define a and b as global variables, initialize them and try if a/b needs __udiv or not. you'll be surprised that no c-compiler (unless a buggy one) will even think about this sort of "constant" optimization. OT: the use of volatile is ill-reputed and many people have complained about it throughout the history. http://lwn.net/Articles/233482/ [which ended up in:] http://kernel.org/doc/Documentation/volatile-considered-harmful.txt the only reason why we get away with it is because most of it is locked up behind accessor functions in include/io.h & dma.h and it should remain that way. > BTW, it seems you have some detailed technical documentation about the AR9170 > at your disposal. I was wondering whether this is something available > publicly or not. Could be an interesting read at times. =) There are a lot of easy accessible docs about the CPU on the net. In fact you can even get Verilog/VHDL code of various SH2-clones without any problem. But that's about it, for information about the MAC/USB I have to rely on Chen. Best regards, Christian -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html