AArch64 Support BFXIL in backend

From-SVN: r200595
This commit is contained in:
Ian Bolton 2013-07-02 10:57:30 +00:00 committed by Ian Bolton
parent afc5e8a6a7
commit 2879bb2b18
5 changed files with 106 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 } } */

View File

@ -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 } } */