This is the mail archive of the gcc-patches@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: [PATCH: PR target/44999] Replace "and r0, r0, #255" with uxtb in thumb2


On Wed, Nov 3, 2010 at 9:04 PM, Paul Brook <paul@codesourcery.com> wrote:
>> > + ? ? ? ? ? ? operands[1] = convert_to_mode (QImode, operands[1], 1);
>> > + ? ? ? ? ? ? emit_insn (gen_thumb2_zero_extendqisi2_v6 (operands[0],
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?operands[1]));
>> > + ? ? ? ? ? }
>> >
>> > ? ? ? ? ?}
>>
>> This is OK.
>
> No it's not. This code is inside if (TARGET_32BIT). Using thumb specific
> patterns in ARM mode is just plain wrong.
>
You are right. Following is additional patch to fix it. Tested with
regression testing in qemu.

> Even ignoring that, I don't think this is the right fix. Why do we need this
> for Thumb mode, and not ARM mode? Why extendqi and not extendhi?

In Thumb mode, and with a constant is 32 bit, and uxtb is 16 bit.
In ARM mode, both are 32 bit, so it is not beneficial.
The test case shows that and with 0xFFFF is already converted to uxth,
so it is not handled here.


ChangeLog:
2010-11-07  Wei Guozhi  <carrot@google.com>

        * config/arm/arm.md (andsi3): Call gen_thumb2_zero_extendqisi2_v6 only
        when the target is TARGET_THUMB2.


Index: arm.md
===================================================================
--- arm.md	(revision 165492)
+++ arm.md	(working copy)
@@ -2015,7 +2015,7 @@
     {
       if (GET_CODE (operands[2]) == CONST_INT)
         {
-	  if (INTVAL (operands[2]) == 255 && arm_arch6)
+	  if (INTVAL (operands[2]) == 255 && TARGET_THUMB2 && arm_arch6)
 	    {
 	      operands[1] = convert_to_mode (QImode, operands[1], 1);
 	      emit_insn (gen_thumb2_zero_extendqisi2_v6 (operands[0],


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