diff mbox

[AArch64,2/2] Define TARGET_UNSPEC_MAY_TRAP_P for AArch64

Message ID n99wpycb018.fsf@arm.com
State New
Headers show

Commit Message

Jiong Wang July 7, 2015, 12:52 p.m. UTC
A second patch to improve rtl loop iv on AArch64.

We should define this to tell gcc the pattern hidden by these GOT unspec
is safe from trap, so gcc could make more positive decision when
handling them, for example in RTL loop iv pass, when deciding whether
one instruction is invariant candidate, may_trap_or_fault_p will be
invoked which will call this target hook.

OK for trunk?

2015-07-07  Jiong Wang  <jiong.wang@arm.com>

gcc/
  * config/aarch64/aarch64.c (aarch64_unspec_may_trap_p): New function.
  (TARGET_UNSPEC_MAY_TRAP_P): Define as aarch64_unspec_may_trap_p.

Comments

James Greenhalgh July 8, 2015, 4:38 p.m. UTC | #1
On Tue, Jul 07, 2015 at 01:52:29PM +0100, Jiong Wang wrote:
> 
> A second patch to improve rtl loop iv on AArch64.
> 
> We should define this to tell gcc the pattern hidden by these GOT unspec
> is safe from trap, so gcc could make more positive decision when
> handling them, for example in RTL loop iv pass, when deciding whether
> one instruction is invariant candidate, may_trap_or_fault_p will be
> invoked which will call this target hook.
> 
> OK for trunk?
> 
> 2015-07-07  Jiong Wang  <jiong.wang@arm.com>
> 
> gcc/
>   * config/aarch64/aarch64.c (aarch64_unspec_may_trap_p): New function.
>   (TARGET_UNSPEC_MAY_TRAP_P): Define as aarch64_unspec_may_trap_p.

OK.

Thanks,
James

>   
> -- 
> Regards,
> Jiong
> 

> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index e180daa..c7c12ee 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -11943,6 +11943,24 @@ aarch64_use_pseudo_pic_reg (void)
>    return aarch64_cmodel == AARCH64_CMODEL_SMALL_SPIC;
>  }
>  
> +/* Implement TARGET_UNSPEC_MAY_TRAP_P.  */
> +
> +static int
> +aarch64_unspec_may_trap_p (const_rtx x, unsigned flags)
> +{
> +  switch (XINT (x, 1))
> +    {
> +    case UNSPEC_GOTSMALLPIC:
> +    case UNSPEC_GOTSMALLPIC28K:
> +    case UNSPEC_GOTTINYPIC:
> +      return 0;
> +    default:
> +      break;
> +    }
> +
> +  return default_unspec_may_trap_p (x, flags);
> +}
> +
>  #undef TARGET_ADDRESS_COST
>  #define TARGET_ADDRESS_COST aarch64_address_cost
>  
> @@ -12221,6 +12239,9 @@ aarch64_use_pseudo_pic_reg (void)
>  #undef TARGET_SCHED_FUSION_PRIORITY
>  #define TARGET_SCHED_FUSION_PRIORITY aarch64_sched_fusion_priority
>  
> +#undef TARGET_UNSPEC_MAY_TRAP_P
> +#define TARGET_UNSPEC_MAY_TRAP_P aarch64_unspec_may_trap_p
> +
>  #undef TARGET_USE_PSEUDO_PIC_REG
>  #define TARGET_USE_PSEUDO_PIC_REG aarch64_use_pseudo_pic_reg
>
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index e180daa..c7c12ee 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -11943,6 +11943,24 @@  aarch64_use_pseudo_pic_reg (void)
   return aarch64_cmodel == AARCH64_CMODEL_SMALL_SPIC;
 }
 
+/* Implement TARGET_UNSPEC_MAY_TRAP_P.  */
+
+static int
+aarch64_unspec_may_trap_p (const_rtx x, unsigned flags)
+{
+  switch (XINT (x, 1))
+    {
+    case UNSPEC_GOTSMALLPIC:
+    case UNSPEC_GOTSMALLPIC28K:
+    case UNSPEC_GOTTINYPIC:
+      return 0;
+    default:
+      break;
+    }
+
+  return default_unspec_may_trap_p (x, flags);
+}
+
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST aarch64_address_cost
 
@@ -12221,6 +12239,9 @@  aarch64_use_pseudo_pic_reg (void)
 #undef TARGET_SCHED_FUSION_PRIORITY
 #define TARGET_SCHED_FUSION_PRIORITY aarch64_sched_fusion_priority
 
+#undef TARGET_UNSPEC_MAY_TRAP_P
+#define TARGET_UNSPEC_MAY_TRAP_P aarch64_unspec_may_trap_p
+
 #undef TARGET_USE_PSEUDO_PIC_REG
 #define TARGET_USE_PSEUDO_PIC_REG aarch64_use_pseudo_pic_reg