This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: arm.md: define insn "loadhi_predec" -- why issue ldr, not ldrh?
- To: dim at windriver dot com
- Subject: Re: arm.md: define insn "loadhi_predec" -- why issue ldr, not ldrh?
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Fri, 21 Apr 2000 14:23:05 -0700
- CC: gcc at gcc dot gnu dot org
Hi Dimitri,
: What is the reason behind issuing word-long loads/stores
: for loading/storing halfword values in ARM backend?
:
: from arm.md:
:
: (define_insn "*loadhi_preinc"
: [(set (match_operand:HI 3 "s_register_operand" "=r")
: (mem:HI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
: (match_operand:SI 2 "index_operand" "rJ"))))
: (set (match_operand:SI 0 "s_register_operand" "=r")
: (plus:SI (match_dup 1) (match_dup 2)))]
: "TARGET_ARM
: && (! BYTES_BIG_ENDIAN)
: && ! TARGET_MMU_TRAPS
: && REGNO (operands[0]) != FRAME_POINTER_REGNUM
: && REGNO (operands[1]) != FRAME_POINTER_REGNUM
: && (GET_CODE (operands[2]) != REG
: || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
: "ldr%?\\t%3, [%0, %2]!\\t%@ loadhi"
: [(set_attr "type" "load")])
:
:
: Why not "ldr%?h\\t%3, [%0, %2]!\\t%@ loadhi" ?
Well for starters the LDRH instruction is only available on v4
architectures (and upwards). In fact I suspect that this is the real
reason - the pattern was written back before the v4 architecture was
available and then not modified when the v4 was available.
I suppose that the pattern could be rewritten like this:
(define_insn "*loadhi_preinc"
[(set (match_operand:HI 3 "s_register_operand" "=r")
(mem:HI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
(match_operand:SI 2 "index_operand" "rJ"))))
(set (match_operand:SI 0 "s_register_operand" "=r")
(plus:SI (match_dup 1) (match_dup 2)))]
"TARGET_ARM
&& ! BYTES_BIG_ENDIAN
&& (! TARGET_MMU_TRAPS || arm_arch4)
&& REGNO (operands[0]) != FRAME_POINTER_REGNUM
&& REGNO (operands[1]) != FRAME_POINTER_REGNUM
&& (GET_CODE (operands[2]) != REG
|| REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
"*
if (arm_arch4)
return \"ldr%?h\\t%3, [%0, %2]!\";
else
return \"ldr%?\\t%3, [%0, %2]!\\t%@ loadhi\";"
[(set_attr "type" "load")])
I expect Richard Earnshaw will have a better answer.
Cheers
Nick