This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help needed with zero/sign extension


On 2 April 2014 13:08, Anthony Green <green@moxielogic.com> wrote:

> I though the answer was to simply add something like this...
>
> (define_insn "zero_extendqisi"
>   [(set (match_operand:SI 0 "register_operand" "=r")
>         (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
>   ""
>   "; ZERO EXTEND (comment for debugging)")

That pattern is obviously not outputting valid code.
You should make this a define_insn_and_split, with an r/r alternative
that is split (after reload) as necesary into shifts, and an m/r alternative
that outputs a load.  sprinkle with rtx_cost adjustments as necessary.

> But nothing changes in the example above.

LOAD_EXTEND_OP can also avoid some unnecesary expansions.

ALthough we still have a long-standing issue of unnecessary extensions for
narrow integer types passed in/out of functions, and loaded from volatile
memory.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]