Skip to content

Commit

Permalink
[AArch64 Testsuite] Extend test of vld1+vst1 intrinsics to cover more…
Browse files Browse the repository at this point in the history
… variants

	* gcc.target/aarch64/vld1-vst1_1.c: Rewrite to test all variants.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215077 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
alalaw01 committed Sep 9, 2014
1 parent 76f83a4 commit 42839bf
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 37 deletions.
4 changes: 4 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2014-09-09 Alan Lawrence <[email protected]>

* gcc.target/aarch64/vld1-vst1_1.c: Rewrite to test all variants.

2014-09-09 Alan Lawrence <[email protected]>

* gcc.target/aarch64/vldN_1.c: New test.
Expand Down
80 changes: 43 additions & 37 deletions gcc/testsuite/gcc.target/aarch64/vld1-vst1_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,54 @@

extern void abort (void);

int __attribute__ ((noinline))
test_vld1_vst1 ()
{
int8x8_t a;
int8x8_t b;
int i = 0;
int8_t c[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
int8_t d[8];
a = vld1_s8 (c);
asm volatile ("":::"memory");
vst1_s8 (d, a);
asm volatile ("":::"memory");
for (; i < 8; i++)
if (c[i] != d[i])
return 1;
return 0;
#define TESTMETH(TYPE, NUM, BASETYPE, SUFFIX) \
int __attribute__ ((noinline)) \
test_vld1_vst1##SUFFIX () \
{ \
TYPE vec; \
int i = 0; \
BASETYPE src[NUM]; \
BASETYPE dest[NUM]; \
for (i = 0; i < NUM; i++) \
src[i] = 2*i + 1; \
asm volatile ("":::"memory"); \
vec = vld1 ## SUFFIX (src); \
asm volatile ("":::"memory"); \
vst1 ## SUFFIX (dest, vec); \
asm volatile ("":::"memory"); \
for (i = 0; i < NUM; i++) \
if (src[i] != dest[i]) \
return 1; \
return 0; \
}

int __attribute__ ((noinline))
test_vld1q_vst1q ()
{
int16x8_t a;
int16x8_t b;
int i = 0;
int16_t c[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
int16_t d[8];
a = vld1q_s16 (c);
asm volatile ("":::"memory");
vst1q_s16 (d, a);
asm volatile ("":::"memory");
for (; i < 8; i++)
if (c[i] != d[i])
return 1;
return 0;
}
#define VARIANTS(THING) \
THING (int8x8_t, 8, int8_t, _s8) \
THING (uint8x8_t, 8, uint8_t, _u8) \
THING (int16x4_t, 4, int16_t, _s16) \
THING (uint16x4_t, 4, uint16_t, _u16) \
THING (int32x2_t, 2, int32_t, _s32) \
THING (uint32x2_t, 2, uint32_t, _u32) \
THING (float32x2_t, 2, float32_t, _f32) \
THING (int8x16_t, 16, int8_t, q_s8) \
THING (uint8x16_t, 16, uint8_t, q_u8) \
THING (int16x8_t, 8, int16_t, q_s16) \
THING (uint16x8_t, 8, uint16_t, q_u16) \
THING (int32x4_t, 4, int32_t, q_s32) \
THING (uint32x4_t, 4, uint32_t, q_u32) \
THING (int64x2_t, 2, int64_t, q_s64) \
THING (uint64x2_t, 2, uint64_t, q_u64) \
THING (float64x2_t, 2, float64_t, q_f64)

VARIANTS (TESTMETH)

#define DOTEST(TYPE, NUM, BASETYPE, SUFFIX) \
if (test_vld1_vst1##SUFFIX ()) \
abort ();

int
main ()
{
if (test_vld1_vst1 ())
abort ();
if (test_vld1q_vst1q ())
abort ();
VARIANTS (DOTEST);
return 0;
}

0 comments on commit 42839bf

Please sign in to comment.