summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2006-07-27 23:12:08 +0000
committerChristopher Faylor <cgf@gcc.gnu.org>2006-07-27 23:12:08 +0000
commitfa6adcab9d8c2ff6be87e30fb663ede9a664b9ff (patch)
tree8a8ae5d5601b225f6c7d6129e61fd25a2b15f49f /gcc/config
parentab7efd9148063d4bcb27ae72dd390b1c5fc18a58 (diff)
downloadgcc-fa6adcab9d8c2ff6be87e30fb663ede9a664b9ff.tar.gz
2006-07-27 Arjan van de Ven <arjan@linux.intel.com>
* config/i386/i386.md (stack_tls_protect_set_di) Use %gs rather than %fs for -mcmodel=kernel. (stack_tls_protect_test_di): Likewise. * testsuite/gcc.target/i386/stack-prot-kernel.c: New test. From-SVN: r115782
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/i386.md20
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 00e06ba7e77..4808853e655 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -20393,7 +20393,15 @@
(set (match_scratch:DI 2 "=&r") (const_int 0))
(clobber (reg:CC FLAGS_REG))]
"TARGET_64BIT"
- "mov{q}\t{%%fs:%P1, %2|%2, QWORD PTR %%fs:%P1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"
+ {
+ /* The kernel uses a different segment register for performance reasons; a
+ system call would not have to trash the userspace segment register,
+ which would be expensive */
+ if (ix86_cmodel != CM_KERNEL)
+ return "mov{q}\t{%%fs:%P1, %2|%2, QWORD PTR %%fs:%P1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2";
+ else
+ return "mov{q}\t{%%gs:%P1, %2|%2, QWORD PTR %%gs:%P1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2";
+ }
[(set_attr "type" "multi")])
(define_expand "stack_protect_test"
@@ -20461,7 +20469,15 @@
UNSPEC_SP_TLS_TEST))
(clobber (match_scratch:DI 3 "=r"))]
"TARGET_64BIT"
- "mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%%fs:%P2, %3|%3, QWORD PTR %%fs:%P2}"
+ {
+ /* The kernel uses a different segment register for performance reasons; a
+ system call would not have to trash the userspace segment register,
+ which would be expensive */
+ if (ix86_cmodel != CM_KERNEL)
+ return "mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%%fs:%P2, %3|%3, QWORD PTR %%fs:%P2}";
+ else
+ return "mov{q}\t{%1, %3|%3, %1}\;xor{q}\t{%%gs:%P2, %3|%3, QWORD PTR %%gs:%P2}";
+ }
[(set_attr "type" "multi")])
(include "sse.md")