1 /* { dg-do compile } */ 2 /* { dg-options "-O2 -ftree-vectorize" } */ 3 4 #include <stdint.h> 5 6 #define DEF_LOOP(TYPE1, TYPE2, CONST, COUNT) \ 7 void __attribute__ ((noipa)) \ 8 test_##CONST##_##TYPE1##_##TYPE2 (TYPE2 *restrict r, \ 9 TYPE1 *restrict a, \ 10 TYPE2 *restrict b) \ 11 { \ 12 for (int i = 0; i < COUNT; ++i) \ 13 r[i] = a[i] > 20 ? b[i] & CONST : 0; \ 14 } 15 16 #define TEST_ALL(T) \ 17 T (int32_t, uint16_t, 0xff, 3) \ 18 \ 19 T (int64_t, uint16_t, 0xff, 5) \ 20 T (int64_t, uint32_t, 0xff, 5) \ 21 T (int64_t, uint32_t, 0xffff, 5) 22 23 TEST_ALL (DEF_LOOP) 24 25 /* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h\n} 2 } } */ 26 /* { dg-final { scan-assembler-times {\tuxtb\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s\n} 1 } } */ 27 /* { dg-final { scan-assembler-times {\tuxth\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s\n} 1 } } */ 28 29 /* { dg-final { scan-assembler {\tmovprfx\tz[^,]*, p[0-7]/z} } } */ 30 31 /* { dg-final { scan-assembler-not {\tmov\tz[^\n]*z} } } */ 32 /* { dg-final { scan-assembler-not {\tsel\t} } } */ 33