On 18/06/2019 14:50, Sylvia Taylor wrote:
Hi Wilco,
Combined them into one pattern. Updated the diff and the changelog is now:
gcc/ChangeLog:
2019-06-18 Sylvia Taylor <sylvia.tay...@arm.com>
* config/aarch64/aarch64.c
(aarch64_load_symref_appropriately): Change SYMBOL_TINY_GOT.
* config/aarch64/aarch64.md
(ldr_got_tiny_<mode>): New pattern.
(ldr_got_tiny_sidi): New pattern.
Cheers,
Syl
-----Original Message-----
From: Wilco Dijkstra <wilco.dijks...@arm.com>
Sent: 13 June 2019 18:42
To: Sylvia Taylor <sylvia.tay...@arm.com>
Cc: nd <n...@arm.com>; GCC Patches <gcc-patches@gcc.gnu.org>; Richard Earnshaw
<richard.earns...@arm.com>; James Greenhalgh <james.greenha...@arm.com>
Subject: Re: [patch][aarch64]: fix unrecognizable insn for ldr got in ilp32 tiny
Hi Sylvia,
-(define_insn "ldr_got_tiny"
+(define_insn "ldr_got_tiny_di"
[(set (match_operand:DI 0 "register_operand" "=r")
- (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")]
- UNSPEC_GOTTINYPIC))]
+ (unspec:DI
+ [(match_operand:DI 1 "aarch64_valid_symref" "S")]
+ UNSPEC_GOTTINYPIC))]
""
"ldr\\t%0, %L1"
[(set_attr "type" "load_8")]
)
+(define_insn "ldr_got_tiny_si"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec:SI
+ [(match_operand:SI 1 "aarch64_valid_symref" "S")]
+ UNSPEC_GOTTINYPIC))]
+ "TARGET_ILP32"
+ "ldr\\t%0, %L1"
+ [(set_attr "type" "load_4")]
+)
These can be easily combined like the related ldr_got_small_<mode>.
Wilco
-----Original Message-----
From: Sylvia Taylor
Sent: 11 June 2019 14:25
To: Richard Earnshaw <richard.earns...@arm.com>; James Greenhalgh
<james.greenha...@arm.com>; Marcus Shawcroft <marcus.shawcr...@arm.com>;
gcc-patches@gcc.gnu.org
Cc: nd <n...@arm.com>
Subject: [patch][aarch64]: fix unrecognizable insn for ldr got in ilp32 tiny
Greetings,
This patch addresses a bug in ldr GOT for mcmodel=tiny in which this
instruction is not generated for ilp32 modes.
Defined 2 new patterns for ldr_got_tiny. Added additional checks to use the
appropriate rtl pattern for any of the modes.
Examples of previously unrecognized instructions:
ldr x1, :got:_ZTIi // [c=4 l=4] ldr_got_tiny_si
ldr x0, :got:global // [c=4 l=4] ldr_got_tiny_sidi
Bootstrapped and tested on aarch64-none-linux-gnu.
Bug fix tested with aarch64-none-elf-g++ -mabi=ilp32 -mcmodel=tiny -fpic.
The existing test now fixed is: testsuite/g++.dg/torture/stackalign/throw-1.C
Ok for trunk? If yes, I don't have any commit rights, so can someone please
commit it on my behalf.
Cheers,
Syl
gcc/ChangeLog:
2019-06-11 Sylvia Taylor <sylvia.tay...@arm.com>
* config/aarch64/aarch64.c
(aarch64_load_symref_appropriately): Change SYMBOL_TINY_GOT.
* config/aarch64/aarch64.md
(ldr_got_tiny): Change to ldr_got_tiny_di.
(ldr_got_tiny_si): New pattern.
(ldr_got_tiny_sidi): New pattern.
[...]
> +(define_insn "ldr_got_tiny_<mode>"
If you change the above to:
(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))]
then
> + if (mode == DImode)
> + emit_insn (gen_ldr_got_tiny_di (dest, imm));
> + else
> + /* TARGET_ILP32. */
> + emit_insn (gen_ldr_got_tiny_si (dest, imm));
can be simplified to
emit_insn (gen_ldr_got_tiny (mode, dest, imm));
What's more, the compiler will abort if mode turns out (for some obscure
reason) to be one we don't have a pattern for.
See Parameterized Names in the gcc manual for details
R.