gcc/
authoryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Apr 2015 07:21:06 +0000 (07:21 +0000)
committeryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Apr 2015 07:21:06 +0000 (07:21 +0000)
2015-04-02  Yvan Roux  <yvan.roux@linaro.org>

Backport from trunk r218958, r218960, r218961.
2014-12-19  Alan Lawrence  <alan.lawrence@arm.com>

* config/aarch64/aarch64.c (<LOGICAL:optab>_one_cmpl<mode>3):
Reparameterize to...
(<NLOGICAL:optab>_one_cmpl<mode>3): with extra SIMD-register variant.
(xor_one_cmpl<mode>3): New define_insn_and_split.

* config/aarch64/iterators.md (NLOGICAL): New define_code_iterator.

2014-12-19  Alan Lawrence  <alan.lawrence@arm.com>

* config/aarch64/aarch64.md (<optab><mode>3, one_cmpl<mode>2):
Add SIMD-register variant.
* config/aarch64/iterators.md (Vbtype): Add value for SI.

2014-12-19  Alan Lawrence  <alan.lawrence@arm.com>

* config/aarch64/aarch64.md (subdi3, adddi3_aarch64): Don't penalize
SIMD reg variant.

gcc/testsuite/
2015-04-02  Yvan Roux  <yvan.roux@linaro.org>

Backport from trunk r218961.
2014-12-19  Alan Lawrence  <alan.lawrence@arm.com>

* gcc.target/aarch64/eon_1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@221829 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog.linaro
gcc/config/aarch64/aarch64.md
gcc/config/aarch64/iterators.md
gcc/testsuite/ChangeLog.linaro
gcc/testsuite/gcc.target/aarch64/eon_1.c [new file with mode: 0644]

index 1c6e720..1a2b3ff 100644 (file)
@@ -1,4 +1,27 @@
-2015-04.02  Yvan Roux  <yvan.roux@linaro.org>
+2015-04-02  Yvan Roux  <yvan.roux@linaro.org>
+
+       Backport from trunk r218958, r218960, r218961.
+       2014-12-19  Alan Lawrence  <alan.lawrence@arm.com>
+
+       * config/aarch64/aarch64.c (<LOGICAL:optab>_one_cmpl<mode>3):
+       Reparameterize to...
+       (<NLOGICAL:optab>_one_cmpl<mode>3): with extra SIMD-register variant.
+       (xor_one_cmpl<mode>3): New define_insn_and_split.
+
+       * config/aarch64/iterators.md (NLOGICAL): New define_code_iterator.
+
+       2014-12-19  Alan Lawrence  <alan.lawrence@arm.com>
+
+       * config/aarch64/aarch64.md (<optab><mode>3, one_cmpl<mode>2):
+       Add SIMD-register variant.
+       * config/aarch64/iterators.md (Vbtype): Add value for SI.
+
+       2014-12-19  Alan Lawrence  <alan.lawrence@arm.com>
+
+       * config/aarch64/aarch64.md (subdi3, adddi3_aarch64): Don't penalize
+       SIMD reg variant.
+
+2015-04-02  Yvan Roux  <yvan.roux@linaro.org>
 
        Backport from trunk r218897.
        2014-12-19  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
@@ -6,7 +29,7 @@
        * doc/invoke.texi (ARM options): Remove mention of Advanced RISC
        Machines.
 
-2015-04.02  Yvan Roux  <yvan.roux@linaro.org>
+2015-04-02  Yvan Roux  <yvan.roux@linaro.org>
 
        Backport from trunk r218895.
        2014-12-19  Xingxing Pan <xxingpan@marvell.com>
@@ -14,7 +37,7 @@
        * config/arm/cortex-a9-neon.md (cortex_a9_neon_vmov): Change
        reservation to cortex_a9_neon_dp.
 
-2015-04.02  Yvan Roux  <yvan.roux@linaro.org>
+2015-04-02  Yvan Roux  <yvan.roux@linaro.org>
 
        Backport from trunk r218530.
        2014-12-09  Alan Lawrence  <alan.lawrence@arm.com>
@@ -26,7 +49,7 @@
        Remove final qualifier_internal.
        (aarch64_fold_builtin): Stop folding abs builtins, except on floats.
 
-2015-04.02  Yvan Roux  <yvan.roux@linaro.org>
+2015-04-02  Yvan Roux  <yvan.roux@linaro.org>
 
        Backport from trunk r218526.
        2014-12-09  Wilco Dijkstra  <wilco.dijkstra@arm.com>
@@ -41,7 +64,7 @@
        (cortexa57_tunings): Likewise.
        (thunderx_tunings): Likewise.
 
