[PATCH][AARCH64]Add backend aarch64_bfi pattern.
authorRenlin Li <renlin.li@arm.com>
Wed, 26 Aug 2015 17:37:42 +0000 (17:37 +0000)
committerRenlin Li <renlin@gcc.gnu.org>
Wed, 26 Aug 2015 17:37:42 +0000 (17:37 +0000)
2015-08-26  Renlin Li  <renlin.li@arm.com>

gcc/
* config/aarch64/aarch64.md (aarch64_bfi): New pattern.

gcc/testsuite/
* gcc.target/aarch64/combine_bfi_1.c: New.

From-SVN: r227226

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

index a0c4fb99acd468d6a547a5870e003e780dd59092..c56f8ba11f52ac9f8cd31e360c51dcc0aca397a5 100644 (file)
@@ -1,3 +1,7 @@
+2015-08-26  Renlin Li  <renlin.li@arm.com>
+
+       * config/aarch64/aarch64.md (*aarch64_bfi<GPI:mode><ALLX:mode>4): New.
+
 2015-08-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
            Jiong Wang  <jiong.wang@arm.com>
 
index 80fd6c4894ebdc738b2c635c80b74592ec32b162..c8511f0c88579a66f1aac803957509d70fb7f7bf 100644 (file)
   [(set_attr "type" "bfm")]
 )
 
+(define_insn "*aarch64_bfi<GPI:mode><ALLX:mode>4"
+  [(set (zero_extract:GPI (match_operand:GPI 0 "register_operand" "+r")
+                         (match_operand 1 "const_int_operand" "n")
+                         (match_operand 2 "const_int_operand" "n"))
+       (zero_extend:GPI (match_operand:ALLX 3  "register_operand" "r")))]
+  "UINTVAL (operands[1]) <= <ALLX:sizen>"
+  "bfi\\t%<GPI:w>0, %<GPI:w>3, %2, %1"
+  [(set_attr "type" "bfm")]
+)
+
 (define_insn "*extr_insv_lower_reg<mode>"
   [(set (zero_extract:GPI (match_operand:GPI 0 "register_operand" "+r")
                          (match_operand 1 "const_int_operand" "n")
index b1dcc1588dc1a3b1febb8848b94d8363c94d82e3..27be013c3d9fd9862c9f138b1d24c0cdef6f9913 100644 (file)
@@ -1,3 +1,7 @@
+2015-08-26  Renlin Li  <renlin.li@arm.com>
+
+       * gcc.target/aarch64/combine_bfi_1.c: New testcase.
+
 2015-08-26  Jiong Wang  <jiong.wang@arm.com>
 
        * gcc.target/aarch64/tlsie_tiny_1.c: New testcase.
diff --git a/gcc/testsuite/gcc.target/aarch64/combine_bfi_1.c b/gcc/testsuite/gcc.target/aarch64/combine_bfi_1.c
new file mode 100644 (file)
index 0000000..accf144
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-rtl-combine" } */
+
+int
+f1 (int x, int y)
+{
+  return (x & ~0x0ffff00) | ((y << 8) & 0x0ffff00);
+}
+
+int
+f2 (int x, int y)
+{
+  return (x & ~0x0ff000) | ((y & 0x0ff) << 12);
+}
+
+int
+f3 (int x, int y)
+{
+  return (x & ~0xffff) | (y & 0xffff);
+}
+
+int
+f4 (int x, int y)
+{
+  return (x & ~0xff) | (y & 0xff);
+}
+
+long
+f5 (long x, long y)
+{
+  return (x & ~0xffffffffull) | (y & 0xffffffff);
+}
+
+/* { dg-final { scan-rtl-dump-times "\\*aarch64_bfi" 5 "combine" } } */