https://gcc.gnu.org/g:3167c3755a1601e1793e797a2ec2a48d010030cd
commit r17-6062-g3167c3755a1601e1793e797a2ec2a48d010030cd Author: Uros Bizjak <[email protected]> Date: Sun Nov 8 22:56:50 2026 +0100 i386: Add pltoff_symbol_operand predicate for large PIC TLS call patterns Use the new predicate instead of open-coding the (const (unspec [...] UNSPEC_PLTOFF)) check in the insn conditions. No functional changes. gcc/ChangeLog: * config/i386/predicates.md (pltoff_symbol_operand): New predicate. * config/i386/i386.md (*tls_global_dynamic_64_largepic): Use pltoff_symbol_operand predicate for operand 3. Remove explicit UNSPEC_PLTOFF check from the insn condition. (*tls_local_dynamic_base_64_largepic): Ditto for operand 2. Diff: --- gcc/config/i386/i386.md | 14 ++++---------- gcc/config/i386/predicates.md | 6 ++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 71408b720d30..d5e9c4b6e48e 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -24321,16 +24321,13 @@ [(set (match_operand:DI 0 "register_operand" "=a") (call:DI (mem:QI (plus:DI (match_operand:DI 2 "register_operand" "b") - (match_operand:DI 3 "immediate_operand" "i"))) + (match_operand:DI 3 "pltoff_symbol_operand" "i"))) (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" + "TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF" { output_asm_insn ("lea{q}\t{%E1@tlsgd(%%rip), %5|%5, %E1@tlsgd[rip]}", operands); @@ -24437,14 +24434,11 @@ [(set (match_operand:DI 0 "register_operand" "=a") (call:DI (mem:QI (plus:DI (match_operand:DI 1 "register_operand" "b") - (match_operand:DI 2 "immediate_operand" "i"))) + (match_operand:DI 2 "pltoff_symbol_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" + "TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF" { /* The last local-dynamic TLS reference can be deleted after RA while this insn survives (DCE doesn't delete calls in sched2, and a dead diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 2718232caf0f..5ef4a1ab8551 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -822,6 +822,12 @@ (match_code "unspec" "0") (match_test "XINT (XEXP (op, 0), 1) == UNSPEC_GOT"))) +;; Return true if OP is a PLTOFF symbol operand. +(define_predicate "pltoff_symbol_operand" + (and (match_code "const") + (match_code "unspec" "0") + (match_test "XINT (XEXP (op, 0), 1) == UNSPEC_PLTOFF"))) + ;; Match exactly zero. (define_predicate "const0_operand" (match_code "const_int,const_double,const_vector")
