1 /* { dg-do compile } */ 2 /* { dg-options "-O3 -fno-tree-loop-distribute-patterns" } */ 3 4 #include <stdint.h> 5 6 #define NUM_ELEMS(TYPE) (1024 / sizeof (TYPE)) 7 8 #define DEF_LOAD_BROADCAST(TYPE) \ 9 void __attribute__ ((noinline, noclone)) \ 10 set_##TYPE (TYPE *restrict a, TYPE *restrict b) \ 11 { \ 12 for (int i = 0; i < NUM_ELEMS (TYPE); i++) \ 13 a[i] = *b; \ 14 } 15 16 #define DEF_LOAD_BROADCAST_IMM(TYPE, IMM, SUFFIX) \ 17 void __attribute__ ((noinline, noclone)) \ 18 set_##TYPE##_##SUFFIX (TYPE *a) \ 19 { \ 20 for (int i = 0; i < NUM_ELEMS (TYPE); i++) \ 21 a[i] = IMM; \ 22 } 23 24 #define FOR_EACH_LOAD_BROADCAST(T) \ 25 T (int8_t) \ 26 T (int16_t) \ 27 T (int32_t) \ 28 T (int64_t) 29 30 #define FOR_EACH_LOAD_BROADCAST_IMM(T) \ 31 T (int32_t, 0x12345678, imm_0x12345678) \ 32 T (int64_t, 0x12345678, imm_0x12345678) \ 33 \ 34 T (int32_t, 0xF2345678, imm_0xF2345678) \ 35 T (int64_t, 0xF2345678, imm_0xF2345678) \ 36 \ 37 T (int64_t, (int64_t) 0xFEBA716B12371765, imm_FEBA716B12371765) 38 39 FOR_EACH_LOAD_BROADCAST (DEF_LOAD_BROADCAST) 40 FOR_EACH_LOAD_BROADCAST_IMM (DEF_LOAD_BROADCAST_IMM) 41 42 /* { dg-final { scan-assembler-times {\tld1rb\tz[0-9]+\.b, p[0-7]/z, } 1 } } */ 43 /* { dg-final { scan-assembler-times {\tld1rh\tz[0-9]+\.h, p[0-7]/z, } 1 } } */ 44 /* { dg-final { scan-assembler-times {\tld1rw\tz[0-9]+\.s, p[0-7]/z, } 3 } } */ 45 /* { dg-final { scan-assembler-times {\tld1rd\tz[0-9]+\.d, p[0-7]/z, } 4 } } */ 46