diff -Nrcpad gcc-13-20250710/LAST_UPDATED gcc-13-20250717/LAST_UPDATED
*** gcc-13-20250710/LAST_UPDATED	Thu Jul 10 22:33:12 2025
--- gcc-13-20250717/LAST_UPDATED	Thu Jul 17 22:32:57 2025
***************
*** 1 ****
! Obtained from git: releases/gcc-13 revision 8e746cc4666f1471dcb28a65a233c9a519edf913
--- 1 ----
! Obtained from git: releases/gcc-13 revision 7e6a220b18df8ef13dde7c19407f4341ff16f091
diff -Nrcpad gcc-13-20250710/MD5SUMS gcc-13-20250717/MD5SUMS
*** gcc-13-20250710/MD5SUMS	Thu Jul 10 22:33:15 2025
--- gcc-13-20250717/MD5SUMS	Thu Jul 17 22:33:03 2025
***************
*** 1,5 ****
  # This file contains the MD5 checksums of the files in the
! # gcc-13-20250710.tar.xz tarball.
  #
  # Besides verifying that all files in the tarball were correctly expanded,
  # it also can be used to determine if any files have changed since the
--- 1,5 ----
  # This file contains the MD5 checksums of the files in the
! # gcc-13-20250717.tar.xz tarball.
  #
  # Besides verifying that all files in the tarball were correctly expanded,
  # it also can be used to determine if any files have changed since the
*************** d32239bcb673463ab874e80d47fae504  COPYIN
*** 21,27 ****
  fd4ecdf5d672efe2b0e409aca9cf9446  ChangeLog.jit
  09538b708302f1735f6fa05b622ecf5e  ChangeLog.tree-ssa
  24ab760126489e69436a43185dc3d202  INSTALL/README
! 49046c82c5ad696052b3169ad95a5d70  LAST_UPDATED
  81b3330d422f3ce1ef8b720dfae35068  MAINTAINERS
  2b61ddbd876fa839639a7ca551773426  Makefile.def
  5d2d6a74f897f8158d37f5f2ec6877ce  Makefile.in
--- 21,27 ----
  fd4ecdf5d672efe2b0e409aca9cf9446  ChangeLog.jit
  09538b708302f1735f6fa05b622ecf5e  ChangeLog.tree-ssa
  24ab760126489e69436a43185dc3d202  INSTALL/README
! c2eb8dcb4e66ea12ddb9d830cf2bc82e  LAST_UPDATED
  81b3330d422f3ce1ef8b720dfae35068  MAINTAINERS
  2b61ddbd876fa839639a7ca551773426  Makefile.def
  5d2d6a74f897f8158d37f5f2ec6877ce  Makefile.in
*************** fb3fadb88e1d2b3b640cfaaa5ff11780  gcc/Ch
*** 510,516 ****
  3eb07e0b2e542409bf73d359f7f65609  gcc/ChangeLog.ptr
  e13638e26743ba41e6011b76cc00d9a9  gcc/ChangeLog.tree-ssa
  739ab47f6425bcea1d05e4fc0542de54  gcc/ChangeLog.tuples
! 819f14bee458fe4d3cea677b5d2b475d  gcc/DATESTAMP
  d41d8cd98f00b204e9800998ecf8427e  gcc/DEV-PHASE
  eb92e1ff5e982ca07e173e0eb286d243  gcc/FSFChangeLog
  30e1e33411566388b3164558482dc5e6  gcc/FSFChangeLog.10
--- 510,516 ----
  3eb07e0b2e542409bf73d359f7f65609  gcc/ChangeLog.ptr
  e13638e26743ba41e6011b76cc00d9a9  gcc/ChangeLog.tree-ssa
  739ab47f6425bcea1d05e4fc0542de54  gcc/ChangeLog.tuples
! 4abc0eabaf553aec79ab98779c6c7aab  gcc/DATESTAMP
  d41d8cd98f00b204e9800998ecf8427e  gcc/DEV-PHASE
  eb92e1ff5e982ca07e173e0eb286d243  gcc/FSFChangeLog
  30e1e33411566388b3164558482dc5e6  gcc/FSFChangeLog.10
*************** ffb1b3ecba72997c3e6804714698295d  gcc/co
*** 3913,3921 ****
  7512d54a6f733ab8b39bf9b02c1ba4db  gcc/config/i386/i386-opts.h
  3d980f6dc86b67acb7d8e5be6c08c589  gcc/config/i386/i386-passes.def
  15146e6cff34da8c1205b0df0813ccb0  gcc/config/i386/i386-protos.h
! 37411c56abf14704d70f5f8934f354ea  gcc/config/i386/i386.cc
  0c9ab892c366f3f64c88a3562987a4ba  gcc/config/i386/i386.h
