This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa-lno] vectorizer patch.
On Fri, Jan 02, 2004 at 04:48:36PM -0500, Daniel Berlin wrote:
>
> On Jan 2, 2004, at 4:40 PM, Richard Henderson wrote:
>
> >On Fri, Jan 02, 2004 at 04:34:06PM -0500, Daniel Berlin wrote:
> >>Well, the vectorizer uses it...
> >
> >That's not the point. At no point does the target need to be involved
> >in the creation or selection of a vector type node.
>
> I agree, personally, i was just pointing out that it may be the cause
> of your problem with sse2.
>
>
FYI, I've bootstrapped the following patch, but it does not solve the
problem when compiling with -msse2
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.425.2.39
diff -d -u -p -r1.425.2.39 i386.c
--- i386.c 25 Nov 2003 02:10:20 -0000 1.425.2.39
+++ i386.c 2 Jan 2004 15:43:45 -0000
@@ -880,6 +880,7 @@ static int extended_reg_mentioned_1 (rtx
static bool ix86_rtx_costs (rtx, int, int, int *);
static int min_insn_size (rtx);
static void k8_avoid_jump_misspredicts (void);
+static tree x86_vectype_for_scalar_type (tree);
#if defined (DO_GLOBAL_CTORS_BODY) && defined (HAS_INIT_SECTION)
static void ix86_svr3_asm_out_constructor (rtx, int);
@@ -940,6 +941,9 @@ static void init_ext_80387_constants (vo
#undef TARGET_EXPAND_BUILTIN
#define TARGET_EXPAND_BUILTIN ix86_expand_builtin
+#undef TARGET_VECTYPE_FOR_SCALAR_TYPE
+#define TARGET_VECTYPE_FOR_SCALAR_TYPE x86_vectype_for_scalar_type
+
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE ix86_output_function_epilogue
@@ -13017,6 +13021,52 @@ ix86_init_builtins (void)
{
if (TARGET_MMX)
ix86_init_mmx_sse_builtins ();
+}
+
+/* Given a type of a scalar tree operation, return the type of the
+ corresponding vector operation. */
+
+tree
+x86_vectype_for_scalar_type (tree tree_type)
+{
+ bool is_unsigned = TREE_UNSIGNED (tree_type);
+
+ if (TARGET_SSE)
+ {
+ if (is_unsigned)
+ {
+ switch (TYPE_MODE (tree_type))
+ {
+ case SImode:
+ return unsigned_V4SI_type_node;
+ case HImode:
+ return unsigned_V8HI_type_node;
+ case QImode:
+ return unsigned_V16QI_type_node;
+ default:
+ return NULL_TREE;
+ }
+ }
+
+ else
+ {
+ switch (TYPE_MODE (tree_type))
+ {
+ case SFmode:
+ return V4SF_type_node;
+ case SImode:
+ return V4SI_type_node;
+ case HImode:
+ return V8HI_type_node;
+ case QImode:
+ return V16QI_type_node;
+ default:
+ return NULL_TREE;
+ }
+ }
+ }
+
+ return NULL_TREE;
}
/* Set up all the MMX/SSE builtins. This is not called if TARGET_MMX
Index: i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.274.2.30
diff -d -u -p -r1.274.2.30 i386.h
--- i386.h 1 Dec 2003 19:38:53 -0000 1.274.2.30
+++ i386.h 2 Jan 2004 15:43:47 -0000
@@ -1069,6 +1069,9 @@ do { \
: VALID_MMX_REG_MODE (MODE) && TARGET_MMX ? 1 \
: VALID_MMX_REG_MODE_3DNOW (MODE) && TARGET_3DNOW ? 1 : 0)
+#define UNITS_PER_SIMD_WORD \
+ (TARGET_SSE ? 16 : 0)
+
#define VALID_FP_MODE_P(MODE) \
((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \
|| (MODE) == SCmode || (MODE) == DCmode || (MODE) == XCmode) \