aarch64.md (mov<mode>:GPF): Don't call force_reg if op1 is an fp zero.
authorJim Wilson <jim.wilson@linaro.org>
Fri, 19 Jun 2015 17:22:38 +0000 (17:22 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Fri, 19 Jun 2015 17:22:38 +0000 (10:22 -0700)
gcc/
* config/aarch64/aarch64.md (mov<mode>:GPF): Don't call force_reg if
op1 is an fp zero.
(movsf_aarch64): Change condition from register_operand to
aarch64_reg_or_fp_zero for op1.  Change type for alternative 6 to
load1.  Change type for alternative 7 to store1.
(movdf_aarch64): Likewise.
gcc/testsuite/
* gcc.target/aarch64/fmovd-zero-mem.c: New.
* gcc.target/aarch64/fmovd-zero-reg.c: New.
* gcc.target/aarch64/fmovf-zero-mem.c: New.
* gcc.target/aarch64/fmovf-zero-reg.c: New.
* gcc.target/aarch64/fmovld-zero-mem.c: New.
* gcc.target/aarch64/fmovld-zero-mem.c: New.
* gcc.target/aarch64/fmovd-zero.c: Delete.
* gcc.target/aarch64/fmovf-zero.c: Delete.

From-SVN: r224673

gcc/ChangeLog
gcc/config/aarch64/aarch64.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/fmovd-zero-mem.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fmovd-zero-reg.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fmovd-zero.c [deleted file]
gcc/testsuite/gcc.target/aarch64/fmovf-zero-mem.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fmovf-zero-reg.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fmovf-zero.c [deleted file]
gcc/testsuite/gcc.target/aarch64/fmovld-zero-mem.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fmovld-zero-reg.c [new file with mode: 0644]

index b94b85f432500c652bfc96f64970d1e978c39e54..d33ca138c60a54fbd68b2125a2b3dcf0fe92c05f 100644 (file)
@@ -1,3 +1,12 @@
+2015-06-19  Jim Wilson  <jim.wilson@linaro.org>
+
+       * config/aarch64/aarch64.md (mov<mode>:GPF): Don't call force_reg if
+       op1 is an fp zero.
+       (movsf_aarch64): Change condition from register_operand to
+       aarch64_reg_or_fp_zero for op1.  Change type for alternative 6 to
+       load1.  Change type for alternative 7 to store1.
+       (movdf_aarch64): Likewise.
+
 2015-06-19  James Greenhalgh  <james.greenhalgh@arm.com>
 
        * config/vax/vax.md: Adjust sign/zero extend patterns to
index 1efe57c91b10e47ab7511d089f7b4bb53f18f06e..d3f5d5b20632b412d028416591ca7c449d885e08 100644 (file)
        FAIL;
      }
 
-    if (GET_CODE (operands[0]) == MEM)
+    if (GET_CODE (operands[0]) == MEM
+        && ! (GET_CODE (operands[1]) == CONST_DOUBLE
+             && aarch64_float_const_zero_rtx_p (operands[1])))
       operands[1] = force_reg (<MODE>mode, operands[1]);
   "
 )
   [(set (match_operand:SF 0 "nonimmediate_operand" "=w, ?r,w,w  ,w,m,r,m ,r")
        (match_operand:SF 1 "general_operand"      "?rY, w,w,Ufc,m,w,m,rY,r"))]
   "TARGET_FLOAT && (register_operand (operands[0], SFmode)
