Jie Zhang wrote:

> typedef unsigned short u16;
> typedef unsigned int u32;
> 
> u32 a(volatile u16* off) {
>         return *off;
> }

> mingw32-gcc-4.3.0.exe -c -O2 -fomit-frame-pointer -mtune=core2 test.c
> 
> it produces:
> 00000000 <_a>:
>    0:   8b 44 24 04             mov    0x4(%esp),%eax
>    4:   0f b7 00                movzwl (%eax),%eax
>    7:   0f b7 c0                movzwl %ax,%eax  <== The redundant insn
>    a:   c3                      ret

  How does it look at the RTL level?  I wonder if this situation is similar to
the one being discussed in the other current thread "Which optimizer should
remove redundant subreg of sign_extension?"

    cheers,
      DaveK

Reply via email to