| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ |
| 3 |
/* { dg-add-options arm_v8_1m_mve_fp } */ |
| 4 |
/* { dg-additional-options "-O3" } */ |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME) \ |
| 9 |
void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \ |
| 10 |
TYPE##BITS##_t *a) { \ |
| 11 |
int i; \ |
| 12 |
for (i=0; i<NB; i++) { \ |
| 13 |
dest[i] = a[i] OP 1; \ |
| 14 |
} \ |
| 15 |
} |
| 16 |
|
| 17 |
/* 128-bit vectors. */ |
| 18 |
FUNC_IMM(s, int, 32, 4, -, vsubimm) |
| 19 |
FUNC_IMM(u, uint, 32, 4, -, vsubimm) |
| 20 |
FUNC_IMM(s, int, 16, 8, -, vsubimm) |
| 21 |
FUNC_IMM(u, uint, 16, 8, -, vsubimm) |
| 22 |
FUNC_IMM(s, int, 8, 16, -, vsubimm) |
| 23 |
FUNC_IMM(u, uint, 8, 16, -, vsubimm) |
| 24 |
|
| 25 |
/* For the moment we do not select the T2 vsub variant operating on a scalar |
| 26 |
final argument, and we use vadd of the opposite. */ |
| 27 |
/* { dg-final { scan-assembler-times {vadd\.i32 q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */ |
| 28 |
/* { dg-final { scan-assembler-times {vadd\.i16 q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */ |
| 29 |
/* { dg-final { scan-assembler-times {vadd\.i8 q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */ |
| 30 |
|
| 31 |
void test_vsubimm_f32 (float * dest, float * a) { |
| 32 |
int i; |
| 33 |
for (i=0; i<4; i++) { |
| 34 |
dest[i] = a[i] - 5.0; |
| 35 |
} |
| 36 |
} |
| 37 |
/* { dg-final { scan-assembler-times {vadd\.f32 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */ |
| 38 |
|
| 39 |
/* Note that dest[i] = a[i] + 5.0f16 is not vectorized. */ |
| 40 |
void test_vsubimm_f16 (__fp16 * dest, __fp16 * a) { |
| 41 |
int i; |
| 42 |
__fp16 b = 5.0f16; |
| 43 |
for (i=0; i<8; i++) { |
| 44 |
dest[i] = a[i] - b; |
| 45 |
} |
| 46 |
} |
| 47 |
/* { dg-final { scan-assembler-times {vadd\.f16 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */ |