public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* ins instruction is not produced in the assembly code (mips32r2)
@ 2009-12-16  8:11 fanqifei
  0 siblings, 0 replies; 13+ messages in thread
From: fanqifei @ 2009-12-16  8:11 UTC (permalink / raw)
  To: gcc-help

Hello,
I am tring to compile a small c file using gcc4.1.2.
The source code:
struct test_foo {
unsigned int a:18;
unsigned int b:2;
unsigned int c:12;
};

struct test_foo x;
unsigned int foo()
{
    unsigned int a=x.b;
    x.b=2;
    return a;
}

the command: mipsel-linux-gcc -mips32r2 -O2 -c -Wall foo.c -o foo.o

The corresponding disassembly code:
foo.o:     file format elf32-tradlittlemips
Disassembly of section .text:
00000000 <foo>:
   0:   3c1c0000    lui gp,0x0
   4:   279c0000    addiu   gp,gp,0
   8:   0399e021    addu    gp,gp,t9
   c:   8f850000    lw  a1,0(gp)
  10:   3c03fff3    lui v1,0xfff3
  14:   3463ffff    ori v1,v1,0xffff
  18:   8ca20000    lw  v0,0(a1)
  1c:   3c040008    lui a0,0x8
  20:   00431824    and v1,v0,v1
  24:   00641825    or  v1,v1,a0
  28:   7c420c80    ext v0,v0,0x12,0x2
  2c:   03e00008    jr  ra
  30:   aca30000    sw  v1,0(a1)

The statement x.b=2 can be simply translated to lb and ins
instructions( ins is in mips32r2).

I wonder how ins instrution can be produced.
More specifically, how can gcc generates the insv pattern in RTL?
Is it related to the coding style -- using bit filed or logical
operations(shift, and ...)?

Thanks.
Qifei

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-01-12 10:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <f94afa700912152309r5d60f85cx943c5c2a98592383@mail.gmail.com>
2009-12-18 10:57 ` ins instruction is not produced in the assembly code (mips32r2) fanqifei
2009-12-18 11:00   ` Andrew Haley
2009-12-18 13:46   ` Ineiev
2009-12-18 13:58     ` fanqifei
2009-12-18 14:19       ` Ineiev
2009-12-18 14:21         ` fanqifei
2009-12-18 14:39       ` Andrew Haley
2009-12-18 14:54         ` fanqifei
2009-12-18 15:10           ` Andrew Haley
2010-01-12  7:28             ` fanqifei
2010-01-12 10:11               ` Andrew Haley
2009-12-18 18:12   ` David Daney
2009-12-16  8:11 fanqifei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).