This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH], Enable _Float128 in VSX PowerPC system and enable #pragma GCC target "float128"


This patch enables the _Float128 keyword for the C langauge all of the time for
PowerPC VSX systems.  The __float128 keyword continues to be only enabled if
you use the -mfloat128 option.

A previous patch had separated the underlying support (-mfloat128-type) from
enabling the __float128 keyword (-mfloat128).  In the prevous implementation,
the compiler used -mfloat128 to enable the _Float128 keyword.  This patch uses
-mfloat128-keyword (which is typically on by default) to enable the _Float128
keyword.

In addition to enabling _Float128 keyword, this patch now allows the user to
enable or disable -mfloat128 via the target attribute or pragma.

In order to do this, I needed to change the keyword associated with the IEEE
128-bit type.  Previously if the user used -mfloat128, the keyword added was
"__float128" and a #define mapping "__ieee128" to "__float128" was used.

Now, with this patch, the keyword that is created is "__ieee128".  If the
__float128 keyword is enabled either through the -mfloat128 option or the
target pragma/attribute, the compiler will create a #define mapping
"__float128" to "__ieee128".  This way, we can easily enable or disable
__float128, just by defining or undefining the macro.

I also fixed two of the original __float128 test cases to not use the
-static-libgcc option.

I've tested this patch on big endian power7 (both 32/64-bits) and little endian
power8 (just 64-bits).  Can I commit this patch to the trunk?

[gcc]
2017-08-14  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/70589
	* config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Make the
	real keyword for IEEE 128-bit be __ieee128 for VSX runs, and define
	__float128 to be __ieee128 if -mfloat128 is used or a float128
	target attribute/pragma is used.  Enable _Float128 all of the
	time.
	(rs6000_cpu_cpp_builtins): Likewise.
	* config/rs6000/rs6000.c (rs6000_init_builtins): Likewise.
	(rs6000_floatn_mode): Likewise.
	(rs6000_opt_masks): Likewise.

[gcc/testsuite]
2017-08-14  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/70589
	* gcc.target/powerpc/float128-1.c: Eliminate using the
	-static-libgcc option.  Use -mvsx instead of -mcpu=power7 to run
	the tests.
	* gcc.target/powerpc/float128-2.c: Likewise.
	* gcc.target/powerpc/float128-3.c: Test enabling -mfloat128 via
	#pragma target.
	* gcc.target/powerpc/float128-4.c: New test, clone float128-1.c,
	using the _Float128 keyword.  Do not use the -mfloat128 option.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

Attachment: ieee128-patch20b
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]