| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target arm_v8_1m_mve_ok } */ |
| 3 |
/* { dg-options "-O3" } */ |
| 4 |
/* { dg-add-options arm_v8_1m_mve } */ |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
#define MAX(a, b) ((a) > (b)) ? (a) : (b) |
| 9 |
#define MIN(a, b) ((a) < (b)) ? (a) : (b) |
| 10 |
|
| 11 |
|
| 12 |
#define TEST_BINOP(OP, TY, N) \ |
| 13 |
TY test_##OP##_##TY (TY * dest, TY * a, TY * b) \ |
| 14 |
{ \ |
| 15 |
int i; \ |
| 16 |
for (i=0; i<N; i++) \ |
| 17 |
{ \ |
| 18 |
dest[i] = OP (a[i], b[i]); \ |
| 19 |
} \ |
| 20 |
} |
| 21 |
|
| 22 |
/* Test vmax. */ |
| 23 |
|
| 24 |
TEST_BINOP (MAX, int32_t, 4) |
| 25 |
/* { dg-final { scan-assembler-times {vmax\.s32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 26 |
|
| 27 |
TEST_BINOP (MAX, uint32_t, 4) |
| 28 |
/* { dg-final { scan-assembler-times {vmax\.u32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 29 |
|
| 30 |
TEST_BINOP (MAX, int16_t, 8) |
| 31 |
/* { dg-final { scan-assembler-times {vmax\.s16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 32 |
|
| 33 |
TEST_BINOP (MAX, uint16_t, 8) |
| 34 |
/* { dg-final { scan-assembler-times {vmax\.u16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 35 |
|
| 36 |
TEST_BINOP (MAX, int8_t, 16) |
| 37 |
/* { dg-final { scan-assembler-times {vmax\.s8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 38 |
|
| 39 |
TEST_BINOP (MAX, uint8_t, 16) |
| 40 |
/* { dg-final { scan-assembler-times {vmax\.u8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 41 |
|
| 42 |
/* Test vmin. */ |
| 43 |
|
| 44 |
TEST_BINOP (MIN, int32_t, 4) |
| 45 |
/* { dg-final { scan-assembler-times {vmin\.s32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 46 |
|
| 47 |
TEST_BINOP (MIN, uint32_t, 4) |
| 48 |
/* { dg-final { scan-assembler-times {vmin\.u32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 49 |
|
| 50 |
TEST_BINOP (MIN, int16_t, 8) |
| 51 |
/* { dg-final { scan-assembler-times {vmin\.s16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 52 |
|
| 53 |
TEST_BINOP (MIN, uint16_t, 8) |
| 54 |
/* { dg-final { scan-assembler-times {vmin\.u16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 55 |
|
| 56 |
TEST_BINOP (MIN, int8_t, 16) |
| 57 |
/* { dg-final { scan-assembler-times {vmin\.s8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 58 |
|
| 59 |
TEST_BINOP (MIN, uint8_t, 16) |
| 60 |
/* { dg-final { scan-assembler-times {vmin\.u8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 61 |
|