! 132edee19206a270c6ab9a859fa5eea8  gcc/config/i386/i386.md
  c32251e85ab598cb51e89383639566bb  gcc/config/i386/i386.opt
  faa318618e52a0740019e9aa0764b007  gcc/config/i386/i386elf.h
  7c89dc80159b83f67c1fa47a10c88c13  gcc/config/i386/ia32intrin.h
--- 3913,3921 ----
  7512d54a6f733ab8b39bf9b02c1ba4db  gcc/config/i386/i386-opts.h
  3d980f6dc86b67acb7d8e5be6c08c589  gcc/config/i386/i386-passes.def
  15146e6cff34da8c1205b0df0813ccb0  gcc/config/i386/i386-protos.h
! 2c1a1dada63d12c6ab128b7c403d03b9  gcc/config/i386/i386.cc
  0c9ab892c366f3f64c88a3562987a4ba  gcc/config/i386/i386.h
! f6a6b03b5d8ef02a68a54d21a640e05f  gcc/config/i386/i386.md
  c32251e85ab598cb51e89383639566bb  gcc/config/i386/i386.opt
  faa318618e52a0740019e9aa0764b007  gcc/config/i386/i386elf.h
  7c89dc80159b83f67c1fa47a10c88c13  gcc/config/i386/ia32intrin.h
*************** e12ace984bb5ee071207675ca43c7e58  gcc/te
*** 70260,70265 ****
--- 70260,70266 ----
  991b7f7f44e28179f98bb458fdb69ea6  gcc/testsuite/gcc.target/i386/pr11877-2.c
  e7f6a568e551d3786797d6f56294b949  gcc/testsuite/gcc.target/i386/pr11877.c
  61d1a6c7aba6d7071f54e24b6dc92da7  gcc/testsuite/gcc.target/i386/pr118776.c
+ e33b63cd8f6d60b286b2286424f25714  gcc/testsuite/gcc.target/i386/pr120908.c
  b03b1d817538a863277c823b5e4cdf75  gcc/testsuite/gcc.target/i386/pr12092-1.c
  f99f88a6e994ad6e55e065e41bc58f8f  gcc/testsuite/gcc.target/i386/pr12329.c
  8951a1fa31f2d45ef9eacfff6a733f77  gcc/testsuite/gcc.target/i386/pr13366.c
