aarch64.md (*ngc<mode>): New pattern.
authorNaveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>
Thu, 25 Apr 2013 11:55:05 +0000 (11:55 +0000)
committerNaveen H.S <naveenh@gcc.gnu.org>
Thu, 25 Apr 2013 11:55:05 +0000 (11:55 +0000)
gcc/

2013-04-25  Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

* config/aarch64/aarch64.md (*ngc<mode>): New pattern.
(*ngcsi_uxtw): New pattern.

gcc/testsuite/

2013-04-25  Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

* gcc.target/aarch64/ngc.c: New.

From-SVN: r198302

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

index e4d576778c64dbc8e4e7be9cbf61e0f1fd5f04b8..e281812f7facf412a39822dfc2e5473a4cab70d7 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-25  Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>
+
+       * config/aarch64/aarch64.md (*ngc<mode>): New pattern.
+       (*ngcsi_uxtw): New pattern.
+
 2013-04-25  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
             Julian Brown  <julian@codesourcery.com>
 
index aee662638e313026775e496128510bbe7bd81a2c..3e1059142a1bc546ef824c5cb1fb6f586b5ecf78 100644 (file)
    (set_attr "mode" "SI")]
 )
 
+(define_insn "*ngc<mode>"
+  [(set (match_operand:GPI 0 "register_operand" "=r")
+       (minus:GPI (neg:GPI (ltu:GPI (reg:CC CC_REGNUM) (const_int 0)))
+                  (match_operand:GPI 1 "register_operand" "r")))]
+  ""
+  "ngc\\t%<w>0, %<w>1"
+  [(set_attr "v8type" "adc")
+   (set_attr "mode" "<MODE>")]
+)
+
+(define_insn "*ngcsi_uxtw"
+  [(set (match_operand:DI 0 "register_operand" "=r")
+       (zero_extend:DI
+        (minus:SI (neg:SI (ltu:SI (reg:CC CC_REGNUM) (const_int 0)))
+                  (match_operand:SI 1 "register_operand" "r"))))]
+  ""
+  "ngc\\t%w0, %w1"
+  [(set_attr "v8type" "adc")
+   (set_attr "mode" "SI")]
+)
+
 (define_insn "*neg<mode>2_compare0"
   [(set (reg:CC_NZ CC_REGNUM)
        (compare:CC_NZ (neg:GPI (match_operand:GPI 1 "register_operand" "r"))
index 0bc2c8350f28e8bd00661d59a6347656c9ccd048..035ea20ad3c7043bcad48ed59ba4a4bf04af6863 100644 (file)
@@ -1,3 +1,7 @@
+2013-04-25  Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>
+
+       * gcc.target/aarch64/ngc.c: New.
+
 2013-04-25  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * lib/target-supports.exp
diff --git a/gcc/testsuite/gcc.target/aarch64/ngc.c b/gcc/testsuite/gcc.target/aarch64/ngc.c
new file mode 100644 (file)
index 0000000..3364321
--- /dev/null
@@ -0,0 +1,66 @@
+/* { dg-do run } */
+/* { dg-options "-O2 --save-temps -fno-inline" } */
+
+extern void abort (void);
+typedef unsigned int u32;
+
+u32
+ngc_si (u32 a, u32 b, u32 c, u32 d)
+{
+  a = -b - (c < d);
+  return a;
+}
+
+typedef unsigned long long u64;
+
+u64
+ngc_si_tst (u64 a, u32 b, u32 c, u32 d)
+{
+  a = -b - (c < d);
+  return a;
+}
+
+u64
+ngc_di (u64 a, u64 b, u64 c, u64 d)
+{
+  a = -b - (c < d);
+  return a;
+}
+
+int
+main ()
+{
+  int x;
+  u64 y;
+
+  x = ngc_si (29, 4, 5, 4);
+  if (x != -4)
+    abort ();
+
+  x = ngc_si (1024, 2, 20, 13);
+  if (x != -2)
+    abort ();
+
+  y = ngc_si_tst (0x130000029ll, 32, 50, 12);
+  if (y != 0xffffffe0)
+    abort ();
+
+  y = ngc_si_tst (0x5000500050005ll, 21, 2, 14);
+  if (y != 0xffffffea)
+    abort ();
+
+  y = ngc_di (0x130000029ll, 0x320000004ll, 0x505050505ll, 0x123123123ll);
+  if (y != 0xfffffffcdffffffc)
+    abort ();
+
+  y = ngc_di (0x5000500050005ll,
+             0x2111211121112ll, 0x0000000002020ll, 0x1414575046477ll);
+  if (y != 0xfffdeeedeeedeeed)
+    abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "ngc\tw\[0-9\]+, w\[0-9\]+" 2 } } */
+/* { dg-final { scan-assembler-times "ngc\tx\[0-9\]+, x\[0-9\]+" 1 } } */
+/* { dg-final { cleanup-saved-temps } } */