+2005-11-04 Paul Brook <paul@codesourcery.com>
+
+ * config/arm/arm.c (arm_load_pic_register): Pass extra reg to
+ gen_pic_add_dot_plus_four and gen_pic_add_dot_plus_eight.
+ (arm_call_tls_get_addr, legitimize_tls_address): Likewise.
+ * config/arm/arm.md: Use match_operand in peephole input templates
+ and match_dup in peephole output templates.
+
2005-11-04 Daniel Jacobowitz <dan@codesourcery.com>
* config/arm/arm.c (arm_init_libfuncs): Use __aeabi_idiv and
if (TARGET_ARM)
{
emit_insn (gen_pic_load_addr_arm (pic_offset_table_rtx, pic_rtx));
- emit_insn (gen_pic_add_dot_plus_eight (pic_offset_table_rtx, l1));
+ emit_insn (gen_pic_add_dot_plus_eight (pic_offset_table_rtx,
+ pic_offset_table_rtx, l1));
}
else
{
}
else
emit_insn (gen_pic_load_addr_thumb (pic_offset_table_rtx, pic_rtx));
- emit_insn (gen_pic_add_dot_plus_four (pic_offset_table_rtx, l1));
+ emit_insn (gen_pic_add_dot_plus_four (pic_offset_table_rtx,
+ pic_offset_table_rtx, l1));
}
/* Need to emit this whether or not we obey regdecls,
reg = load_tls_operand (sum, reg);
if (TARGET_ARM)
- emit_insn (gen_pic_add_dot_plus_eight (reg, label));
+ emit_insn (gen_pic_add_dot_plus_eight (reg, reg, label));
else
- emit_insn (gen_pic_add_dot_plus_four (reg, label));
+ emit_insn (gen_pic_add_dot_plus_four (reg, reg, label));
*valuep = emit_library_call_value (get_tls_get_addr (), NULL_RTX, LCT_PURE, /* LCT_CONST? */
Pmode, 1, reg, Pmode);
emit_insn (gen_tls_load_dot_plus_eight (reg, reg, label));
else
{
- emit_insn (gen_pic_add_dot_plus_four (reg, label));
+ emit_insn (gen_pic_add_dot_plus_four (reg, reg, label));
emit_move_insn (reg, gen_const_mem (SImode, reg));
}
)
(define_insn "pic_add_dot_plus_four"
- [(set (match_operand:SI 0 "register_operand" "+r")
- (unspec:SI [(plus:SI (match_dup 0)
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec:SI [(plus:SI (match_operand:SI 1 "register_operand" "0")
(const (plus:SI (pc) (const_int 4))))]
UNSPEC_PIC_BASE))
- (use (label_ref (match_operand 1 "" "")))]
+ (use (label_ref (match_operand 2 "" "")))]
"TARGET_THUMB"
"*
(*targetm.asm_out.internal_label) (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (operands[1]));
+ CODE_LABEL_NUMBER (operands[2]));
return \"add\\t%0, %|pc\";
"
[(set_attr "length" "2")]
)
(define_insn "pic_add_dot_plus_eight"
- [(set (match_operand:SI 0 "register_operand" "+r")
- (unspec:SI [(plus:SI (match_dup 0)
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec:SI [(plus:SI (match_operand:SI 1 "register_operand" "r")
(const (plus:SI (pc) (const_int 8))))]
UNSPEC_PIC_BASE))
- (use (label_ref (match_operand 1 "" "")))]
+ (use (label_ref (match_operand 2 "" "")))]
"TARGET_ARM"
"*
(*targetm.asm_out.internal_label) (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (operands[1]));
- return \"add%?\\t%0, %|pc, %0\";
+ CODE_LABEL_NUMBER (operands[2]));
+ return \"add%?\\t%0, %|pc, %1\";
"
[(set_attr "predicable" "yes")]
)
(define_peephole2
[(parallel [(set (match_operand:SI 0 "register_operand" "")
- (unspec:SI [(plus:SI (match_dup 0)
+ (unspec:SI [(plus:SI (match_operand:SI 3 "register_operand" "")
(const (plus:SI (pc) (const_int 8))))]
UNSPEC_PIC_BASE))
(use (label_ref (match_operand 1 "" "")))])
(set (match_operand:SI 2 "register_operand" "") (mem:SI (match_dup 0)))]
"TARGET_ARM && peep2_reg_dead_p (2, operands[0])"
- [(parallel [(set (match_operand:SI 2 "register_operand" "+r")
- (mem:SI (unspec:SI [(plus:SI (match_dup 0)
+ [(parallel [(set (match_dup 2)
+ (mem:SI (unspec:SI [(plus:SI (match_dup 3)
(const (plus:SI (pc) (const_int 8))))]
UNSPEC_PIC_BASE)))
- (use (label_ref (match_operand 1 "" "")))])]
+ (use (label_ref (match_dup 1)))])]
""
)
+2005-11-04 Paul Brook <paul@codesourcery.com>
+
+ * gcc.dg/tls/opt-10.c: New test.
+
2005-11-04 Andreas Jaeger <aj@suse.de>
* gcc.dg/format/unnamed-1.c: Add -msse for x86 compilation to
--- /dev/null
+/* { dg-do compile */
+/* { dg-options "-O3 -fpic" } */
+
+/* The web pass was creating unrecognisable pic_load_dot_plus_four insns
+ on ARM. */
+
+__thread int a_thread_local;
+void *
+spin (int n)
+{
+ int i;
+ for (i = 0; i <= n; i++)
+ {
+ a_thread_local += i;
+ }
+}