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.
Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.
Uros.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 71408b720d3..d5e9c4b6e48 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -24321,16 +24321,13 @@ (define_insn "*tls_global_dynamic_64_largepic"
[(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 @@ (define_insn "*tls_local_dynamic_base_64_largepic"
[(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 2718232caf0..5ef4a1ab855 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -822,6 +822,12 @@ (define_predicate "GOT32_symbol_operand"
(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")