| 1 |
/* { dg-do run { target aarch64_sve_hw } } */ |
| 2 |
/* { dg-options "-O0 -ffixed-z0 -ffixed-p0" } */ |
| 3 |
|
| 4 |
#include <arm_sve.h> |
| 5 |
|
| 6 |
#define ASM_FUNCTION(NAME, RET_TYPE, ARG_TYPE, INSN) \ |
| 7 |
extern RET_TYPE NAME (svbool_t, ARG_TYPE); \ |
| 8 |
asm( \ |
| 9 |
" .type " #NAME ", %function\n" \ |
| 10 |
#NAME ":\n" \ |
| 11 |
" " INSN "\n" \ |
| 12 |
" ret\n" \ |
| 13 |
" .size " #NAME ", .-" #NAME "\n" \ |
| 14 |
) |
| 15 |
|
| 16 |
ASM_FUNCTION (u8_callee, uint64_t, svuint8_t, |
| 17 |
"uaddv d0, p0, z0.b\n\tfmov x0, d0"); |
| 18 |
ASM_FUNCTION (u16_callee, uint64_t, svuint16_t, |
| 19 |
"uaddv d0, p0, z0.h\n\tfmov x0, d0"); |
| 20 |
ASM_FUNCTION (u32_callee, uint64_t, svuint32_t, |
| 21 |
"uaddv d0, p0, z0.s\n\tfmov x0, d0"); |
| 22 |
ASM_FUNCTION (u64_callee, uint64_t, svuint64_t, |
| 23 |
"uaddv d0, p0, z0.d\n\tfmov x0, d0"); |
| 24 |
|
| 25 |
ASM_FUNCTION (s8_callee, int64_t, svint8_t, |
| 26 |
"saddv d0, p0, z0.b\n\tfmov x0, d0"); |
| 27 |
ASM_FUNCTION (s16_callee, int64_t, svint16_t, |
| 28 |
"saddv d0, p0, z0.h\n\tfmov x0, d0"); |
| 29 |
ASM_FUNCTION (s32_callee, int64_t, svint32_t, |
| 30 |
"saddv d0, p0, z0.s\n\tfmov x0, d0"); |
| 31 |
ASM_FUNCTION (s64_callee, int64_t, svint64_t, |
| 32 |
"uaddv d0, p0, z0.d\n\tfmov x0, d0"); |
| 33 |
|
| 34 |
ASM_FUNCTION (f16_callee, float16_t, svfloat16_t, "faddv\th0, p0, z0.h"); |
| 35 |
ASM_FUNCTION (f32_callee, float32_t, svfloat32_t, "faddv\ts0, p0, z0.s"); |
| 36 |
ASM_FUNCTION (f64_callee, float64_t, svfloat64_t, "faddv\td0, p0, z0.d"); |
| 37 |
|
| 38 |
int |
| 39 |
main (void) |
| 40 |
{ |
| 41 |
if (u8_callee (svptrue_pat_b8 (SV_VL7), svdup_u8 (-1)) != 7 * 0xff) |
| 42 |
__builtin_abort (); |
| 43 |
if (u16_callee (svptrue_pat_b16 (SV_VL6), svdup_u16 (-1)) != 6 * 0xffff) |
| 44 |
__builtin_abort (); |
| 45 |
if (u32_callee (svptrue_pat_b32 (SV_VL3), svdup_u32 (-1)) |
| 46 |
!= 3 * (uint64_t) (uint32_t) -1) |
| 47 |
__builtin_abort (); |
| 48 |
if (u64_callee (svptrue_pat_b64 (SV_VL2), svdup_u64 ((uint64_t) 1 << 33)) |
| 49 |
!= (uint64_t) 1 << 34) |
| 50 |
__builtin_abort (); |
| 51 |
|
| 52 |
if (s8_callee (svptrue_pat_b8 (SV_VL7), svdup_s8 (-10)) != -70) |
| 53 |
__builtin_abort (); |
| 54 |
if (s16_callee (svptrue_pat_b16 (SV_VL6), svdup_s16 (-14)) != -84) |
| 55 |
__builtin_abort (); |
| 56 |
if (s32_callee (svptrue_pat_b32 (SV_VL3), svdup_s32 (-22)) != -66) |
| 57 |
__builtin_abort (); |
| 58 |
if (s64_callee (svptrue_pat_b64 (SV_VL2), svdup_s64 ((int64_t) 1 << 33)) |
| 59 |
!= (int64_t) 1 << 34) |
| 60 |
__builtin_abort (); |
| 61 |
|
| 62 |
if (f16_callee (svptrue_pat_b16 (SV_VL5), svdup_f16 (1.0)) != 5.0) |
| 63 |
__builtin_abort (); |
| 64 |
if (f32_callee (svptrue_b32 (), svdup_f32 (3.0)) != 3 * svcntw ()) |
| 65 |
__builtin_abort (); |
| 66 |
if (f64_callee (svptrue_b64 (), svdup_f64 (11.0)) != 11 * svcntd ()) |
| 67 |
__builtin_abort (); |
| 68 |
|
| 69 |
return 0; |
| 70 |
} |