[AArch64] Implement vector float->double widening and double->float narrowing.
authorJames Greenhalgh <james.greenhalgh@arm.com>
Mon, 29 Apr 2013 10:57:59 +0000 (10:57 +0000)
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>
Mon, 29 Apr 2013 10:57:59 +0000 (10:57 +0000)
gcc/
* config/aarch64/aarch64-simd-builtins.def (vec_unpacks_hi_): New.
(float_truncate_hi_): Likewise.
(float_extend_lo_): Likewise.
(float_truncate_lo_): Likewise.
* config/aarch64/aarch64-simd.md (vec_unpacks_lo_v4sf): New.
(aarch64_float_extend_lo_v2df): Likewise.
(vec_unpacks_hi_v4sf): Likewise.
(aarch64_float_truncate_lo_v2sf): Likewise.
(aarch64_float_truncate_hi_v4sf): Likewise.
(vec_pack_trunc_v2df): Likewise.
(vec_pack_trunc_df): Likewise.

From-SVN: r198400

gcc/ChangeLog
gcc/config/aarch64/aarch64-simd-builtins.def
gcc/config/aarch64/aarch64-simd.md

index 2e21471a6ec5dcf0294805e2c34aae1a306d5d48..5f0e495ef6608d843d04a254cfadc9c769f2020f 100644 (file)
@@ -1,3 +1,17 @@
+2013-04-29  James Greenhalgh  <james.greenhalgh@arm.com>
+
+       * config/aarch64/aarch64-simd-builtins.def (vec_unpacks_hi_): New.
+       (float_truncate_hi_): Likewise.
+       (float_extend_lo_): Likewise.
+       (float_truncate_lo_): Likewise.
+       * config/aarch64/aarch64-simd.md (vec_unpacks_lo_v4sf): New.
+       (aarch64_float_extend_lo_v2df): Likewise.
+       (vec_unpacks_hi_v4sf): Likewise.
+       (aarch64_float_truncate_lo_v2sf): Likewise.
+       (aarch64_float_truncate_hi_v4sf): Likewise.
+       (vec_pack_trunc_v2df): Likewise.
+       (vec_pack_trunc_df): Likewise.
+
 2013-04-29  James Greenhalgh  <james.greenhalgh@arm.com>
 
        * config/aarch64/aarch64-builtins.c
index 8df3dac0af0ee73e7dd219d3a25346d636db8feb..6093341b1993548ed4c8b9e1d05e201318a47fd1 100644 (file)
   BUILTIN_VDQF (BINOP, frecps, 0)
 
   BUILTIN_VDQF (UNOP, abs, 2)
+
+  VAR1 (UNOP, vec_unpacks_hi_, 10, v4sf)
+  VAR1 (BINOP, float_truncate_hi_, 0, v4sf)
+
+  VAR1 (UNOP, float_extend_lo_, 0, v2df)
+  VAR1 (UNOP, float_truncate_lo_, 0, v2sf)
index 067c8496573cdf9dd2cd5e47fc833881601a6f66..454609476634e6a352e9be5dedd4e7b4c90d44a2 100644 (file)
    (set_attr "simd_mode" "<MODE>")]
 )
 
+;; Conversions between vectors of floats and doubles.
+;; Contains a mix of patterns to match standard pattern names
+;; and those for intrinsics.
+
+;; Float widening operations.
+
+(define_insn "vec_unpacks_lo_v4sf"
+  [(set (match_operand:V2DF 0 "register_operand" "=w")
+       (float_extend:V2DF
+         (vec_select:V2SF
+           (match_operand:V4SF 1 "register_operand" "w")
+           (parallel [(const_int 0) (const_int 1)])
+         )))]
+  "TARGET_SIMD"
+  "fcvtl\\t%0.2d, %1.2s"
+  [(set_attr "simd_type" "simd_fcvtl")
+   (set_attr "simd_mode" "V2DF")]
+)
+
+(define_insn "aarch64_float_extend_lo_v2df"
+  [(set (match_operand:V2DF 0 "register_operand" "=w")
+       (float_extend:V2DF
+         (match_operand:V2SF 1 "register_operand" "w")))]
+  "TARGET_SIMD"
+  "fcvtl\\t%0.2d, %1.2s"
+  [(set_attr "simd_type" "simd_fcvtl")
+   (set_attr "simd_mode" "V2DF")]
+)
+
+(define_insn "vec_unpacks_hi_v4sf"
+  [(set (match_operand:V2DF 0 "register_operand" "=w")
+       (float_extend:V2DF
+         (vec_select:V2SF
+           (match_operand:V4SF 1 "register_operand" "w")
+           (parallel [(const_int 2) (const_int 3)])
+         )))]
+  "TARGET_SIMD"
+  "fcvtl2\\t%0.2d, %1.4s"
+  [(set_attr "simd_type" "simd_fcvtl")
+   (set_attr "simd_mode" "V2DF")]
+)
+
+;; Float narrowing operations.
+
+(define_insn "aarch64_float_truncate_lo_v2sf"
+  [(set (match_operand:V2SF 0 "register_operand" "=w")
+      (float_truncate:V2SF
+       (match_operand:V2DF 1 "register_operand" "w")))]
+  "TARGET_SIMD"
+  "fcvtn\\t%0.2s, %1.2d"
+  [(set_attr "simd_type" "simd_fcvtl")
+   (set_attr "simd_mode" "V2SF")]
+)
+
+(define_insn "aarch64_float_truncate_hi_v4sf"
+  [(set (match_operand:V4SF 0 "register_operand" "=w")
+    (vec_concat:V4SF
+      (match_operand:V2SF 1 "register_operand" "0")
+      (float_truncate:V2SF
+       (match_operand:V2DF 2 "register_operand" "w"))))]
+  "TARGET_SIMD"
+  "fcvtn2\\t%0.4s, %2.2d"
+  [(set_attr "simd_type" "simd_fcvtl")
+   (set_attr "simd_mode" "V4SF")]
+)
+
+(define_expand "vec_pack_trunc_v2df"
+  [(set (match_operand:V4SF 0 "register_operand")
+      (vec_concat:V4SF
+       (float_truncate:V2SF
+           (match_operand:V2DF 1 "register_operand"))
+       (float_truncate:V2SF
+           (match_operand:V2DF 2 "register_operand"))
+         ))]
+  "TARGET_SIMD"
+  {
+    rtx tmp = gen_reg_rtx (V2SFmode);
+    emit_insn (gen_aarch64_float_truncate_lo_v2sf (tmp, operands[1]));
+    emit_insn (gen_aarch64_float_truncate_hi_v4sf (operands[0],
+                                                  tmp, operands[2]));
+    DONE;
+  }
+)
+
+(define_expand "vec_pack_trunc_df"
+  [(set (match_operand:V2SF 0 "register_operand")
+      (vec_concat:V2SF
+       (float_truncate:SF
+           (match_operand:DF 1 "register_operand"))
+       (float_truncate:SF
+           (match_operand:DF 2 "register_operand"))
+         ))]
+  "TARGET_SIMD"
+  {
+    rtx tmp = gen_reg_rtx (V2SFmode);
+    emit_insn (gen_move_lo_quad_v2df (tmp, operands[1]));
+    emit_insn (gen_move_hi_quad_v2df (tmp, operands[2]));
+    emit_insn (gen_aarch64_float_truncate_lo_v2sf (operands[0], tmp));
+    DONE;
+  }
+)
+
 (define_insn "aarch64_vmls<mode>"
   [(set (match_operand:VDQF 0 "register_operand" "=w")
        (minus:VDQF (match_operand:VDQF 1 "register_operand" "0")