AArch64 - Update insv tests for big endian

From-SVN: r200597
This commit is contained in:
Ian Bolton 2013-07-02 11:02:17 +00:00 committed by Ian Bolton
parent 26366d2816
commit f8411fcce9
4 changed files with 103 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2013-07-02 Ian Bolton <ian.bolton@arm.com>
* gcc.target/config/aarch64/insv_1.c: Update to show it doesn't work
on big endian.
* gcc.target/config/aarch64/insv_2.c: New test for big endian.
* lib/target-supports.exp: Define aarch64_little_endian.
2013-07-02 Ian Bolton <ian.bolton@arm.com>
* gcc.target/aarch64/abs_1.c: New test.

View File

@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-do run { target aarch64*-*-* } } */
/* { dg-options "-O2 --save-temps -fno-inline" } */
/* { dg-require-effective-target aarch64_little_endian } */
extern void abort (void);

View File

@ -0,0 +1,85 @@
/* { 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 eight: 8;
unsigned short four: 4;
unsigned short five: 5;
unsigned short seven: 7;
unsigned int sixteen: 16;
} bitfield;
bitfield
bfi1 (bitfield a)
{
/* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 56, 8" } } */
a.eight = 3;
return a;
}
bitfield
bfi2 (bitfield a)
{
/* { dg-final { scan-assembler "bfi\tx\[0-9\]+, x\[0-9\]+, 43, 5" } } */
a.five = 7;
return a;
}
bitfield
movk (bitfield a)
{
/* { dg-final { scan-assembler "movk\tx\[0-9\]+, 0x1d6b, lsl 16" } } */
a.sixteen = 7531;
return a;
}
bitfield
set1 (bitfield a)
{
/* { dg-final { scan-assembler "orr\tx\[0-9\]+, x\[0-9\]+, 272678883688448" } } */
a.five = 0x1f;
return a;
}
bitfield
set0 (bitfield a)
{
/* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, -272678883688449" } } */
a.five = 0;
return a;
}
int
main (int argc, char** argv)
{
static bitfield a;
bitfield b = bfi1 (a);
bitfield c = bfi2 (b);
bitfield d = movk (c);
if (d.eight != 3)
abort ();
if (d.five != 7)
abort ();
if (d.sixteen != 7531)
abort ();
d = set1 (d);
if (d.five != 0x1f)
abort ();
d = set0 (d);
if (d.five != 0)
abort ();
return 0;
}
/* { dg-final { cleanup-saved-temps } } */

View File

@ -2106,6 +2106,15 @@ proc check_effective_target_aarch64_big_endian { } {
}]
}
# Return 1 if this is a AArch64 target supporting little endian
proc check_effective_target_aarch64_little_endian { } {
return [check_no_compiler_messages aarch64_little_endian assembly {
#if !defined(__aarch64__) || defined(__AARCH64EB__)
#error FOO
#endif
}]
}
# Return 1 is this is an arm target using 32-bit instructions
proc check_effective_target_arm32 { } {
return [check_no_compiler_messages arm32 assembly {