diff mbox

[fr30] Fix indirect_jump pattern

Message ID 878uagi3zt.fsf@e105548-lin.cambridge.arm.com
State New
Headers show

Commit Message

Richard Sandiford July 16, 2015, 2:14 p.m. UTC
The pattern was accepting a nonimediate_operand, using the C condition
to weed out certain types of memory, but was then using an "r" constraint
to force a register.  This patch makes the predicate match the constraint
and removes the C condition.

Tested by building fr30-elf and using:

int
foo (int i)
{
  __typeof(&&a) foo[] = { &&a, &&a, &&b, &&c };

 restart:
  goto *foo[i];

 a:
  return 1;

 b:
  i += 1;
  goto restart;

 c:
  return 2;
}

to triger an indirect jump (checked via -dp).  OK to install?

Thanks,
Richard


gcc/
	* config/fr30/fr30.md (indirect_jump): Use pmode_register_operand
	instead of nonimmediate_operand.  Remove C condiition.

Comments

Richard Sandiford July 23, 2015, 9:28 p.m. UTC | #1
Ping

Richard Sandiford <richard.sandiford@arm.com> writes:
> The pattern was accepting a nonimediate_operand, using the C condition
> to weed out certain types of memory, but was then using an "r" constraint
> to force a register.  This patch makes the predicate match the constraint
> and removes the C condition.
>
> Tested by building fr30-elf and using:
>
> int
> foo (int i)
> {
>   __typeof(&&a) foo[] = { &&a, &&a, &&b, &&c };
>
>  restart:
>   goto *foo[i];
>
>  a:
>   return 1;
>
>  b:
>   i += 1;
>   goto restart;
>
>  c:
>   return 2;
> }
>
> to triger an indirect jump (checked via -dp).  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* config/fr30/fr30.md (indirect_jump): Use pmode_register_operand
> 	instead of nonimmediate_operand.  Remove C condiition.
>
> Index: gcc/config/fr30/fr30.md
> ===================================================================
> --- gcc/config/fr30/fr30.md	2015-06-22 14:02:15.165532334 +0100
> +++ gcc/config/fr30/fr30.md	2015-07-13 19:31:50.552692732 +0100
> @@ -1146,8 +1146,8 @@ (define_insn "jump"
>  
>  ;; Indirect jump through a register
>  (define_insn "indirect_jump"
> -  [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "r"))]
> -  "GET_CODE (operands[0]) != MEM || GET_CODE (XEXP (operands[0], 0)) != PLUS"
> +  [(set (pc) (match_operand 0 "pmode_register_operand" "r"))]
> +  ""
>    "jmp%#\\t@%0"
>    [(set_attr "delay_type" "delayed")]
>  )
Jeff Law July 24, 2015, 5:13 a.m. UTC | #2
On 07/23/2015 03:28 PM, Richard Sandiford wrote:
> Ping
>
> Richard Sandiford <richard.sandiford@arm.com> writes:
>> The pattern was accepting a nonimediate_operand, using the C condition
>> to weed out certain types of memory, but was then using an "r" constraint
>> to force a register.  This patch makes the predicate match the constraint
>> and removes the C condition.
>>
>> Tested by building fr30-elf and using:
>>
>> int
>> foo (int i)
>> {
>>    __typeof(&&a) foo[] = { &&a, &&a, &&b, &&c };
>>
>>   restart:
>>    goto *foo[i];
>>
>>   a:
>>    return 1;
>>
>>   b:
>>    i += 1;
>>    goto restart;
>>
>>   c:
>>    return 2;
>> }
>>
>> to triger an indirect jump (checked via -dp).  OK to install?
>>
>> Thanks,
>> Richard
>>
>>
>> gcc/
>> 	* config/fr30/fr30.md (indirect_jump): Use pmode_register_operand
>> 	instead of nonimmediate_operand.  Remove C condiition.
OK.

Jeff
diff mbox

Patch

Index: gcc/config/fr30/fr30.md
===================================================================
--- gcc/config/fr30/fr30.md	2015-06-22 14:02:15.165532334 +0100
+++ gcc/config/fr30/fr30.md	2015-07-13 19:31:50.552692732 +0100
@@ -1146,8 +1146,8 @@  (define_insn "jump"
 
 ;; Indirect jump through a register
 (define_insn "indirect_jump"
-  [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "r"))]
-  "GET_CODE (operands[0]) != MEM || GET_CODE (XEXP (operands[0], 0)) != PLUS"
+  [(set (pc) (match_operand 0 "pmode_register_operand" "r"))]
+  ""
   "jmp%#\\t@%0"
   [(set_attr "delay_type" "delayed")]
 )