mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-31 15:11:04 +08:00
tree-vect-stmts.c (vectorizable_conversion): Rewritten to handle not just FLOAT_EXPR and FIX_TRUNC_EXPR...
* tree-vect-stmts.c (vectorizable_conversion): Rewritten to handle not just FLOAT_EXPR and FIX_TRUNC_EXPR, but also CONVERT_EXPR_CODE_P, WIDEN_MULT_EXPR and WIDEN_LSHIFT_EXPR to handle what vectorizable_type_demotion and vectorizable_type_promotion did. Additionally handle FLOAT_EXPR and FIX_TRUNC_EXPR where the integer is {,un}signed {char,short}. (vect_create_vectorized_demotion_stmts): Fix comment typo. For recursive calls unconditionally use VEC_PACK_TRUNC_EXPR. Push vec_dest back to the vec_dsts vector at the end. (vect_create_vectorized_promotion_stmts): Don't recurse, do just one step. Removed multi_step_cvt, vec_dsts, slp_node and prev_stmt_info arguments, add vec_dest argument. Push always into vec_tmp, not just when multi_step_cvt != 0, replace *vec_oprdn0 with vec_tmp at the end after freeing old *vec_oprnd0 vector. (vectorizable_type_demotion, vectorizable_type_promotion): Removed. (vect_analyze_stmt): Don't call vectorizable_type_demotion and vectorizable_type_promotion. Call vectorizable_conversion even for SLP bb vectorization. (vect_transform_stmt): Call vectorizable_conversion instead of vectorizable_type_demotion and vectorizable_type_promotion. (supportable_widening_operation): Clear *multi_step_cvt first, simplify c1/c2 computation, free *interm_types vector on failure. (supportable_narrowing_operation): Clear *multi_step_cvt first, free *interm_types vector on failure, handle multi-step FIX_TRUNC_EXPR. * gcc.dg/torture/vec-cvt-1.c: New test. From-SVN: r180932
This commit is contained in:
parent
25ec1790d7
commit
4a00c76146
@ -1,3 +1,31 @@
|
||||
2011-11-04 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* tree-vect-stmts.c (vectorizable_conversion): Rewritten to handle
|
||||
not just FLOAT_EXPR and FIX_TRUNC_EXPR, but also CONVERT_EXPR_CODE_P,
|
||||
WIDEN_MULT_EXPR and WIDEN_LSHIFT_EXPR to handle what
|
||||
vectorizable_type_demotion and vectorizable_type_promotion did.
|
||||
Additionally handle FLOAT_EXPR and FIX_TRUNC_EXPR where the integer
|
||||
is {,un}signed {char,short}.
|
||||
(vect_create_vectorized_demotion_stmts): Fix comment typo. For
|
||||
recursive calls unconditionally use VEC_PACK_TRUNC_EXPR.
|
||||
Push vec_dest back to the vec_dsts vector at the end.
|
||||
(vect_create_vectorized_promotion_stmts): Don't recurse, do just
|
||||
one step. Removed multi_step_cvt, vec_dsts, slp_node and
|
||||
prev_stmt_info arguments, add vec_dest argument. Push always
|
||||
into vec_tmp, not just when multi_step_cvt != 0, replace *vec_oprdn0
|
||||
with vec_tmp at the end after freeing old *vec_oprnd0 vector.
|
||||
(vectorizable_type_demotion, vectorizable_type_promotion): Removed.
|
||||
(vect_analyze_stmt): Don't call vectorizable_type_demotion and
|
||||
vectorizable_type_promotion. Call vectorizable_conversion even
|
||||
for SLP bb vectorization.
|
||||
(vect_transform_stmt): Call vectorizable_conversion instead of
|
||||
vectorizable_type_demotion and vectorizable_type_promotion.
|
||||
(supportable_widening_operation): Clear *multi_step_cvt first,
|
||||
simplify c1/c2 computation, free *interm_types vector on failure.
|
||||
(supportable_narrowing_operation): Clear *multi_step_cvt first,
|
||||
free *interm_types vector on failure, handle multi-step
|
||||
FIX_TRUNC_EXPR.
|
||||
|
||||
2011-11-04 Tristan Gingold <gingold@adacore.com>
|
||||
|
||||
* config/alpha/alpha.c (alpha_write_linkage): Remove fundecl
|
||||
|
@ -1,3 +1,7 @@
|
||||
2011-11-04 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* gcc.dg/torture/vec-cvt-1.c: New test.
|
||||
|
||||
2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/specs/private1[-sub].ads: New test.
|
||||
|
211
gcc/testsuite/gcc.dg/torture/vec-cvt-1.c
Normal file
211
gcc/testsuite/gcc.dg/torture/vec-cvt-1.c
Normal file
@ -0,0 +1,211 @@
|
||||
/* { dg-do run } */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define N 1024
|
||||
signed char sc[N];
|
||||
short ss[N];
|
||||
int si[N];
|
||||
long long sl[N];
|
||||
unsigned char uc[N];
|
||||
unsigned short us[N];
|
||||
unsigned int ui[N];
|
||||
unsigned long long ul[N];
|
||||
float f[N];
|
||||
double d[N];
|
||||
|
||||
#define FN1(from, to) \
|
||||
__attribute__((noinline, noclone)) void \
|
||||
from##2##to (void) \
|
||||
{ \
|
||||
int i; \
|
||||
for (i = 0; i < N; i++) \
|
||||
to[i] = from[i]; \
|
||||
}
|
||||
#define FN(intt, fltt) FN1 (intt, fltt) FN1 (fltt, intt)
|
||||
|
||||
FN (sc, f)
|
||||
FN (ss, f)
|
||||
FN (si, f)
|
||||
FN (sl, f)
|
||||
FN (uc, f)
|
||||
FN (us, f)
|
||||
FN (ui, f)
|
||||
FN (ul, f)
|
||||
FN (sc, d)
|
||||
FN (ss, d)
|
||||
FN (si, d)
|
||||
FN (sl, d)
|
||||
FN (uc, d)
|
||||
FN (us, d)
|
||||
FN (ui, d)
|
||||
FN (ul, d)
|
||||
|
||||
#define FLTTEST(min, max, intt) \
|
||||
__attribute__((noinline, noclone)) void \
|
||||
flttointtest##intt (void) \
|
||||
{ \
|
||||
int i; \
|
||||
volatile float fltmin, fltmax, vf, vf2; \
|
||||
volatile double dblmin, dblmax, vd, vd2; \
|
||||
if (min == 0) \
|
||||
fltmin = 0.0f; \
|
||||
else \
|
||||
{ \
|
||||
vf2 = fltmin = min - 1.0f; \
|
||||
for (vf = 1.0f; (fltmin = vf2 + vf) == vf2; vf = vf * 2.0f) \
|
||||
; \
|
||||
} \
|
||||
vf2 = fltmax = max + 1.0f; \
|
||||
for (vf = 1.0f; (fltmax = vf2 - vf) == vf2; vf = vf * 2.0f) \
|
||||
; \
|
||||
if (min == 0) \
|
||||
dblmin = 0.0; \
|
||||
else \
|
||||
{ \
|
||||
vd2 = dblmin = min - 1.0; \
|
||||
for (vd = 1.0; (dblmin = vd2 + vd) == vd2; vd = vd * 2.0) \
|
||||
; \
|
||||
} \
|
||||
vd2 = dblmax = max + 1.0; \
|
||||
for (vd = 1.0; (dblmax = vd2 - vd) == vd2; vd = vd * 2.0) \
|
||||
; \
|
||||
for (i = 0; i < N; i++) \
|
||||
{ \
|
||||
asm (""); \
|
||||
if (i == 0) \
|
||||
f[i] = fltmin; \
|
||||
else if (i < N / 4) \
|
||||
f[i] = fltmin + i + 0.25f; \
|
||||
else if (i < 3 * N / 4) \
|
||||
f[i] = (fltmax + fltmin) / 2.0 - N * 8 + 16.0f * i; \
|
||||
else \
|
||||
f[i] = fltmax - N + 1 + i; \
|
||||
if (f[i] < fltmin) f[i] = fltmin; \
|
||||
if (f[i] > fltmax) f[i] = fltmax; \
|
||||
if (i == 0) \
|
||||
d[i] = dblmin; \
|
||||
else if (i < N / 4) \
|
||||
d[i] = dblmin + i + 0.25f; \
|
||||
else if (i < 3 * N / 4) \
|
||||
d[i] = (dblmax + dblmin) / 2.0 - N * 8 + 16.0f * i; \
|
||||
else \
|
||||
d[i] = dblmax - N + 1 + i; \
|
||||
if (d[i] < dblmin) d[i] = dblmin; \
|
||||
if (d[i] > dblmax) d[i] = dblmax; \
|
||||
} \
|
||||
f2##intt (); \
|
||||
for (i = 0; i < N; i++) \
|
||||
if (intt[i] != (__typeof (intt[0])) f[i]) \
|
||||
abort (); \
|
||||
d2##intt (); \
|
||||
for (i = 0; i < N; i++) \
|
||||
if (intt[i] != (__typeof (intt[0])) d[i]) \
|
||||
abort (); \
|
||||
for (i = 0; i < N; i++) \
|
||||
{ \
|
||||
unsigned long long r = random (); \
|
||||
r = (r << 21) ^ (unsigned) random (); \
|
||||
r = (r << 21) ^ (unsigned) random (); \
|
||||
asm (""); \
|
||||
f[i] = (r >> 59) / 32.0f + (__typeof (intt[0])) r; \
|
||||
if (f[i] < fltmin) f[i] = fltmin; \
|
||||
if (f[i] > fltmax) f[i] = fltmax; \
|
||||
d[i] = (r >> 59) / 32.0 + (__typeof (intt[0])) r; \
|
||||
if (d[i] < dblmin) f[i] = dblmin; \
|
||||
if (d[i] > dblmax) f[i] = dblmax; \
|
||||
} \
|
||||
f2##intt (); \
|
||||
for (i = 0; i < N; i++) \
|
||||
if (intt[i] != (__typeof (intt[0])) f[i]) \
|
||||
abort (); \
|
||||
d2##intt (); \
|
||||
for (i = 0; i < N; i++) \
|
||||
if (intt[i] != (__typeof (intt[0])) d[i]) \
|
||||
abort (); \
|
||||
} \
|
||||
\
|
||||
__attribute__((noinline, noclone)) void \
|
||||
inttoflttest##intt (void) \
|
||||
{ \
|
||||
int i; \
|
||||
volatile float vf; \
|
||||
volatile double vd; \
|
||||
for (i = 0; i < N; i++) \
|
||||
{ \
|
||||
asm (""); \
|
||||
if (i < N / 4) \
|
||||
intt[i] = min + i; \
|
||||
else if (i < 3 * N / 4) \
|
||||
intt[i] = (max + min) / 2 - N * 8 + 16 * i; \
|
||||
else \
|
||||
intt[i] = max - N + 1 + i; \
|
||||
} \
|
||||
intt##2f (); \
|
||||
for (i = 0; i < N; i++) \
|
||||
{ \
|
||||
vf = intt[i]; \
|
||||
if (f[i] != vf) \
|
||||
abort (); \
|
||||
} \
|
||||
intt##2d (); \
|
||||
for (i = 0; i < N; i++) \
|
||||
{ \
|
||||
vd = intt[i]; \
|
||||
if (d[i] != vd) \
|
||||
abort (); \
|
||||
} \
|
||||
for (i = 0; i < N; i++) \
|
||||
{ \
|
||||
unsigned long long r = random (); \
|
||||
r = (r << 21) ^ (unsigned) random (); \
|
||||
r = (r << 21) ^ (unsigned) random (); \
|
||||
asm (""); \
|
||||
intt[i] = r; \
|
||||
} \
|
||||
intt##2f (); \
|
||||
for (i = 0; i < N; i++) \
|
||||
{ \
|
||||
vf = intt[i]; \
|
||||
if (f[i] != vf) \
|
||||
abort (); \
|
||||
} \
|
||||
intt##2d (); \
|
||||
for (i = 0; i < N; i++) \
|
||||
{ \
|
||||
vd = intt[i]; \
|
||||
if (d[i] != vd) \
|
||||
abort (); \
|
||||
} \
|
||||
}
|
||||
|
||||
FLTTEST (- __SCHAR_MAX__ - 1, __SCHAR_MAX__, sc)
|
||||
FLTTEST (- __SHRT_MAX__ - 1, __SHRT_MAX__, ss)
|
||||
FLTTEST (- __INT_MAX__ - 1, __INT_MAX__, si)
|
||||
FLTTEST (- __LONG_LONG_MAX__ - 1LL, __LONG_LONG_MAX__, sl)
|
||||
FLTTEST (0, 2U * __SCHAR_MAX__ + 1, uc)
|
||||
FLTTEST (0, 2U * __SHRT_MAX__ + 1, us)
|
||||
FLTTEST (0, 2U * __INT_MAX__ + 1, ui)
|
||||
FLTTEST (0, 2ULL * __LONG_LONG_MAX__ + 1, ul)
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
flttointtestsc ();
|
||||
flttointtestss ();
|
||||
flttointtestsi ();
|
||||
flttointtestsl ();
|
||||
flttointtestuc ();
|
||||
flttointtestus ();
|
||||
// flttointtestui ();
|
||||
flttointtestul ();
|
||||
inttoflttestsc ();
|
||||
inttoflttestss ();
|
||||
inttoflttestsi ();
|
||||
inttoflttestsl ();
|
||||
inttoflttestuc ();
|
||||
inttoflttestus ();
|
||||
// inttoflttestui ();
|
||||
inttoflttestul ();
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user