* config/i386/i386.c (TARGET_VECTORIZE_BUILTIN_CONVERSION): Define.
(ix86_builtin_conversion): New function.
testsuite/ChangeLog:
* gcc.dg/vect/vect-intfloat-conversion-1.c: Loop gets vectorized
on i?86 and x86_64.
* gcc.dg/vect/vect-intfloat-conversion-2.c: Ditto.
* gcc.dg/vect/vect-floatint-conversion-1.c: New.
* gcc.dg/vect/vect-93.c: Another loop gets vectorized
on i?86 and x86_64.
* gcc.dg/vect/vect-113.c: Ditto.
From-SVN: r121820
+2007-02-11 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (TARGET_VECTORIZE_BUILTIN_CONVERSION): Define.
+ (ix86_builtin_conversion): New function.
+
2007-02-06 Mark Mitchell <mark@codesourcery.com>
PR target/29487
static void ix86_init_builtins (void);
static rtx ix86_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
static tree ix86_builtin_vectorized_function (enum built_in_function, tree, tree);
+static tree ix86_builtin_conversion (enum tree_code, tree);
static const char *ix86_mangle_fundamental_type (tree);
static tree ix86_stack_protect_fail (void);
static rtx ix86_internal_arg_pointer (void);
#define TARGET_INIT_BUILTINS ix86_init_builtins
#undef TARGET_EXPAND_BUILTIN
#define TARGET_EXPAND_BUILTIN ix86_expand_builtin
+
#undef TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION
#define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION ix86_builtin_vectorized_function
+#undef TARGET_VECTORIZE_BUILTIN_CONVERSION
+#define TARGET_VECTORIZE_BUILTIN_CONVERSION ix86_builtin_conversion
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE ix86_output_function_epilogue
return NULL_TREE;
}
+/* Returns a decl of a function that implements conversion of the
+ input vector of type TYPE, or NULL_TREE if it is not available. */
+
+static tree
+ix86_builtin_conversion (enum tree_code code, tree type)
+{
+ if (TREE_CODE (type) != VECTOR_TYPE)
+ return NULL_TREE;
+
+ switch (code)
+ {
+ case FLOAT_EXPR:
+ switch (TYPE_MODE (type))
+ {
+ case V4SImode:
+ return ix86_builtins[IX86_BUILTIN_CVTDQ2PS];
+ default:
+ return NULL_TREE;
+ }
+
+ case FIX_TRUNC_EXPR:
+ switch (TYPE_MODE (type))
+ {
+ case V4SFmode:
+ return ix86_builtins[IX86_BUILTIN_CVTTPS2DQ];
+ default:
+ return NULL_TREE;
+ }
+ default:
+ return NULL_TREE;
+
+ }
+}
+
/* Store OPERAND to the memory after reload is completed. This means
that we can't easily use assign_stack_local. */
rtx
+2007-02-11 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.dg/vect/vect-intfloat-conversion-1.c: Loop gets vectorized
+ on i?86 and x86_64.
+ * gcc.dg/vect/vect-intfloat-conversion-2.c: Ditto.
+ * gcc.dg/vect/vect-floatint-conversion-1.c: New.
+ * gcc.dg/vect/vect-93.c: Another loop gets vectorized
+ on i?86 and x86_64.
+ * gcc.dg/vect/vect-113.c: Ditto.
+
2007-02-06 Mark Mitchell <mark@codesourcery.com>
PR c++/29487
2007-02-11 Tehila Meyzels <tehila@il.ibm.com>
Dorit Nuzman <dorit@il.ibm.com>
- * gcc.dg/vect/vect-intfloat-conversion.c-1: New test.
- * gcc.dg/vect/vect-intfloat-conversion.c-2: New test.
- * gcc.dg/vect/vect-93.c: Another loop gets vectorized on powerpc.
+ * gcc.dg/vect/vect-intfloat-conversion-1.c: New test.
+ * gcc.dg/vect/vect-intfloat-conversion-1.c: New test.
+ * gcc.dg/vect/vect-93.c: Another loop gets vectorized on powerpc.
* gcc.dg/vect/vect-113.c: Likewise.
* gcc.dg/vect/vect-iv-11.c: A loop gets vectorized.
return main1 ();
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target powerpc*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* 2 loops vectorized in main1, 2 loops vectorized in main:
the first loop in main requires vectorization of conversions,
- the second loop in main requires vectorization of misaliged load: */
+ the second loop in main requires vectorization of misaliged load. */
/* main && main1 together: */
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" { target powerpc*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target vect_no_align } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" { xfail vect_no_align } } } */
/* in main1: */
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target {! powerpc*-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target !powerpc*-*-* !i?86-*-* !x86_64-*-* } } } */
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target vect_no_align } } } */
/* in main: */
--- /dev/null
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 32
+
+int
+main1 ()
+{
+ int i;
+ float fb[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5};
+ int ia[N];
+
+ /* float -> int */
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = (int) fb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != (int) fb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int
+main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target i?86-*-* x86_64-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
--- /dev/null
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 32
+
+int main1 ()
+{
+ int i;
+ int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ float fa[N];
+
+ /* int -> float */
+ for (i = 0; i < N; i++)
+ {
+ fa[i] = (float) ib[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (fa[i] != (float) ib[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
--- /dev/null
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 32
+
+int main1 ()
+{
+ int i;
+ int int_arr[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ float float_arr[N];
+ char char_arr[N];
+
+ for (i = 0; i < N; i++){
+ float_arr[i] = (float) int_arr[i];
+ char_arr[i] = 0;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (float_arr[i] != (float) int_arr[i])
+ abort ();
+ if (char_arr[i] != 0)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */