prevent zero-extension when using a memory load instruction

William Tambe tambewilliam@gmail.com
Sat Apr 18 18:36:29 GMT 2020


On Sat, Apr 18, 2020 at 11:32 AM Marc Glisse <marc.glisse@inria.fr> wrote:
>
> On Sat, 18 Apr 2020, William Tambe via Gcc-help wrote:
>
> > In the machine description file, is there a way to tell GCC that a
> > memory load instruction already zero-extend such that it does not try
> > to apply zero-extension ?
>
> I would look at it the other way around: you can tell GCC what asm to
> generate for a zero_extend with a memory operand. Or did you have a

Thanks; tried above, but GCC still prefer a memory load followed by
zero-extension.

The example code used is as follow:

    unsigned char var;
    int main() {
        return var;
    }

Also tried x86 and ARM GCC port to see what they produce, and find
that only x86 will not generate a zero-extension when -Os is used.

The version of GCC used is 9.2.0.

Any other suggestions on how to tell GCC not to zero-extend the result
of a memory load ?

> specific example in mind?
>
> --
> Marc Glisse



More information about the Gcc-help mailing list