-    || register_operand (operands[1], SFmode))"
+    || aarch64_reg_or_fp_zero (operands[1], SFmode))"
   "@
    fmov\\t%s0, %w1
    fmov\\t%w0, %s1
    str\\t%w1, %0
    mov\\t%w0, %w1"
   [(set_attr "type" "f_mcr,f_mrc,fmov,fconsts,\
-                     f_loads,f_stores,f_loads,f_stores,mov_reg")]
+                     f_loads,f_stores,load1,store1,mov_reg")]
 )
 
 (define_insn "*movdf_aarch64"
   [(set (match_operand:DF 0 "nonimmediate_operand" "=w, ?r,w,w  ,w,m,r,m ,r")
        (match_operand:DF 1 "general_operand"      "?rY, w,w,Ufc,m,w,m,rY,r"))]
   "TARGET_FLOAT && (register_operand (operands[0], DFmode)
-    || register_operand (operands[1], DFmode))"
+    || aarch64_reg_or_fp_zero (operands[1], DFmode))"
   "@
    fmov\\t%d0, %x1
    fmov\\t%x0, %d1
    str\\t%x1, %0
    mov\\t%x0, %x1"
   [(set_attr "type" "f_mcr,f_mrc,fmov,fconstd,\
-                     f_loadd,f_stored,f_loadd,f_stored,mov_reg")]
+                     f_loadd,f_stored,load1,store1,mov_reg")]
 )
 
 (define_expand "movtf"
index e117dee16cfb6638609a109f4537fc4973f0e90f..657f167de0bb4f886261499ee318d592ce03f881 100644 (file)
@@ -1,3 +1,14 @@
+2015-06-19  Jim Wilson  <jim.wilson@linaro.org>
+
+       * gcc.target/aarch64/fmovd-zero-mem.c: New.
+       * gcc.target/aarch64/fmovd-zero-reg.c: New.
+       * gcc.target/aarch64/fmovf-zero-mem.c: New.
+       * gcc.target/aarch64/fmovf-zero-reg.c: New.
+       * gcc.target/aarch64/fmovld-zero-mem.c: New.
+       * gcc.target/aarch64/fmovld-zero-mem.c: New.
+       * gcc.target/aarch64/fmovd-zero.c: Delete.
+       * gcc.target/aarch64/fmovf-zero.c: Delete.
+
 2015-06-19  James Greenhalgh  <james.greenhalgh@arm.com>
 
        * gcc.target/vax/bswapdi-1.c: New.
diff --git a/gcc/testsuite/gcc.target/aarch64/fmovd-zero-mem.c b/gcc/testsuite/gcc.target/aarch64/fmovd-zero-mem.c
new file mode 100644 (file)
index 0000000..9245c48
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (double *output)
+{
+  *output = 0.0;
+}
+
+/* { dg-final { scan-assembler "str\\txzr, \\\[x0\\\]" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/fmovd-zero-reg.c b/gcc/testsuite/gcc.target/aarch64/fmovd-zero-reg.c
new file mode 100644 (file)
index 0000000..0a3e594
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void bar (double);
+void
+foo (void)
+{
+  bar (0.0);
+}
+
+/* { dg-final { scan-assembler "fmov\\td0, xzr" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/fmovd-zero.c b/gcc/testsuite/gcc.target/aarch64/fmovd-zero.c
deleted file mode 100644 (file)
index 7e4590a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2" } */
-
-void
-foo (double *output)
-{
-  *output = 0.0;
-}
-
-/* { dg-final { scan-assembler "fmov\\td\[0-9\]+, xzr" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/fmovf-zero-mem.c b/gcc/testsuite/gcc.target/aarch64/fmovf-zero-mem.c
new file mode 100644 (file)
index 0000000..518eff0
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (float *output)
+{
+  *output = 0.0;
+}
+
+/* { dg-final { scan-assembler "str\\twzr, \\\[x0\\\]" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/fmovf-zero-reg.c b/gcc/testsuite/gcc.target/aarch64/fmovf-zero-reg.c
new file mode 100644 (file)
index 0000000..4213450
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void bar (float);
+void
+foo (void)
+{
+  bar (0.0);
+}
+
+/* { dg-final { scan-assembler "fmov\\ts0, wzr" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/fmovf-zero.c b/gcc/testsuite/gcc.target/aarch64/fmovf-zero.c
deleted file mode 100644 (file)
index 5050ac3..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2" } */
-
-void
-foo (float *output)
-{
-  *output = 0.0;
-}
-
-/* { dg-final { scan-assembler "fmov\\ts\[0-9\]+, wzr" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/fmovld-zero-mem.c b/gcc/testsuite/gcc.target/aarch64/fmovld-zero-mem.c
new file mode 100644 (file)
index 0000000..e649404
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (long double *output)
+{
+  *output = 0.0;
+}
+
+/* { dg-final { scan-assembler "stp\\txzr, xzr, \\\[x0\\\]" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/fmovld-zero-reg.c b/gcc/testsuite/gcc.target/aarch64/fmovld-zero-reg.c
new file mode 100644 (file)
index 0000000..ca602cb
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void bar (long double);
+void
+foo (void)
+{
+  bar (0.0);
+}
+
+/* { dg-final { scan-assembler "movi\\tv0\.2d, #0" } } */