David Daney <dda...@caviumnetworks.com> writes: >> but insv is a standard pattern name. >> the semantics of expression x= (x&0xFF00FFFF) | ((i<<16)&0x00FF0000); >> is exactly what insv can do. >> I all tried mips gcc cross compiler, and ins is also not generated. > > You must be doing something wrong: > > $ cat fanqifei.c > struct test_foo { > unsigned int a:18; > unsigned int b:2; > unsigned int c:12; > };
It's relatively easy for gcc to use insv for a bitfield in a struct. It's quite a bit harder for it to use it for bit manipulation as in the above example of x = (x&0xFF00FFFF) | ((i<<16)&0x00FF0000). This case requires recognizing that insv applies at all. Ian