This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to generate BFI & BFC instruction in C

Hi friends,
I am using TI LM3s6965 micro controller.

I read the thumb-2 instruction set. Some instructions are interesting but as 'C' programmer I don't know how to write code to generate these instruction BFI, BFC.. etc

Is keil C compiler have special macro/function/syntax to generate these instruction??
Or some coding tricks??

Please suggest any application notes which demonstrate "How to write efficient C code for cortex-M3".

Thanks & Regards,
Kishore.

Parents
  • armcc will generate BFI etc. when it's a good thing to use, for example C constructs like these:

    struct S { int a:3; int b:3 };
    
    void f1(struct S* s, int x) { s->b = x; } // BFI
    int f2(int x, int y) { return (x & ~0x38) | ((y & 7) << 3); } // BFI
    

    but which instruction/s is/are used is not guaranteed.

Reply
  • armcc will generate BFI etc. when it's a good thing to use, for example C constructs like these:

    struct S { int a:3; int b:3 };
    
    void f1(struct S* s, int x) { s->b = x; } // BFI
    int f2(int x, int y) { return (x & ~0x38) | ((y & 7) << 3); } // BFI
    

    but which instruction/s is/are used is not guaranteed.

Children
No data