+2020-03-18 Duan bo <duanbo3@huawei.com>
+
+ PR target/94201
+ * config/aarch64/aarch64.md (ldr_got_tiny): Delete.
+ (@ldr_got_tiny_<mode>): New pattern.
+ (ldr_got_tiny_sidi): Likewise.
+ * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Use
+ them to handle SYMBOL_TINY_GOT for ILP32.
+
2020-03-18 Richard Sandiford <richard.sandiford@arm.com>
* config/aarch64/aarch64.c (aarch64_sve_abi): Treat p12-p15 as
}
case SYMBOL_TINY_GOT:
- emit_insn (gen_ldr_got_tiny (dest, imm));
- return;
+ {
+ rtx insn;
+ machine_mode mode = GET_MODE (dest);
+
+ if (mode == ptr_mode)
+ insn = gen_ldr_got_tiny (mode, dest, imm);
+ else
+ {
+ gcc_assert (mode == Pmode);
+ insn = gen_ldr_got_tiny_sidi (dest, imm);
+ }
+
+ emit_insn (insn);
+ return;
+ }
case SYMBOL_TINY_TLSIE:
{
[(set_attr "type" "load_4")]
)
-(define_insn "ldr_got_tiny"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")]
- UNSPEC_GOTTINYPIC))]
+(define_insn "@ldr_got_tiny_<mode>"
+ [(set (match_operand:PTR 0 "register_operand" "=r")
+ (unspec:PTR [(match_operand:PTR 1 "aarch64_valid_symref" "S")]
+ UNSPEC_GOTTINYPIC))]
""
- "ldr\\t%0, %L1"
- [(set_attr "type" "load_8")]
+ "ldr\t%<w>0, %L1"
+ [(set_attr "type" "load_<ldst_sz>")]
+)
+
+(define_insn "ldr_got_tiny_sidi"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (zero_extend:DI
+ (unspec:SI [(match_operand:DI 1 "aarch64_valid_symref" "S")]
+ UNSPEC_GOTTINYPIC)))]
+ "TARGET_ILP32"
+ "ldr\t%w0, %L1"
+ [(set_attr "type" "load_4")]
)
(define_insn "aarch64_load_tp_hard"
+2020-03-18 Duan bo <duanbo3@huawei.com>
+
+ PR target/94201
+ * gcc.target/aarch64/pr94201.c:New test.
+
2020-03-18 Richard Sandiford <richard.sandiford@arm.com>
* gcc.target/aarch64/sve/acle/general/cpy_1.c: Leave gaps for in the
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mcmodel=tiny -mabi=ilp32 -fPIC" } */
+
+extern int bar (void *);
+extern long long a;
+
+int
+foo (void)
+{
+ a = 1;
+ return bar ((void *)bar);
+}
+