diff mbox

[AArch64] Map frint intrinsics to standard pattern names directly.

Message ID 1366980156-1048-1-git-send-email-james.greenhalgh@arm.com
State New
Headers show

Commit Message

James Greenhalgh April 26, 2013, 12:42 p.m. UTC
Hi,

This patch maps the frint style intrinsics directly to their
standard pattern name versions and adds support for frintn, which
does not map to a standard pattern name.

Regression tested on aarch64-none-elf with no issues.

Thanks,
James

---
gcc/

2013-04-26  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/aarch64/aarch64-builtins.c
	(aarch64_builtin_vectorized_function): Fold to standard pattern names.
	* config/aarch64/aarch64-simd-builtins.def (frintn): New.
	(frintz): Rename to...
	(btrunc): ...this.
	(frintp): Rename to...
	(ceil): ...this.
	(frintm): Rename to...
	(floor): ...this.
	(frinti): Rename to...
	(nearbyint): ...this.
	(frintx): Rename to...
	(rint): ...this.
	(frinta): Rename to...
	(round): ...this.
	* config/aarch64/aarch64-simd.md
	(aarch64_frint<frint_suffix><mode>): Delete.
	(<frint_pattern><mode>2): Convert to insn.
	* config/aarch64/aarch64.md (unspec): Add UNSPEC_FRINTN.
	* config/aarch64/iterators.md (FRINT): Add UNSPEC_FRINTN.
	(frint_pattern): Likewise.
	(frint_suffix): Likewise.

Comments

Marcus Shawcroft April 26, 2013, 1:35 p.m. UTC | #1
On 26 April 2013 13:42, James Greenhalgh <james.greenhalgh@arm.com> wrote:
>
> Hi,
>
> This patch maps the frint style intrinsics directly to their
> standard pattern name versions and adds support for frintn, which
> does not map to a standard pattern name.
>
> Regression tested on aarch64-none-elf with no issues.
>
> Thanks,
> James
>
> ---
> gcc/
>
> 2013-04-26  James Greenhalgh  <james.greenhalgh@arm.com>
>
>         * config/aarch64/aarch64-builtins.c
>         (aarch64_builtin_vectorized_function): Fold to standard pattern names.
>         * config/aarch64/aarch64-simd-builtins.def (frintn): New.
>         (frintz): Rename to...
>         (btrunc): ...this.
>         (frintp): Rename to...
>         (ceil): ...this.
>         (frintm): Rename to...
>         (floor): ...this.
>         (frinti): Rename to...
>         (nearbyint): ...this.
>         (frintx): Rename to...
>         (rint): ...this.
>         (frinta): Rename to...
>         (round): ...this.
>         * config/aarch64/aarch64-simd.md
>         (aarch64_frint<frint_suffix><mode>): Delete.
>         (<frint_pattern><mode>2): Convert to insn.
>         * config/aarch64/aarch64.md (unspec): Add UNSPEC_FRINTN.
>         * config/aarch64/iterators.md (FRINT): Add UNSPEC_FRINTN.
>         (frint_pattern): Likewise.
>         (frint_suffix): Likewise.

OK
/Marcus
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index 2851e2b..08bfe01 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -1224,19 +1224,19 @@  aarch64_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
    && in_mode == N##Fmode && in_n == C)
 	case BUILT_IN_FLOOR:
 	case BUILT_IN_FLOORF:
-	  return AARCH64_FIND_FRINT_VARIANT (frintm);
+	  return AARCH64_FIND_FRINT_VARIANT (floor);
 	case BUILT_IN_CEIL:
 	case BUILT_IN_CEILF:
-	  return AARCH64_FIND_FRINT_VARIANT (frintp);
+	  return AARCH64_FIND_FRINT_VARIANT (ceil);
 	case BUILT_IN_TRUNC:
 	case BUILT_IN_TRUNCF:
-	  return AARCH64_FIND_FRINT_VARIANT (frintz);
+	  return AARCH64_FIND_FRINT_VARIANT (btrunc);
 	case BUILT_IN_ROUND:
 	case BUILT_IN_ROUNDF:
-	  return AARCH64_FIND_FRINT_VARIANT (frinta);
+	  return AARCH64_FIND_FRINT_VARIANT (round);
 	case BUILT_IN_NEARBYINT:
 	case BUILT_IN_NEARBYINTF:
-	  return AARCH64_FIND_FRINT_VARIANT (frinti);
+	  return AARCH64_FIND_FRINT_VARIANT (nearbyint);
 	case BUILT_IN_SQRT:
 	case BUILT_IN_SQRTF:
 	  return AARCH64_FIND_FRINT_VARIANT (sqrt);
diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def
index 6e69298..9b06a68 100644
--- a/gcc/config/aarch64/aarch64-simd-builtins.def
+++ b/gcc/config/aarch64/aarch64-simd-builtins.def
@@ -247,13 +247,14 @@ 
   BUILTIN_VDQ_BHSI (BINOP, umax, 3)
   BUILTIN_VDQ_BHSI (BINOP, umin, 3)
 
