From: Ian Bolton Date: Tue, 2 Jul 2013 10:57:30 +0000 (+0000) Subject: AArch64 Support BFXIL in backend X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2879bb2b1887b2b7858b9ef037cc8b446b7d002b;p=gcc.git AArch64 Support BFXIL in backend From-SVN: r200595 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 727b579e924..5f41e369e1f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2013-07-02 Ian Bolton + + * config/aarch64/aarch64.md (*extr_insv_reg): New pattern. + 2013-07-02 Kyrylo Tkachov * 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 e88e5be894e..d06a202e921 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -3225,6 +3225,21 @@ (set_attr "mode" "")] ) +(define_insn "*extr_insv_lower_reg" + [(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)))" + "bfxil\\t%0, %2, %3, %1" + [(set_attr "v8type" "bfm") + (set_attr "mode" "")] +) + (define_insn "*_shft_" [(set (match_operand:GPI 0 "register_operand" "=r") (ashift:GPI (ANY_EXTEND:GPI diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3bf1f96be7e..7357b3c386c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-07-02 Ian Bolton + + * gcc.target/aarch64/bfxil_1.c: New test. + * gcc.target/aarch64/bfxil_2.c: Likewise. + 2013-07-01 Balaji V. Iyer 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 00000000000..b16834786a1 --- /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 00000000000..4e4d610c26c --- /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 } } */