Bug 70738 - Add -mgeneral-regs-only option
Summary: Add -mgeneral-regs-only option
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: 7.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-20 13:33 UTC by H.J. Lu
Modified: 2016-05-25 19:04 UTC (History)
2 users (show)

See Also:
Host:
Target: x86
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-05-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2016-04-20 13:33:29 UTC
X86 Linux kernel is compiled only with integer instructions.  Currently,

-mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-80387 -mno-fp-ret-in-387  -mskip-rax-setup 

is used to compile kernel.  If we add another non-integer feature, it
has to be turned off.  We can add a -minteger-only option to disable
all non-integer features so that kernel doesn't need a long list and
the same option will work for future compilers.
Comment 1 Richard Earnshaw 2016-04-22 15:35:04 UTC
AArch64 already has a similar option already.  We've called it -mgeneral-regs-only.
Comment 2 hjl@gcc.gnu.org 2016-05-20 16:07:11 UTC
Author: hjl
Date: Fri May 20 16:06:39 2016
New Revision: 236520

URL: https://gcc.gnu.org/viewcvs?rev=236520&root=gcc&view=rev
Log:
Add -mgeneral-regs-only option

X86 Linux kernel is compiled only with integer instructions.  Currently,

-mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-80387
-mno-fp-ret-in-387  -mskip-rax-setup

is used to compile kernel.  If we add another non-integer feature, it
has to be turned off.  We can add a -mgeneral-regs-only option, similar
to AArch64, to disable all non-integer features so that kernel doesn't
need a long list and the same option will work for future compilers.
It can also be used to compile interrupt handler.

gcc/

	PR target/70738
	* common/config/i386/i386-common.c
	(OPTION_MASK_ISA_GENERAL_REGS_ONLY_UNSET): New.
	(ix86_handle_option): Disable MPX, MMX, SSE and x87 instructions
	for -mgeneral-regs-only.
	* config/i386/i386.c (ix86_option_override_internal): Don't
	enable x87 instructions if only the general registers are
	allowed.
	* config/i386/i386.opt: Add -mgeneral-regs-only.
	* doc/invoke.texi: Document -mgeneral-regs-only.

gcc/testsuite/

	PR target/70738
	* gcc.target/i386/pr70738-1.c: Likewise.
	* gcc.target/i386/pr70738-2.c: Likewise.
	* gcc.target/i386/pr70738-3.c: Likewise.
	* gcc.target/i386/pr70738-4.c: Likewise.
	* gcc.target/i386/pr70738-5.c: Likewise.
	* gcc.target/i386/pr70738-6.c: Likewise.
	* gcc.target/i386/pr70738-7.c: Likewise.
	* gcc.target/i386/pr70738-8.c: Likewise.
	* gcc.target/i386/pr70738-9.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr70738-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-2.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-3.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-4.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-5.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-6.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-7.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-8.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-9.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/common/config/i386/i386-common.c
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
Comment 3 H.J. Lu 2016-05-20 16:07:37 UTC
Fixed for 7.0.
Comment 4 uros 2016-05-22 17:20:42 UTC
Author: uros
Date: Sun May 22 17:20:10 2016
New Revision: 236570

URL: https://gcc.gnu.org/viewcvs?rev=236570&root=gcc&view=rev
Log:
Revert:

gcc/

	PR target/70738
	* common/config/i386/i386-common.c
	(OPTION_MASK_ISA_GENERAL_REGS_ONLY_UNSET): New.
	(ix86_handle_option): Disable MPX, MMX, SSE and x87 instructions
	for -mgeneral-regs-only.
	* config/i386/i386.c (ix86_option_override_internal): Don't
	enable x87 instructions if only the general registers are
	allowed.
	* config/i386/i386.opt: Add -mgeneral-regs-only.
	* doc/invoke.texi: Document -mgeneral-regs-only.

gcc/testsuite/

	PR target/70738
	* gcc.target/i386/pr70738-1.c: Likewise.
	* gcc.target/i386/pr70738-2.c: Likewise.
	* gcc.target/i386/pr70738-3.c: Likewise.
	* gcc.target/i386/pr70738-4.c: Likewise.
	* gcc.target/i386/pr70738-5.c: Likewise.
	* gcc.target/i386/pr70738-6.c: Likewise.
	* gcc.target/i386/pr70738-7.c: Likewise.
	* gcc.target/i386/pr70738-8.c: Likewise.
	* gcc.target/i386/pr70738-9.c: Likewise.


Removed:
    trunk/gcc/testsuite/gcc.target/i386/pr70738-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-2.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-3.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-4.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-5.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-6.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-7.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-8.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-9.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/common/config/i386/i386-common.c
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
Comment 6 uros 2016-05-25 18:59:21 UTC
Author: uros
Date: Wed May 25 18:58:49 2016
New Revision: 236738

URL: https://gcc.gnu.org/viewcvs?rev=236738&root=gcc&view=rev
Log:
	PR target/70738
	* common/config/i386/i386-common.c
	(OPTION_MASK_ISA_GENERAL_REGS_ONLY_UNSET): New.
	(ix86_handle_option) <case OPT_mgeneral_regs_only>: Disable
	MPX, MMX, SSE and x87 instructions for -mgeneral-regs-only.
	* config/i386/i386.opt (ix86_target_flags): Add new Variable.
	(-mgeneral-regs-only): Add new option.
	* config/i386/i386.c (ix86_option_override_internal): Don't enable
	x87 instructions if only general registers are allowed.
	(ix86_target_string): Add ix86_flags argument. Handle additional
	flags options through ix86_flags argument.  Update all callers.
	* doc/invoke.texi: Document -mgeneral-regs-only.

testsuite/ChangeLog:

	PR target/70738
	* gcc.target/i386/pr70738-1.c: New test.
	* gcc.target/i386/pr70738-2.c: Likewise.
	* gcc.target/i386/pr70738-3.c: Likewise.
	* gcc.target/i386/pr70738-4.c: Likewise.
	* gcc.target/i386/pr70738-5.c: Likewise.
	* gcc.target/i386/pr70738-6.c: Likewise.
	* gcc.target/i386/pr70738-7.c: Likewise.
	* gcc.target/i386/pr70738-8.c: Likewise.
	* gcc.target/i386/pr70738-9.c: Likewise.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr70738-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-2.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-3.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-4.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-5.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-6.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-7.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-8.c
    trunk/gcc/testsuite/gcc.target/i386/pr70738-9.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/common/config/i386/i386-common.c
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
Comment 7 Uroš Bizjak 2016-05-25 19:04:13 UTC
Reimplemented again in 7.0.

Fixed.