Hi Richard, > > + rtx tmp = gen_reg_rtx (SImode); > > + aarch64_expand_mov_immediate (tmp, gen_int_mode (ival, SImode)); > > + tmp = simplify_gen_subreg (HImode, tmp, SImode, 0); > > This looks wrong for big-endian, and... > > > + emit_move_insn (operands[0], gen_lowpart (HFmode, tmp)); > > ...either it should be OK to go directly from tmp to the HFmode lowpart, or > we should move the HImode temporary into a fresh REG. Current > validate_subreg seems to suggest that we need the latter. > > Isn't it possible to use a HImode move immediate instead of an SImode one?
We don't really have a movehi pattern, currently a movhi would end up in the general mov<mode>_aarch64 pattern which would then use end up using a w register as well. I'll take a look at big-endian. > > Thanks, > Richard