* [trans-mem] Use __x86_64__ instead of __LP64__.
@ 2011-08-22 9:57 Torvald Riegel
2011-08-22 14:12 ` H.J. Lu
2011-08-23 7:08 ` Richard Henderson
0 siblings, 2 replies; 6+ messages in thread
From: Torvald Riegel @ 2011-08-22 9:57 UTC (permalink / raw)
To: GCC Patches; +Cc: H.J. Lu, Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 227 bytes --]
Use __x86_64__ instead of __LP64__ in setjmp/longjmp and TLS
definitions.
H.J.: Is that sufficient for x32, or do we need entirely different code?
If so, can you please provide the required changes?
Otherwise, OK for branch?
[-- Attachment #2: patch1 --]
[-- Type: text/plain, Size: 1476 bytes --]
commit 5337bae3f70d53e463d09e8d6806826876b0da8a
Author: Torvald Riegel <triegel@redhat.com>
Date: Mon Aug 22 11:21:03 2011 +0200
Use __x86_64__ instead of __LP64__.
* config/x86/tls.h: Use __x86_64__ instead of __LP64__.
* config/x86/sjlj.S: Same.
diff --git a/libitm/config/x86/sjlj.S b/libitm/config/x86/sjlj.S
index 0e9c246..725ffec 100644
--- a/libitm/config/x86/sjlj.S
+++ b/libitm/config/x86/sjlj.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU Transactional Memory Library (libitm).
@@ -29,7 +29,7 @@
_ITM_beginTransaction:
.cfi_startproc
-#ifdef __LP64__
+#ifdef __x86_64__
leaq 8(%rsp), %rax
movq (%rsp), %r8
subq $72, %rsp
@@ -72,7 +72,7 @@ _ITM_beginTransaction:
GTM_longjmp:
.cfi_startproc
-#ifdef __LP64__
+#ifdef __x86_64__
movq (%rdi), %rcx
movq 8(%rdi), %rdx
movq 16(%rdi), %rbx
diff --git a/libitm/config/x86/tls.h b/libitm/config/x86/tls.h
index 03fdab2..ca644f4 100644
--- a/libitm/config/x86/tls.h
+++ b/libitm/config/x86/tls.h
@@ -37,7 +37,7 @@
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
namespace GTM HIDDEN {
-#ifdef __LP64__
+#ifdef __x86_64__
# define SEG_READ(OFS) "movq\t%%fs:(" #OFS "*8),%0"
# define SEG_WRITE(OFS) "movq\t%0,%%fs:(" #OFS "*8)"
# define SEG_DECODE_READ(OFS) SEG_READ(OFS) "\n\t" \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [trans-mem] Use __x86_64__ instead of __LP64__.
2011-08-22 9:57 [trans-mem] Use __x86_64__ instead of __LP64__ Torvald Riegel
@ 2011-08-22 14:12 ` H.J. Lu
2011-08-23 15:19 ` H.J. Lu
2011-08-23 7:08 ` Richard Henderson
1 sibling, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2011-08-22 14:12 UTC (permalink / raw)
To: Torvald Riegel; +Cc: GCC Patches, Richard Henderson
On Mon, Aug 22, 2011 at 2:42 AM, Torvald Riegel <triegel@redhat.com> wrote:
> Use __x86_64__ instead of __LP64__ in setjmp/longjmp and TLS
> definitions.
>
> H.J.: Is that sufficient for x32, or do we need entirely different code?
> If so, can you please provide the required changes?
>
I need to take a look.
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [trans-mem] Use __x86_64__ instead of __LP64__.
2011-08-22 9:57 [trans-mem] Use __x86_64__ instead of __LP64__ Torvald Riegel
2011-08-22 14:12 ` H.J. Lu
@ 2011-08-23 7:08 ` Richard Henderson
2011-08-23 14:37 ` Torvald Riegel
1 sibling, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2011-08-23 7:08 UTC (permalink / raw)
To: Torvald Riegel; +Cc: GCC Patches, H.J. Lu
On 08/22/2011 02:42 AM, Torvald Riegel wrote:
> Use __x86_64__ instead of __LP64__ in setjmp/longjmp and TLS
> definitions.
>
> H.J.: Is that sufficient for x32, or do we need entirely different code?
> If so, can you please provide the required changes?
The SJLJ part should be ok for x32.
The TLS part needs to use a 32-bit load and "*4".
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [trans-mem] Use __x86_64__ instead of __LP64__.
2011-08-23 7:08 ` Richard Henderson
@ 2011-08-23 14:37 ` Torvald Riegel
2011-08-23 18:08 ` Richard Henderson
0 siblings, 1 reply; 6+ messages in thread
From: Torvald Riegel @ 2011-08-23 14:37 UTC (permalink / raw)
To: Richard Henderson; +Cc: GCC Patches, H.J. Lu
[-- Attachment #1: Type: text/plain, Size: 488 bytes --]
On Mon, 2011-08-22 at 14:42 -0700, Richard Henderson wrote:
> On 08/22/2011 02:42 AM, Torvald Riegel wrote:
> > Use __x86_64__ instead of __LP64__ in setjmp/longjmp and TLS
> > definitions.
> >
> > H.J.: Is that sufficient for x32, or do we need entirely different code?
> > If so, can you please provide the required changes?
>
> The SJLJ part should be ok for x32.
>
> The TLS part needs to use a 32-bit load and "*4".
Hmm, like in the attached patch? (I'm just guessing here ...!)
[-- Attachment #2: patch1 --]
[-- Type: text/plain, Size: 2173 bytes --]
commit 3f10f6882e8dd19ca0f11a0f9d953aebe6027ead
Author: Torvald Riegel <triegel@redhat.com>
Date: Mon Aug 22 11:21:03 2011 +0200
Use __x86_64__ instead of __LP64__.
* config/x86/tls.h: Use __x86_64__ instead of __LP64__.
Add X32 support.
* config/x86/sjlj.S: Same.
diff --git a/libitm/config/x86/sjlj.S b/libitm/config/x86/sjlj.S
index 0e9c246..725ffec 100644
--- a/libitm/config/x86/sjlj.S
+++ b/libitm/config/x86/sjlj.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU Transactional Memory Library (libitm).
@@ -29,7 +29,7 @@
_ITM_beginTransaction:
.cfi_startproc
-#ifdef __LP64__
+#ifdef __x86_64__
leaq 8(%rsp), %rax
movq (%rsp), %r8
subq $72, %rsp
@@ -72,7 +72,7 @@ _ITM_beginTransaction:
GTM_longjmp:
.cfi_startproc
-#ifdef __LP64__
+#ifdef __x86_64__
movq (%rdi), %rcx
movq 8(%rdi), %rdx
movq 16(%rdi), %rbx
diff --git a/libitm/config/x86/tls.h b/libitm/config/x86/tls.h
index 03fdab2..3d247e3 100644
--- a/libitm/config/x86/tls.h
+++ b/libitm/config/x86/tls.h
@@ -37,6 +37,7 @@
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
namespace GTM HIDDEN {
+#ifdef __x86_64__
#ifdef __LP64__
# define SEG_READ(OFS) "movq\t%%fs:(" #OFS "*8),%0"
# define SEG_WRITE(OFS) "movq\t%0,%%fs:(" #OFS "*8)"
@@ -47,6 +48,17 @@ namespace GTM HIDDEN {
"rolq\t$17,%0\n\t" \
SEG_WRITE(OFS)
#else
+// For X32.
+# define SEG_READ(OFS) "movl\t%%fs:(" #OFS "*4),%0"
+# define SEG_WRITE(OFS) "movl\t%0,%%fs:(" #OFS "*4)"
+# define SEG_DECODE_READ(OFS) SEG_READ(OFS) "\n\t" \
+ "rorl\t$9,%0\n\t" \
+ "xorl\t%%fs:24,%0"
+# define SEG_ENCODE_WRITE(OFS) "xorl\t%%fs:24,%0\n\t" \
+ "roll\t$9,%0\n\t" \
+ SEG_WRITE(OFS)
+#endif
+#else
# define SEG_READ(OFS) "movl\t%%gs:(" #OFS "*4),%0"
# define SEG_WRITE(OFS) "movl\t%0,%%gs:(" #OFS "*4)"
# define SEG_DECODE_READ(OFS) SEG_READ(OFS) "\n\t" \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [trans-mem] Use __x86_64__ instead of __LP64__.
2011-08-22 14:12 ` H.J. Lu
@ 2011-08-23 15:19 ` H.J. Lu
0 siblings, 0 replies; 6+ messages in thread
From: H.J. Lu @ 2011-08-23 15:19 UTC (permalink / raw)
To: Torvald Riegel; +Cc: GCC Patches, Richard Henderson
On Mon, Aug 22, 2011 at 6:44 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Aug 22, 2011 at 2:42 AM, Torvald Riegel <triegel@redhat.com> wrote:
>> Use __x86_64__ instead of __LP64__ in setjmp/longjmp and TLS
>> definitions.
>>
>> H.J.: Is that sufficient for x32, or do we need entirely different code?
>> If so, can you please provide the required changes?
>>
>
> I need to take a look.
>
transactional-memory is from 2010-04-13 and doesn't support x32
at all.
--
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [trans-mem] Use __x86_64__ instead of __LP64__.
2011-08-23 14:37 ` Torvald Riegel
@ 2011-08-23 18:08 ` Richard Henderson
0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2011-08-23 18:08 UTC (permalink / raw)
To: Torvald Riegel; +Cc: GCC Patches, H.J. Lu
On 08/23/2011 05:33 AM, Torvald Riegel wrote:
> Use __x86_64__ instead of __LP64__.
>
> * config/x86/tls.h: Use __x86_64__ instead of __LP64__.
> Add X32 support.
> * config/x86/sjlj.S: Same.
Ok.
At some point we really should merge from mainline, so that we
can test this properly...
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-08-23 17:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22 9:57 [trans-mem] Use __x86_64__ instead of __LP64__ Torvald Riegel
2011-08-22 14:12 ` H.J. Lu
2011-08-23 15:19 ` H.J. Lu
2011-08-23 7:08 ` Richard Henderson
2011-08-23 14:37 ` Torvald Riegel
2011-08-23 18:08 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).