]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/s390/zvector/vec_store_len_r.c
2 /* { dg-require-effective-target s390_vxe2 } */
3 /* { dg-options "-O3 -mzarch -march=arch13 -mzvector --save-temps" } */
8 typedef vector
unsigned char uv16qi
;
10 uv16qi test_vec
= (uv16qi
){ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
12 #define NUM_TEST_LENGTHS 3
14 unsigned int test_len
[NUM_TEST_LENGTHS
] = { 0, 12, 18 };
17 /* Proceeding from left to right, the specified number (LEN+1) of
18 rightmost bytes from SOURCE are stored in TARGET. */
19 void __attribute__((noinline
, noclone
, target ("arch=zEC12")))
20 emul (unsigned char *source
, unsigned char *target
, unsigned int len
)
25 for (int s
= start
, t
= 0; s
< 16; s
++, t
++)
26 target
[t
] = source
[s
];
29 void __attribute__((noinline
, noclone
))
30 vec_store_len_r_reg (uv16qi s
, unsigned char *t
, unsigned int len
)
32 vec_store_len_r (s
, t
, len
);
35 void __attribute__((noinline
, noclone
))
36 vec_store_len_r_mem (uv16qi
*s
, unsigned char *t
, unsigned int *len
)
38 vec_store_len_r (*s
, t
, *len
);
41 #define GEN_CONST_FUNC(CONST) \
43 vec_store_len_r_const##CONST (uv16qi s, unsigned char *t) \
45 vec_store_len_r (s, t, CONST); \
48 #define GEN_CONST_TEST(CONST) \
49 memset (exp_result, 0, 16); \
50 emul ((unsigned char*)&test_vec, exp_result, CONST); \
51 memset (result, 0, 16); \
52 vec_store_len_r_const##CONST (test_vec, result); \
53 if (memcmp (result, exp_result, 16) != 0) \
63 unsigned char exp_result
[16];
64 unsigned char result
[16];
66 for (int i
= 0; i
< NUM_TEST_LENGTHS
; i
++)
68 memset (exp_result
, 0, 16);
70 emul ((unsigned char*)&test_vec
, exp_result
, test_len
[i
]);
72 memset (result
, 0, 16);
73 vec_store_len_r_reg (test_vec
, result
, test_len
[i
]);
74 if (memcmp (result
, exp_result
, 16) != 0)
77 memset (result
, 0, 16);
78 vec_store_len_r_mem (&test_vec
, result
, &test_len
[i
]);
79 if (memcmp (result
, exp_result
, 16) != 0)
90 /* vec_store_len_r_reg and vec_store_len_r_mem */
91 /* { dg-final { scan-assembler-times "vstrlr\t" 2 } } */
93 /* For the 2 constants. The 3. should be implemented with vst. */
94 /* { dg-final { scan-assembler-times "vstrl\t" 2 } } */