-2015-04.02  Yvan Roux  <yvan.roux@linaro.org>
+2015-04-02  Yvan Roux  <yvan.roux@linaro.org>
 
        Backport from trunk r218866.
        2014-12-18  Wilco Dijkstra  <wilco.dijkstra@arm.com>
@@ -50,7 +73,7 @@
        Define.
        (aarch64_min_divisions_for_recip_mul): New function.
 
-2015-04.02  Yvan Roux  <yvan.roux@linaro.org>
+2015-04-02  Yvan Roux  <yvan.roux@linaro.org>
 
        Backport from trunk r218867, r218868.
        2014-12-18  Alan Lawrence  <alan.lawrence@arm.com>
index 2dee7c7..9788016 100644 (file)
 
 (define_insn "*adddi3_aarch64"
   [(set
-    (match_operand:DI 0 "register_operand" "=rk,rk,rk,!w")
+    (match_operand:DI 0 "register_operand" "=rk,rk,rk,w")
     (plus:DI
-     (match_operand:DI 1 "register_operand" "%rk,rk,rk,!w")
-     (match_operand:DI 2 "aarch64_plus_operand" "I,r,J,!w")))]
+     (match_operand:DI 1 "register_operand" "%rk,rk,rk,w")
+     (match_operand:DI 2 "aarch64_plus_operand" "I,r,J,w")))]
   ""
   "@
   add\\t%x0, %x1, %2
 )
 
 (define_insn "subdi3"
-  [(set (match_operand:DI 0 "register_operand" "=rk,!w")
-       (minus:DI (match_operand:DI 1 "register_operand" "r,!w")
-                  (match_operand:DI 2 "register_operand" "r,!w")))]
+  [(set (match_operand:DI 0 "register_operand" "=rk,w")
+       (minus:DI (match_operand:DI 1 "register_operand" "r,w")
+                  (match_operand:DI 2 "register_operand" "r,w")))]
   ""
   "@
    sub\\t%x0, %x1, %x2
 ;; -------------------------------------------------------------------
 
 (define_insn "<optab><mode>3"
-  [(set (match_operand:GPI 0 "register_operand" "=r,rk")
-       (LOGICAL:GPI (match_operand:GPI 1 "register_operand" "%r,r")
-                    (match_operand:GPI 2 "aarch64_logical_operand" "r,<lconst>")))]
+  [(set (match_operand:GPI 0 "register_operand" "=r,rk,w")
+       (LOGICAL:GPI (match_operand:GPI 1 "register_operand" "%r,r,w")
+                    (match_operand:GPI 2 "aarch64_logical_operand" "r,<lconst>,w")))]
   ""
-  "<logical>\\t%<w>0, %<w>1, %<w>2"
-  [(set_attr "type" "logic_reg,logic_imm")]
+  "@
+  <logical>\\t%<w>0, %<w>1, %<w>2
+  <logical>\\t%<w>0, %<w>1, %<w>2
+  <logical>\\t%0.<Vbtype>, %1.<Vbtype>, %2.<Vbtype>"
+  [(set_attr "type" "logic_reg,logic_imm,neon_logic")
+   (set_attr "simd" "*,*,yes")]
 )
 
 ;; zero_extend version of above
 )
 
 (define_insn "one_cmpl<mode>2"
-  [(set (match_operand:GPI 0 "register_operand" "=r")
-       (not:GPI (match_operand:GPI 1 "register_operand" "r")))]
+  [(set (match_operand:GPI 0 "register_operand" "=r,w")
+       (not:GPI (match_operand:GPI 1 "register_operand" "r,w")))]
   ""
-  "mvn\\t%<w>0, %<w>1"
-  [(set_attr "type" "logic_reg")]
+  "@
+  mvn\\t%<w>0, %<w>1
+  mvn\\t%0.8b, %1.8b"
+  [(set_attr "type" "logic_reg,neon_logic")
+   (set_attr "simd" "*,yes")]
 )
 
 (define_insn "*one_cmpl_<optab><mode>2"
   [(set_attr "type" "logic_shift_imm")]
 )
 
