@@ -241,6 +241,7 @@
;; s - address with no segment register
;; i - address with no index and no rip
;; b - address with no base and no rip
+;; S - symbol reference
(define_address_constraint "Tv"
"VSIB address operand"
@@ -79,6 +79,7 @@
UNSPEC_PLTOFF
UNSPEC_MACHOPIC_OFFSET
UNSPEC_PCREL
+ UNSPEC_SIZEOF
;; Prologue support
UNSPEC_STACK_ALLOC
@@ -18446,6 +18447,22 @@
"bndstx\t{%2, %3|%3, %2}"
[(set_attr "type" "mpxst")])
+(define_insn "move_size_reloc_<mode>"
+ [(set (match_operand:SWI48 0 "register_operand" "=r")
+ (unspec:<MODE>
+ [(match_operand:<MODE> 1 "symbol_operand")]
+ UNSPEC_SIZEOF))]
+ ""
+{
+ if (GET_MODE (operands[0]) == SImode)
+ return "mov{l}\t{%1@SIZE, %k0|%k0, %1@SIZE}";
+ else if (x86_64_zext_immediate_operand (operands[1], VOIDmode)
+ || ix86_cmodel == CM_KERNEL)
+ return "mov{q}\t{%1@SIZE, %0|%0, %1@SIZE}";
+ else
+ return "movabs{q}\t{%1@SIZE, %0|%0, %1@SIZE}";
+})
+
(include "mmx.md")
(include "sse.md")
(include "sync.md")
@@ -119,6 +119,10 @@
(match_test "TARGET_64BIT")
(match_test "REGNO (op) > BX_REG")))
+;; Return true if VALUE is symbol reference
+(define_predicate "symbol_operand"
+ (match_code "symbol_ref"))
+
;; Return true if VALUE can be stored in a sign extended immediate field.
(define_predicate "x86_64_immediate_operand"
(match_code "const_int,symbol_ref,label_ref,const")