aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/fold-vec-load-vec_vsx_ld-longlong.c
blob: 67fd101cd1d7e79f9dfcc8c63e1096aba85d075d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Verify that overloaded built-ins for vec_vsx_ld with long long
   inputs produce the right code.  */

/* { dg-options "-mvsx -O2" } */
/* { dg-require-effective-target powerpc_vsx } */

#include <altivec.h>
#define BUILD_VAR_TEST(TESTNAME1, RETTYPE, VAR_OFFSET, LOADFROM)	\
RETTYPE									\
TESTNAME1 ## _var (VAR_OFFSET offset, LOADFROM * loadfrom) 		\
{									\
	return vec_vsx_ld (offset, loadfrom);				\
}

#define BUILD_CST_TEST(TESTNAME1, RETTYPE, CST_OFFSET, LOADFROM)	\
RETTYPE									\
TESTNAME1 ## _cst (LOADFROM * loadfrom) 				\
{									\
	return vec_vsx_ld (CST_OFFSET, loadfrom);			\
}

BUILD_VAR_TEST( test1,  vector signed long long, signed long long, signed long long);
BUILD_VAR_TEST( test2,  vector signed long long, signed int, signed long long);
BUILD_CST_TEST( test3,  vector signed long long, 12, signed long long);

BUILD_VAR_TEST( test4,  vector unsigned long long, signed long long, unsigned long long);
BUILD_VAR_TEST( test5,  vector unsigned long long, signed int, unsigned long long);
BUILD_CST_TEST( test6,  vector unsigned long long, 12, unsigned long long);

BUILD_VAR_TEST( test7,  vector signed long long, signed long long, vector signed long long);
BUILD_VAR_TEST( test8,  vector signed long long, signed int, vector signed long long);
BUILD_CST_TEST( test9,  vector signed long long, 12, vector signed long long);

BUILD_VAR_TEST( test10,  vector unsigned long long, signed long long, vector unsigned long long);
BUILD_VAR_TEST( test11,  vector unsigned long long, signed int, vector unsigned long long);
BUILD_CST_TEST( test12,  vector unsigned long long, 12, vector unsigned long long);

/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxvx\M|\mlvx\M|\mplxv\M} 12 } } */