This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Enable EBX for x86 in 32bits PIC code
- From: Vladimir Makarov <vmakarov at redhat dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Evgeny Stupachenko <evstupac at gmail dot com>, Richard Biener <richard dot guenther at gmail dot com>, Uros Bizjak <ubizjak at gmail dot com>, Jeff Law <law at redhat dot com>
- Date: Tue, 02 Sep 2014 10:29:16 -0400
- Subject: Re: Enable EBX for x86 in 32bits PIC code
- Authentication-results: sourceware.org; auth=none
- References: <CAOvf_xxsQ_oYGqNAVQ1+BW+CuD3mzebZ2xma0jpF=WfyZMCRCA at mail dot gmail dot com> <CAFiYyc1mFtTezkTJORmJJq+yht=qPSwiN7KDn19+bSuSdaqvMQ at mail dot gmail dot com> <CAOvf_xyeVeg2oB9Xxz8RMEQ6gyfJY5whd9s4ygoAAEaMU9efnA at mail dot gmail dot com> <20140707114750 dot GB31640 at tucnak dot redhat dot com> <CAMbmDYZV_fx0jxmKHhLsC2pJ7pDzuu6toEAH72izOdpq6KGyfg at mail dot gmail dot com> <20140822121151 dot GA60032 at msticlxl57 dot ims dot intel dot com> <53FB5184 dot 3030500 at redhat dot com> <CAMbmDYbP77pmkqpJD8cnXbe7_8aRMnYF-tnfKRubULn8-aDCdw at mail dot gmail dot com> <CAMbmDYacBWjKtCYPB0A2m=fkUTk_Wt5D6f2aEkH7C3paWaR7ag at mail dot gmail dot com> <53FCA6F5 dot 7020405 at redhat dot com> <20140826213712 dot GA39451 at msticlxl57 dot ims dot intel dot com> <53FE3D46 dot 8050904 at redhat dot com> <CAMbmDYZxt7wceND52mb9rM+poTNpjFtLyj2WT5qatbjMdLWmbg at mail dot gmail dot com> <CAMbmDYb9E6-DpCd8cx+X-4d3oDkLMTo63ibojAY+Lsf9L-UNRA at mail dot gmail dot com>
On 08/29/2014 02:47 AM, Ilya Enkovich wrote:
> Seems your patch doesn't cover all cases. Attached is a modified
> patch (with your changes included) and a test where double constant is
> wrongly rematerialized. I also see in ira dump that there is still a
> copy of PIC reg created:
>
> Initialization of original PIC reg:
> (insn 23 22 24 2 (set (reg:SI 127)
> (reg:SI 3 bx)) test.cc:42 90 {*movsi_internal}
> (expr_list:REG_DEAD (reg:SI 3 bx)
> (nil)))
> ...
> Copy is created:
> (insn 135 37 25 3 (set (reg:SI 138 [127])
> (reg:SI 127)) 90 {*movsi_internal}
> (expr_list:REG_DEAD (reg:SI 127)
> (nil)))
> ...
> Copy is used:
> (insn 119 25 122 3 (set (reg:DF 134)
> (mem/u/c:DF (plus:SI (reg:SI 138 [127])
> (const:SI (unspec:SI [
> (symbol_ref/u:SI ("*.LC0") [flags 0x2])
> ] UNSPEC_GOTOFF))) [5 S8 A64])) 128 {*movdf_internal}
> (expr_list:REG_EQUIV (const_double:DF
> 2.9999999999999997371893933895137251965934410691261292e-4
> [0x0.9d495182a99308p-11])
> (nil)))
>
> After reload we have new usage of r127 which is allocated to ecx which
> actually does not have any definition in this function at all.
>
> (insn 151 42 44 4 (set (reg:SI 0 ax [147])
> (plus:SI (reg:SI 2 cx [127])
> (const:SI (unspec:SI [
> (symbol_ref/u:SI ("*.LC0") [flags 0x2])
> ] UNSPEC_GOTOFF)))) test.cc:44 213 {*leasi}
> (expr_list:REG_EQUAL (symbol_ref/u:SI ("*.LC0") [flags 0x2])
> (nil)))
> (insn 44 151 45 4 (set (reg:DF 21 xmm0 [orig:129 D.2450 ] [129])
> (mult:DF (reg:DF 21 xmm0 [orig:128 D.2450 ] [128])
> (mem/u/c:DF (reg:SI 0 ax [147]) [5 S8 A64]))) test.cc:44
> 790 {*fop_df_comm_sse}
> (expr_list:REG_EQUAL (mult:DF (reg:DF 21 xmm0 [orig:128 D.2450 ] [128])
> (const_double:DF
> 2.9999999999999997371893933895137251965934410691261292e-4
> [0x0.9d495182a99308p-11]))
> (nil)))
>
> Compilation string: g++ -m32 -O2 -mfpmath=sse -fPIE -S test.cc
>
>
Ok, Ilya. I'll look at the problem this week.