diff options
author | Ian Bolton <ian.bolton@arm.com> | 2013-07-02 10:57:30 +0000 |
---|---|---|
committer | Ian Bolton <ibolton@gcc.gnu.org> | 2013-07-02 10:57:30 +0000 |
commit | 2879bb2b1887b2b7858b9ef037cc8b446b7d002b (patch) | |
tree | e960d812a3a0787793a32c20f5eb961cccadaecb | |
parent | afc5e8a6a79510e207d23420417f78bcfb678b4e (diff) | |
download | gcc-2879bb2b1887b2b7858b9ef037cc8b446b7d002b.zip gcc-2879bb2b1887b2b7858b9ef037cc8b446b7d002b.tar.gz gcc-2879bb2b1887b2b7858b9ef037cc8b446b7d002b.tar.bz2 |
AArch64 Support BFXIL in backend
From-SVN: r200595
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.md | 15 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/bfxil_1.c | 40 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/bfxil_2.c | 42 |
5 files changed, 106 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 727b579..5f41e36 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2013-07-02 Ian Bolton <ian.bolton@arm.com> + + * config/aarch64/aarch64.md (*extr_insv_reg<mode>): New pattern. + 2013-07-02 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * config/arm/arm.md (arm_andsi3_insn): Add alternatives for 16-bit diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index e88e5be..d06a202 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -3225,6 +3225,21 @@ (set_attr "mode" "<MODE>")] ) +(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") + (const_int 0)) + (zero_extract:GPI (match_operand:GPI 2 "register_operand" "+r") + (match_dup 1) + (match_operand 3 "const_int_operand" "n")))] + "!(UINTVAL (operands[1]) == 0 + || (UINTVAL (operands[3]) + UINTVAL (operands[1]) + > GET_MODE_BITSIZE (<MODE>mode)))" + "bfxil\\t%<w>0, %<w>2, %3, %1" + [(set_attr "v8type" "bfm") + (set_attr "mode" "<MODE>")] +) + (define_insn "*<optab><ALLX:mode>_shft_<GPI:mode>" [(set (match_operand:GPI 0 "register_operand" "=r") (ashift:GPI (ANY_EXTEND:GPI diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3bf1f96..7357b3c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-07-02 Ian Bolton <ian.bolton@arm.com> + + * gcc.target/aarch64/bfxil_1.c: New test. + * gcc.target/aarch64/bfxil_2.c: Likewise. + 2013-07-01 Balaji V. Iyer <balaji.v.iyer@intel.com> PR c/57766 diff --git a/gcc/testsuite/gcc.target/aarch64/bfxil_1.c b/gcc/testsuite/gcc.target/aarch64/bfxil_1.c new file mode 100644 index 0000000..b168347 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/bfxil_1.c @@ -0,0 +1,40 @@ +/* { dg-do run { target aarch64*-*-* } } */ +/* { dg-options "-O2 --save-temps -fno-inline" } */ +/* { dg-require-effective-target aarch64_little_endian } */ + +extern void abort (void); + +typedef struct bitfield +{ + unsigned short eight1: 8; + unsigned short four: 4; + unsigned short eight2: 8; + unsigned short seven: 7; + unsigned int sixteen: 16; +} bitfield; + +bitfield +bfxil (bitfield a) +{ + /* { dg-final { scan-assembler "bfxil\tx\[0-9\]+, x\[0-9\]+, 16, 8" } } */ + a.eight1 = a.eight2; + return a; +} + +int +main (void) +{ + static bitfield a; + bitfield b; + + a.eight1 = 9; + a.eight2 = 57; + b = bfxil (a); + + if (b.eight1 != a.eight2) + abort (); + + return 0; +} + +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/bfxil_2.c b/gcc/testsuite/gcc.target/aarch64/bfxil_2.c new file mode 100644 index 0000000..4e4d610 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/bfxil_2.c @@ -0,0 +1,42 @@ +/* { dg-do run { target aarch64*-*-* } } */ +/* { dg-options "-O2 --save-temps -fno-inline" } */ +/* { dg-require-effective-target aarch64_big_endian } */ + +extern void abort (void); + +typedef struct bitfield +{ + unsigned short eight1: 8; + unsigned short four: 4; + unsigned short eight2: 8; + unsigned short seven: 7; + unsigned int sixteen: 16; + unsigned short eight3: 8; + unsigned short eight4: 8; +} bitfield; + +bitfield +bfxil (bitfield a) +{ + /* { dg-final { scan-assembler "bfxil\tx\[0-9\]+, x\[0-9\]+, 40, 8" } } */ + a.eight4 = a.eight2; + return a; +} + +int +main (void) +{ + static bitfield a; + bitfield b; + + a.eight4 = 9; + a.eight2 = 57; + b = bfxil (a); + + if (b.eight4 != a.eight2) + abort (); + + return 0; +} + +/* { dg-final { cleanup-saved-temps } } */ |