-(define_insn "*<LOGICAL:optab>_one_cmpl<mode>3"
-  [(set (match_operand:GPI 0 "register_operand" "=r")
-       (LOGICAL:GPI (not:GPI
-                     (match_operand:GPI 1 "register_operand" "r"))
-                    (match_operand:GPI 2 "register_operand" "r")))]
+;; Binary logical operators negating one operand, i.e. (a & !b), (a | !b).
+
+(define_insn "*<NLOGICAL:optab>_one_cmpl<mode>3"
+  [(set (match_operand:GPI 0 "register_operand" "=r,w")
+       (NLOGICAL:GPI (not:GPI (match_operand:GPI 1 "register_operand" "r,w"))
+                    (match_operand:GPI 2 "register_operand" "r,w")))]
   ""
-  "<LOGICAL:nlogical>\\t%<w>0, %<w>2, %<w>1"
-  [(set_attr "type" "logic_reg")]
+  "@
+  <NLOGICAL:nlogical>\\t%<w>0, %<w>2, %<w>1
+  <NLOGICAL:nlogical>\\t%0.<Vbtype>, %2.<Vbtype>, %1.<Vbtype>"
+  [(set_attr "type" "logic_reg,neon_logic")
+   (set_attr "simd" "*,yes")]
+)
+
+;; (xor (not a) b) is simplify_rtx-ed down to (not (xor a b)).
+;; eon does not operate on SIMD registers so the vector variant must be split.
+(define_insn_and_split "*xor_one_cmpl<mode>3"
+  [(set (match_operand:GPI 0 "register_operand" "=r,w")
+        (not:GPI (xor:GPI (match_operand:GPI 1 "register_operand" "r,?w")
+                          (match_operand:GPI 2 "register_operand" "r,w"))))]
+  ""
+  "eon\\t%<w>0, %<w>1, %<w>2" ;; For GPR registers (only).
+  "reload_completed && (which_alternative == 1)" ;; For SIMD registers.
+  [(set (match_operand:GPI 0 "register_operand" "=w")
+        (xor:GPI (match_operand:GPI 1 "register_operand" "w")
+                 (match_operand:GPI 2 "register_operand" "w")))
+   (set (match_dup 0) (not:GPI (match_dup 0)))]
+  ""
+  [(set_attr "type" "logic_reg,multiple")
+   (set_attr "simd" "*,yes")]
 )
 
 (define_insn "*and_one_cmpl<mode>3_compare0"
index 5ddd6a2..f6da124 100644 (file)
                          (V2SI "8b") (V4SI  "16b")
                          (V2DI "16b") (V2SF  "8b")
                          (V4SF "16b") (V2DF  "16b")
-                         (DI   "8b")  (DF    "8b")])
+                         (DI   "8b")  (DF    "8b")
+                         (SI   "8b")])
 
 ;; Define element mode for each vector mode.
 (define_mode_attr VEL [(V8QI "QI") (V16QI "QI")
 ;; Code iterator for logical operations
 (define_code_iterator LOGICAL [and ior xor])
 
+;; Code iterator for logical operations whose :nlogical works on SIMD registers.
+(define_code_iterator NLOGICAL [and ior])
+
 ;; Code iterator for sign/zero extension
 (define_code_iterator ANY_EXTEND [sign_extend zero_extend])
 
index ecab740..e921593 100644 (file)
@@ -1,5 +1,12 @@
 2015-04-02  Yvan Roux  <yvan.roux@linaro.org>
 
+       Backport from trunk r218961.
+       2014-12-19  Alan Lawrence  <alan.lawrence@arm.com>
+
+       * gcc.target/aarch64/eon_1.c: New test.
+
+2015-04-02  Yvan Roux  <yvan.roux@linaro.org>
+
        Backport from trunk r218530.
        2014-12-09  Alan Lawrence  <alan.lawrence@arm.com>
 
diff --git a/gcc/testsuite/gcc.target/aarch64/eon_1.c b/gcc/testsuite/gcc.target/aarch64/eon_1.c
new file mode 100644 (file)
index 0000000..dcdf3b4
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* { dg-final { scan-assembler-not "\tf?mov\t" } } */
+
+typedef long long int64_t;
+typedef int64_t int64x1_t __attribute__ ((__vector_size__ (8)));
+
+/* { dg-final { scan-assembler-times "\\teon\\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 1 } } */
+
+int64_t
+test_eon (int64_t a, int64_t b)
+{
+  return a ^ ~b;
+}
+
+/* { dg-final { scan-assembler-times "\\tmvn\\tx\[0-9\]+, x\[0-9\]+" 1 } } */
+int64_t
+test_not (int64_t a)
+{
+  return ~a;
+}
+
+/* There is no eon for SIMD regs; we prefer eor+mvn to mov+mov+eon+mov.  */
+
+/* { dg-final { scan-assembler-times "\\teor\\tv\[0-9\]+\.8b, v\[0-9\]+\.8b, v\[0-9\]+\.8b" 1 } } */
+/* { dg-final { scan-assembler-times "\\tmvn\\tv\[0-9\]+\.8b, v\[0-9\]+\.8b" 2 } } */
+int64x1_t
+test_vec_eon (int64x1_t a, int64x1_t b)
+{
+  return a ^ ~b;
+}
+
+int64x1_t
+test_vec_not (int64x1_t a)
+{
+  return ~a;
+}
+