diff -Nrcpad gcc-13-20250710/gcc/DATESTAMP gcc-13-20250717/gcc/DATESTAMP
*** gcc-13-20250710/gcc/DATESTAMP	Thu Jul 10 22:32:12 2025
--- gcc-13-20250717/gcc/DATESTAMP	Thu Jul 17 22:32:07 2025
***************
*** 1 ****
! 20250710
--- 1 ----
! 20250717
diff -Nrcpad gcc-13-20250710/gcc/config/i386/i386.cc gcc-13-20250717/gcc/config/i386/i386.cc
*** gcc-13-20250710/gcc/config/i386/i386.cc	Thu Jul 10 22:32:13 2025
--- gcc-13-20250717/gcc/config/i386/i386.cc	Thu Jul 17 22:32:08 2025
*************** legitimize_tls_address (rtx x, enum tls_
*** 11601,11611 ****
  	  if (TARGET_64BIT)
  	    {
  	      rtx rax = gen_rtx_REG (Pmode, AX_REG);
  	      rtx_insn *insns;
  
  	      start_sequence ();
  	      emit_call_insn
! 		(gen_tls_global_dynamic_64 (Pmode, rax, x, caddr));
  	      insns = get_insns ();
  	      end_sequence ();
  
--- 11601,11612 ----
  	  if (TARGET_64BIT)
  	    {
  	      rtx rax = gen_rtx_REG (Pmode, AX_REG);
+ 	      rtx rdi = gen_rtx_REG (Pmode, DI_REG);
  	      rtx_insn *insns;
  
  	      start_sequence ();
  	      emit_call_insn
! 		(gen_tls_global_dynamic_64 (Pmode, rax, x, caddr, rdi));
  	      insns = get_insns ();
  	      end_sequence ();
  
*************** legitimize_tls_address (rtx x, enum tls_
*** 11655,11666 ****
  	  if (TARGET_64BIT)
  	    {
  	      rtx rax = gen_rtx_REG (Pmode, AX_REG);
  	      rtx_insn *insns;
  	      rtx eqv;
  
  	      start_sequence ();
  	      emit_call_insn
! 		(gen_tls_local_dynamic_base_64 (Pmode, rax, caddr));
  	      insns = get_insns ();
  	      end_sequence ();
  
--- 11656,11668 ----
  	  if (TARGET_64BIT)
  	    {
  	      rtx rax = gen_rtx_REG (Pmode, AX_REG);
+ 	      rtx rdi = gen_rtx_REG (Pmode, DI_REG);
  	      rtx_insn *insns;
  	      rtx eqv;
  
  	      start_sequence ();
  	      emit_call_insn
! 		(gen_tls_local_dynamic_base_64 (Pmode, rax, caddr, rdi));
  	      insns = get_insns ();
  	      end_sequence ();
  
diff -Nrcpad gcc-13-20250710/gcc/config/i386/i386.md gcc-13-20250717/gcc/config/i386/i386.md
*** gcc-13-20250710/gcc/config/i386/i386.md	Thu Jul 10 22:32:13 2025
--- gcc-13-20250717/gcc/config/i386/i386.md	Thu Jul 17 22:32:08 2025
***************
*** 18621,18627 ****
  	 (match_operand 3)))
     (unspec:P [(match_operand 1 "tls_symbolic_operand")
  	      (reg:P SP_REG)]
! 	     UNSPEC_TLS_GD)]
    "TARGET_64BIT"
  {
    if (!TARGET_X32)
--- 18621,18628 ----
  	 (match_operand 3)))
     (unspec:P [(match_operand 1 "tls_symbolic_operand")
  	      (reg:P SP_REG)]
! 	     UNSPEC_TLS_GD)
!    (clobber (match_operand:P 4 "register_operand" "=D"))]
    "TARGET_64BIT"
  {
    if (!TARGET_X32)
***************
*** 18638,18644 ****
         Use data16 prefix instead, which doesn't have this problem.  */
      fputs ("\tdata16", asm_out_file);
    output_asm_insn
!     ("lea{q}\t{%E1@tlsgd(%%rip), %%rdi|rdi, %E1@tlsgd[rip]}", operands);
    if (TARGET_SUN_TLS || flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT)
      fputs (ASM_SHORT "0x6666\n", asm_out_file);
    else
--- 18639,18645 ----
         Use data16 prefix instead, which doesn't have this problem.  */
      fputs ("\tdata16", asm_out_file);
    output_asm_insn
!     ("lea{q}\t{%E1@tlsgd(%%rip), %q4|%q4, %E1@tlsgd[rip]}", operands);
    if (TARGET_SUN_TLS || flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT)
      fputs (ASM_SHORT "0x6666\n", asm_out_file);
    else
***************
*** 18662,18675 ****
  	 (match_operand 4)))
     (unspec:DI [(match_operand 1 "tls_symbolic_operand")
  	       (reg:DI SP_REG)]
! 	      UNSPEC_TLS_GD)]
    "TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF
     && GET_CODE (operands[3]) == CONST
     && GET_CODE (XEXP (operands[3], 0)) == UNSPEC
     && XINT (XEXP (operands[3], 0), 1) == UNSPEC_PLTOFF"
  {
    output_asm_insn
!     ("lea{q}\t{%E1@tlsgd(%%rip), %%rdi|rdi, %E1@tlsgd[rip]}", operands);
    output_asm_insn ("movabs{q}\t{%3, %%rax|rax, %3}", operands);
    output_asm_insn ("add{q}\t{%2, %%rax|rax, %2}", operands);
    return "call\t{*%%rax|rax}";
--- 18663,18677 ----
  	 (match_operand 4)))
     (unspec:DI [(match_operand 1 "tls_symbolic_operand")
  	       (reg:DI SP_REG)]
! 	      UNSPEC_TLS_GD)
!    (clobber (match_operand:DI 5 "register_operand" "=D"))]
    "TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF
     && GET_CODE (operands[3]) == CONST
     && GET_CODE (XEXP (operands[3], 0)) == UNSPEC
     && XINT (XEXP (operands[3], 0), 1) == UNSPEC_PLTOFF"
  {
    output_asm_insn
!     ("lea{q}\t{%E1@tlsgd(%%rip), %5|%5, %E1@tlsgd[rip]}", operands);
    output_asm_insn ("movabs{q}\t{%3, %%rax|rax, %3}", operands);
    output_asm_insn ("add{q}\t{%2, %%rax|rax, %2}", operands);
    return "call\t{*%%rax|rax}";
***************
*** 18685,18691 ****
  	   (const_int 0)))
       (unspec:P [(match_operand 1 "tls_symbolic_operand")
  		(reg:P SP_REG)]
! 	       UNSPEC_TLS_GD)])]
    "TARGET_64BIT"
    "ix86_tls_descriptor_calls_expanded_in_cfun = true;")
  
--- 18687,18694 ----
  	   (const_int 0)))
       (unspec:P [(match_operand 1 "tls_symbolic_operand")
  		(reg:P SP_REG)]
! 	       UNSPEC_TLS_GD)
!      (clobber (match_operand:P 3 "register_operand"))])]
    "TARGET_64BIT"
    "ix86_tls_descriptor_calls_expanded_in_cfun = true;")
  
