Hello!

Currently gcc fails to compile following test from the testsuite [1]:

FAIL: gcc.target/i386/pr53249.c (test for excess errors)

We are trying to compile X32 specific test, but the special pattern
that was introduced to handle certain sun assembler limitation, is not
prepared to handle X32.

The patch avoids this special pattern for X32 target. X32 is currently
supported only with gnu tools, and if/when sun tools will support X32
target, they will certainly fix the limitation which allows TP loads
to AX register only.

2012-05-24  Uros Bizjak  <ubiz...@gmail.com>

        * config/i386/i386.c (legitimize_tls_address) <TLS_MODEL_INITIAL_EXEC>:
        Generate tls_initial_exec_64_sun insn only when !TARGET_X32.

Patch was tested by looking at the assembler of the failing test:

gomp_end_task:
.LFB0:
        movl    %fs:0, %edx
        movq    gomp_tls_data@gottpoff(%rip), %rax
        movl    4(%rdx,%rax), %ecx
        movl    (%ecx), %ecx
        movl    %ecx, 4(%edx,%eax)
        ret

OK for mainline?

[1] http://gcc.gnu.org/ml/gcc-testresults/2012-05/msg02028.html

Uros.
Index: i386.c
===================================================================
--- i386.c      (revision 187841)
+++ i386.c      (working copy)
@@ -12811,13 +12811,13 @@ legitimize_tls_address (rtx x, enum tls_model mode
     case TLS_MODEL_INITIAL_EXEC:
       if (TARGET_64BIT)
        {
-         if (TARGET_SUN_TLS)
+         if (TARGET_SUN_TLS && !TARGET_X32)
            {
              /* The Sun linker took the AMD64 TLS spec literally
                 and can only handle %rax as destination of the
                 initial executable code sequence.  */
 
-             dest = gen_reg_rtx (Pmode);
+             dest = gen_reg_rtx (DImode);
              emit_insn (gen_tls_initial_exec_64_sun (dest, x));
              return dest;
            }

Reply via email to