| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target arm_crypto_ok } */ |
| 3 |
/* { dg-add-options arm_crypto } */ |
| 4 |
/* { dg-additional-options "-O3" } */ |
| 5 |
|
| 6 |
#include "arm_neon.h" |
| 7 |
|
| 8 |
uint32_t foo (void) |
| 9 |
|
| 10 |
{ |
| 11 |
uint32_t hash = 0xdeadbeef; |
| 12 |
uint32x4_t a = {0, 1, 2, 3}; |
| 13 |
uint32x4_t b = {3, 2, 1, 0}; |
| 14 |
|
| 15 |
uint32x4_t res = vsha1pq_u32 (a, hash, b); |
| 16 |
return res[0]; |
| 17 |
} |
| 18 |
|
| 19 |
#define GET_LANE(lane) \ |
| 20 |
uint32x4_t foo_lane##lane (uint32x4_t val,uint32x4_t a, uint32x4_t b)\ |
| 21 |
{ \ |
| 22 |
return vsha1pq_u32 (a, vgetq_lane_u32 (val, lane), b); \ |
| 23 |
} |
| 24 |
|
| 25 |
#define TEST_SHA1P_VEC_SELECT(FUNC) \ |
| 26 |
FUNC (0) \ |
| 27 |
FUNC (1) \ |
| 28 |
FUNC (2) \ |
| 29 |
FUNC (3) \ |
| 30 |
|
| 31 |
TEST_SHA1P_VEC_SELECT (GET_LANE) |
| 32 |
|
| 33 |
/* { dg-final { scan-assembler-times {sha1p.32\tq[0-9]+, q[0-9]+} 5 } } */ |
| 34 |
/* { dg-final { scan-assembler-times {vdup.32\tq[0-9]+, r[0-9]+} 4 } } */ |
| 35 |
/* { dg-final { scan-assembler-times {vmov.32\tr[0-9]+, d[0-9]+\[[0-9]+\]+} 3 } } */ |