1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-options "-mdejagnu-cpu=power8 -mvsx -O2 -ftree-vectorize -fdump-tree-vect-details -fno-unroll-loops" } */
15 #define TYPE long long
19 #define SIGN_TYPE signed TYPE
23 #define UNS_TYPE unsigned TYPE
26 #define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
28 SIGN_TYPE sa
[SIZE
] ALIGN_ATTR
;
29 SIGN_TYPE sb
[SIZE
] ALIGN_ATTR
;
30 SIGN_TYPE sc
[SIZE
] ALIGN_ATTR
;
32 UNS_TYPE ua
[SIZE
] ALIGN_ATTR
;
33 UNS_TYPE ub
[SIZE
] ALIGN_ATTR
;
34 UNS_TYPE uc
[SIZE
] ALIGN_ATTR
;
37 sign_lt (SIGN_TYPE val1
, SIGN_TYPE val2
)
41 for (i
= 0; i
< SIZE
; i
++)
42 sa
[i
] = (sb
[i
] < sc
[i
]) ? val1
: val2
;
46 sign_lte (SIGN_TYPE val1
, SIGN_TYPE val2
)
50 for (i
= 0; i
< SIZE
; i
++)
51 sa
[i
] = (sb
[i
] <= sc
[i
]) ? val1
: val2
;
55 sign_gt (SIGN_TYPE val1
, SIGN_TYPE val2
)
59 for (i
= 0; i
< SIZE
; i
++)
60 sa
[i
] = (sb
[i
] > sc
[i
]) ? val1
: val2
;
64 sign_gte (SIGN_TYPE val1
, SIGN_TYPE val2
)
68 for (i
= 0; i
< SIZE
; i
++)
69 sa
[i
] = (sb
[i
] >= sc
[i
]) ? val1
: val2
;
74 uns_lt (UNS_TYPE val1
, UNS_TYPE val2
)
78 for (i
= 0; i
< SIZE
; i
++)
79 ua
[i
] = (ub
[i
] < uc
[i
]) ? val1
: val2
;
83 uns_lte (UNS_TYPE val1
, UNS_TYPE val2
)
87 for (i
= 0; i
< SIZE
; i
++)
88 ua
[i
] = (ub
[i
] <= uc
[i
]) ? val1
: val2
;
92 uns_gt (UNS_TYPE val1
, UNS_TYPE val2
)
96 for (i
= 0; i
< SIZE
; i
++)
97 ua
[i
] = (ub
[i
] > uc
[i
]) ? val1
: val2
;
101 uns_gte (UNS_TYPE val1
, UNS_TYPE val2
)
105 for (i
= 0; i
< SIZE
; i
++)
106 ua
[i
] = (ub
[i
] >= uc
[i
]) ? val1
: val2
;
109 /* { dg-final { scan-assembler-times {\mvcmpgtsd\M} 4 } } */
110 /* { dg-final { scan-assembler-times {\mvcmpgtud\M} 4 } } */
111 /* { dg-final { scan-assembler-not {\mvcmpequd\M} } } */
112 /* For each function, one is for the comparison statement and the other
113 is for the condition statement which consumes the compared result. */
114 /* { dg-final { scan-tree-dump-times "vect_model_simple_cost" 16 "vect" } } */