PATCH: Add SSE4.2 support

Uros Bizjak ubizjak@gmail.com
Wed May 23 07:20:00 GMT 2007


Hello!

> I added -msse4/-mno-sse4. -msse4 will enable both SSE4.1 and SSE4.2.
> Ideally, -mno-sse4 should disable both SSE4.1 and SSE4.2. But since
> we run out of bits in x86 option flag, I used

> msse4
> Target Report Mask(SSE4_1|MASK_SSE4_2) MaskExists


What about adding Var field fo MMX/3dNOW! and SSE options, like:

Target Report Mask(SSExxx) Var(target_mmxsse_flags)

This will produce:

#define OPTION_MASK_SSE (1 << 2)
#define OPTION_MASK_SSE2 (1 << 3)
#define OPTION_MASK_SSE3 (1 << 4)
#define OPTION_MASK_SSE4_1 (1 << 5)
#define OPTION_MASK_SSE4A (1 << 6)
#define OPTION_MASK_SSSE3 (1 << 7)

and

#define OPTION_SSE ((target_mmxsse_flags & OPTION_MASK_SSE) != 0)
#define OPTION_SSE2 ((target_mmxsse_flags & OPTION_MASK_SSE2) != 0)
#define OPTION_SSE3 ((target_mmxsse_flags & OPTION_MASK_SSE3) != 0)
#define OPTION_SSE4_1 ((target_mmxsse_flags & OPTION_MASK_SSE4_1) != 0)
#define OPTION_SSE4A ((target_mmxsse_flags & OPTION_MASK_SSE4A) != 0)
#define OPTION_SSSE3 ((target_mmxsse_flags & OPTION_MASK_SSSE3) != 0)

Ideally, all uses of TARGET_SSExxx and MASK_SSExxx should be converted
to OPTION_SSExxx and OPTION_MASK_SSExxx (a simple script would
trivially fix all these), but we could also add some defines in
i386.h:

--cut here--
/* Redefines for option macros.  */

#define TARGET_MMX	OPTION_MMX
#define TARGET_3DNOW	OPTION_3DNOW
#define TARGET_SSE	OPTION_SSE
#define TARGET_SSE2	OPTION_SSE2
#define TARGET_SSE3	OPTION_SSE3
#define TARGET_SSSE3	OPTION_SSSE3
#define TARGET_SSE4_1	OPTION_SSE4_1
#define TARGET_SSE4A	OPTION_SSE4A

#define MASK_MMX	OPTION_MASK_MMX
#define MASK_3DNOW	OPTION_MASK_3DNOW
#define MASK_SSE	OPTION_MASK_SSE
#define MASK_SSE2	OPTION_MASK_SSE2
#define MASK_SSE3	OPTION_MASK_SSE3
#define MASK_SSSE3	OPTION_MASK_SSSE3
#define MASK_SSE4_1	OPTION_MASK_SSE4_1
#define MASK_SSE4A	OPTION_MASK_SSE4A
--cut here--

The "hardest" part is to review uses of target_flags and
target_flags_explicit throughout the i386 directory and change them to
operate on target_mmxsse_flags variable and (new)
target_mmxsse_flags_explicit global variable (defined in i386.h?). As
I think that SSE won't stop at revision 4, this chage cleans path
forward.

Uros.



More information about the Gcc-patches mailing list