[Committed] Fix __builtin_thread_pointer for ILP32 and other like ABIs
Andrew Pinski
pinskia@gmail.com
Wed Feb 26 00:51:00 GMT 2014
Hi,
With ILP32 AARCH64, Pmode (DImode) != ptrmode (SImode) so the
variable decl
has a mode of SImode while the register is DImode. So the target that gets
passed down to expand_builtin_thread_pointer is NULL as expand does not
know how to get a subreg for a pointer type.
This fixes the problem by handling a NULL target like we are able to handle
for a non register/correct mode target inside expand_builtin_thread_pointer.
Committed as obvious after a build and test for both
aarch64-linux-gnu and x86_64-linux-gnu with no regressions.
Thanks,
Andrew Pinski
* builtins.c (expand_builtin_thread_pointer): Create a new target
when the target is NULL.
-------------- next part --------------
Fix __builtin_thread_pointer for AARCH64 ILP32
Hi,
With ILP32 AARCH64, Pmode (DImode) != ptrmode (SImode) so the variable decl
has a mode of SImode while the register is DImode. So the target that gets
passed down to expand_builtin_thread_pointer is NULL as expand does not
know how to get a subreg for a pointer type.
This fixes the problem by handling a NULL target like we are able to handle
for a non register/correct mode target inside expand_builtin_thread_pointer.
Thanks,
Andrew Pinski
* builtins.c (expand_builtin_thread_pointer): Create a new target
when the target is NULL.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 616d8ec..570bff0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-24 Andrew Pinski <apinski@cavium.com>
+
+ * builtins.c (expand_builtin_thread_pointer): Create a new target
+ when the target is NULL.
+
2014-02-25 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/60317
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 35969ad..7c6318e 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5712,7 +5712,10 @@ expand_builtin_thread_pointer (tree exp, rtx target)
if (icode != CODE_FOR_nothing)
{
struct expand_operand op;
- if (!REG_P (target) || GET_MODE (target) != Pmode)
+ /* If the target is not sutitable then create a new target. */
+ if (target == NULL_RTX
+ || !REG_P (target)
+ || GET_MODE (target) != Pmode)
target = gen_reg_rtx (Pmode);
create_output_operand (&op, target, Pmode);
expand_insn (icode, 1, &op);
More information about the Gcc-patches
mailing list