1 /* { dg-do assemble { target aarch64_asm_sve_ok } } */ 2 /* -fno-tree-loop-distribute-patterns prevents conversion to memset. */ 3 /* { dg-options "-O3 -fno-tree-loop-distribute-patterns --save-temps" } */ 4 5 #include <stdint.h> 6 7 #define NUM_ELEMS(TYPE) (1024 / sizeof (TYPE)) 8 9 #define DEF_SET_IMM(TYPE, IMM, SUFFIX) \ 10 void __attribute__ ((noinline, noclone)) \ 11 set_##TYPE##_##SUFFIX (TYPE *a) \ 12 { \ 13 for (int i = 0; i < NUM_ELEMS (TYPE); i++) \ 14 a[i] = IMM; \ 15 } 16 17 #define DEF_SET_IMM_FP(IMM, SUFFIX) \ 18 DEF_SET_IMM (float, IMM, SUFFIX) \ 19 DEF_SET_IMM (double, IMM, SUFFIX) 20 21 /* Valid. */ 22 DEF_SET_IMM_FP (1, imm1) 23 DEF_SET_IMM_FP (0x1.1p0, imm1p0) 24 DEF_SET_IMM_FP (0x1.fp0, immfp0) 25 DEF_SET_IMM_FP (0x1.1p4, imm1p4) 26 DEF_SET_IMM_FP (0x1.1p-3, imm1pm3) 27 DEF_SET_IMM_FP (0x1.fp4, immfp4) 28 DEF_SET_IMM_FP (0x1.fp-3, immfpm3) 29 30 /* Should use MOV instead. */ 31 DEF_SET_IMM_FP (0, imm0) 32 33 /* Invalid. */ 34 DEF_SET_IMM_FP (0x1.1fp0, imm1fp0) 35 DEF_SET_IMM_FP (0x1.1p5, imm1p5) 36 DEF_SET_IMM_FP (0x1.1p-4, imm1pm4) 37 DEF_SET_IMM_FP (0x1.1fp5, imm1fp5) 38 DEF_SET_IMM_FP (0x1.1fp-4, imm1fpm4) 39 40 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s,} 7 } } */ 41 42 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #1.0e\+0\n} 1 } } */ 43 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #1.0625e\+0\n} 1 } } */ 44 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #1.9375e\+0\n} 1 } } */ 45 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #1.7e\+1\n} 1 } } */ 46 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #1.328125e-1\n} 1 } } */ 47 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #3.1e\+1\n} 1 } } */ 48 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #2.421875e-1\n} 1 } } */ 49 50 /* { dg-final { scan-assembler-times {\tmov\tz[0-9]+\.s, #0\n} 1 } } */ 51 52 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d,} 7 } } */ 53 54 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #1.0e\+0\n} 1 } } */ 55 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #1.0625e\+0\n} 1 } } */ 56 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #1.9375e\+0\n} 1 } } */ 57 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #1.7e\+1\n} 1 } } */ 58 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #1.328125e-1\n} 1 } } */ 59 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #3.1e\+1\n} 1 } } */ 60 /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #2.421875e-1\n} 1 } } */ 61 62 /* { dg-final { scan-assembler-times {\tmov\tz[0-9]+\.d, #0\n} 1 } } */ 63