***************
*** 18736,18746 ****
  	(call:P
  	 (mem:QI (match_operand 1 "constant_call_address_operand" "Bz"))
  	 (match_operand 2)))
!    (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)]
    "TARGET_64BIT"
  {
    output_asm_insn
!     ("lea{q}\t{%&@tlsld(%%rip), %%rdi|rdi, %&@tlsld[rip]}", operands);
    if (TARGET_SUN_TLS)
      return "call\t%p1@plt";
    if (flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT)
--- 18739,18750 ----
  	(call:P
  	 (mem:QI (match_operand 1 "constant_call_address_operand" "Bz"))
  	 (match_operand 2)))
!    (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)
!    (clobber (match_operand:P 3 "register_operand" "=D"))]
    "TARGET_64BIT"
  {
    output_asm_insn
!     ("lea{q}\t{%&@tlsld(%%rip), %q3|%q3, %&@tlsld[rip]}", operands);
    if (TARGET_SUN_TLS)
      return "call\t%p1@plt";
    if (flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT)
***************
*** 18756,18769 ****
  	 (mem:QI (plus:DI (match_operand:DI 1 "register_operand" "b")
  			  (match_operand:DI 2 "immediate_operand" "i")))
  	 (match_operand 3)))
!    (unspec:DI [(reg:DI SP_REG)] UNSPEC_TLS_LD_BASE)]
    "TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF
     && GET_CODE (operands[2]) == CONST
     && GET_CODE (XEXP (operands[2], 0)) == UNSPEC
     && XINT (XEXP (operands[2], 0), 1) == UNSPEC_PLTOFF"
  {
    output_asm_insn
!     ("lea{q}\t{%&@tlsld(%%rip), %%rdi|rdi, %&@tlsld[rip]}", operands);
    output_asm_insn ("movabs{q}\t{%2, %%rax|rax, %2}", operands);
    output_asm_insn ("add{q}\t{%1, %%rax|rax, %1}", operands);
    return "call\t{*%%rax|rax}";
--- 18760,18774 ----
  	 (mem:QI (plus:DI (match_operand:DI 1 "register_operand" "b")
  			  (match_operand:DI 2 "immediate_operand" "i")))
  	 (match_operand 3)))
!    (unspec:DI [(reg:DI SP_REG)] UNSPEC_TLS_LD_BASE)
!    (clobber (match_operand:DI 4 "register_operand" "=D"))]
    "TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF
     && GET_CODE (operands[2]) == CONST
     && GET_CODE (XEXP (operands[2], 0)) == UNSPEC
     && XINT (XEXP (operands[2], 0), 1) == UNSPEC_PLTOFF"
  {
    output_asm_insn
!     ("lea{q}\t{%&@tlsld(%%rip), %4|%4, %&@tlsld[rip]}", operands);
    output_asm_insn ("movabs{q}\t{%2, %%rax|rax, %2}", operands);
    output_asm_insn ("add{q}\t{%1, %%rax|rax, %1}", operands);
    return "call\t{*%%rax|rax}";
***************
*** 18777,18783 ****
  	   (call:P
  	    (mem:QI (match_operand 1))
  	    (const_int 0)))
!       (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)])]
    "TARGET_64BIT"
    "ix86_tls_descriptor_calls_expanded_in_cfun = true;")
  
--- 18782,18789 ----
  	   (call:P
  	    (mem:QI (match_operand 1))
  	    (const_int 0)))
!       (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)
!       (clobber (match_operand:P 2 "register_operand"))])]
    "TARGET_64BIT"
    "ix86_tls_descriptor_calls_expanded_in_cfun = true;")
  
diff -Nrcpad gcc-13-20250710/gcc/testsuite/gcc.target/i386/pr120908.c gcc-13-20250717/gcc/testsuite/gcc.target/i386/pr120908.c
*** gcc-13-20250710/gcc/testsuite/gcc.target/i386/pr120908.c	Thu Jan  1 00:00:00 1970
--- gcc-13-20250717/gcc/testsuite/gcc.target/i386/pr120908.c	Thu Jul 17 22:32:18 2025
***************
*** 0 ****
--- 1,16 ----
+ /* { dg-do compile { target { lp64 && fpic } } } */
+ /* { dg-options "-O2 -fpic -mtls-dialect=gnu -mcmodel=large" } */
+ 
+ extern __thread long bar1;
+ long *
+ foo1 (void)
+ {
+   return &bar1;
+ }
+ 
+ static __thread long bar2;
+ long *
+ foo2 (void)
+ {
+   return &bar2;
+ }