-  /* Implemented by aarch64_frint<frint_suffix><mode>.  */
-  BUILTIN_VDQF (UNOP, frintz, 0)
-  BUILTIN_VDQF (UNOP, frintp, 0)
-  BUILTIN_VDQF (UNOP, frintm, 0)
-  BUILTIN_VDQF (UNOP, frinti, 0)
-  BUILTIN_VDQF (UNOP, frintx, 0)
-  BUILTIN_VDQF (UNOP, frinta, 0)
+  /* Implemented by <frint_pattern><mode>2.  */
+  BUILTIN_VDQF (UNOP, btrunc, 2)
+  BUILTIN_VDQF (UNOP, ceil, 2)
+  BUILTIN_VDQF (UNOP, floor, 2)
+  BUILTIN_VDQF (UNOP, nearbyint, 2)
+  BUILTIN_VDQF (UNOP, rint, 2)
+  BUILTIN_VDQF (UNOP, round, 2)
+  BUILTIN_VDQF (UNOP, frintn, 2)
 
   /* Implemented by aarch64_fcvt<frint_suffix><su><mode>.  */
   BUILTIN_VDQF (UNOP, fcvtzs, 0)
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 5862d26..5f14cc6 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -1232,7 +1232,9 @@ 
    (set_attr "simd_mode" "<MODE>")]
 )
 
-(define_insn "aarch64_frint<frint_suffix><mode>"
+;; Vector versions of the floating-point frint patterns.
+;; Expands to btrunc, ceil, floor, nearbyint, rint, round.
+(define_insn "<frint_pattern><mode>2"
   [(set (match_operand:VDQF 0 "register_operand" "=w")
 	(unspec:VDQF [(match_operand:VDQF 1 "register_operand" "w")]
 		      FRINT))]
@@ -1242,15 +1244,6 @@ 
    (set_attr "simd_mode" "<MODE>")]
 )
 
-;; Vector versions of the floating-point frint patterns.
-;; Expands to btrunc, ceil, floor, nearbyint, rint, round.
-(define_expand "<frint_pattern><mode>2"
-  [(set (match_operand:VDQF 0 "register_operand")
-	(unspec:VDQF [(match_operand:VDQF 1 "register_operand")]
-		      FRINT))]
-  "TARGET_SIMD"
-  {})
-
 (define_insn "aarch64_fcvt<frint_suffix><su><mode>"
   [(set (match_operand:<FCVT_TARGET> 0 "register_operand" "=w")
 	(FIXUORS:<FCVT_TARGET> (unspec:<FCVT_TARGET>
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 330f78c..4342c2d 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -74,6 +74,7 @@ 
     UNSPEC_FRINTA
     UNSPEC_FRINTI
     UNSPEC_FRINTM
+    UNSPEC_FRINTN
     UNSPEC_FRINTP
     UNSPEC_FRINTX
     UNSPEC_FRINTZ
diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md
index 58a2a9e..a2ad866 100644
--- a/gcc/config/aarch64/iterators.md
+++ b/gcc/config/aarch64/iterators.md
@@ -692,7 +692,8 @@ 
 			      UNSPEC_UZP1 UNSPEC_UZP2])
 
 (define_int_iterator FRINT [UNSPEC_FRINTZ UNSPEC_FRINTP UNSPEC_FRINTM
-			     UNSPEC_FRINTI UNSPEC_FRINTX UNSPEC_FRINTA])
+			     UNSPEC_FRINTN UNSPEC_FRINTI UNSPEC_FRINTX
+			     UNSPEC_FRINTA])
 
 (define_int_iterator FCVT [UNSPEC_FRINTZ UNSPEC_FRINTP UNSPEC_FRINTM
 			    UNSPEC_FRINTA])
@@ -787,12 +788,14 @@ 
 				(UNSPEC_FRINTM "floor")
 				(UNSPEC_FRINTI "nearbyint")
 				(UNSPEC_FRINTX "rint")
-				(UNSPEC_FRINTA "round")])
+				(UNSPEC_FRINTA "round")
+				(UNSPEC_FRINTN "frintn")])
 
 ;; frint suffix for floating-point rounding instructions.
 (define_int_attr frint_suffix [(UNSPEC_FRINTZ "z") (UNSPEC_FRINTP "p")
 			       (UNSPEC_FRINTM "m") (UNSPEC_FRINTI "i")
-			       (UNSPEC_FRINTX "x") (UNSPEC_FRINTA "a")])
+			       (UNSPEC_FRINTX "x") (UNSPEC_FRINTA "a")
+			       (UNSPEC_FRINTN "n")])
 
 (define_int_attr fcvt_pattern [(UNSPEC_FRINTZ "btrunc") (UNSPEC_FRINTA "round")
 			       (UNSPEC_FRINTP "ceil") (UNSPEC_FRINTM "floor")])