This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v12] add -fpatchable-function-entry=N,M option
- From: Maxim Kuvyrkov <maxim dot kuvyrkov at linaro dot org>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: Torsten Duwe <duwe at suse dot de>, "Richard Earnshaw (lists)" <Richard dot Earnshaw at arm dot com>, Sandra Loosemore <sandra at codesourcery dot com>, Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Szabolcs Nagy <szabolcs dot nagy at arm dot com>, nd at arm dot com, Li Bin <huawei dot libin at huawei dot com>, Jiri Kosina <jkosina at suse dot cz>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, Takahiro Akashi <takahiro dot akashi at linaro dot org>, Andrew Wafaa <Andrew dot Wafaa at arm dot com>
- Date: Mon, 31 Jul 2017 14:47:41 +0300
- Subject: Re: [PATCH v12] add -fpatchable-function-entry=N,M option
- Authentication-results: sourceware.org; auth=none
- References: <20170706140311.GA20710@suse.de> <d3e6d7a1-1f1c-c0b5-133a-0ab29eb5034d@arm.com> <20170707193028.GA17752@suse.de> <mvmbmo7uvuu.fsf@suse.de> <20170726142629.GG22969@suse.de> <mvm379juv2y.fsf@suse.de>
On Jul 26, 2017, at 5:33 PM, Andreas Schwab <schwab@suse.de> wrote:
>
> On Jul 26 2017, Torsten Duwe <duwe@suse.de> wrote:
>
>> On Wed, Jul 26, 2017 at 04:16:25PM +0200, Andreas Schwab wrote:
>>> On Jul 07 2017, Torsten Duwe <duwe@suse.de> wrote:
>>>
>>>> diff --git a/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c b/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c
>>>> new file mode 100644
>>>> index 00000000000..8514b10e820
>>>> --- /dev/null
>>>> +++ b/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c
>>>> @@ -0,0 +1,16 @@
>>>> +/* { dg-do compile } */
>>>> +/* { dg-options "-O2 -fpatchable-function-entry=3,1" } */
>>>> +/* { dg-final { scan-assembler-times "nop" 2 } } */
>>>
>>> This fails on ia64.
>>
>> The solution is fairly obvious: on architectures where the nop is not called
>> "nop" provide a custom, cpu-specific test, or document the failure.
>
> But on ia64, a nop _is_ called nop.
The problem here is that ia64 backend emits "nop" instructions to pad IA64 bundles. The 2 nops at the beginning are [as expected] from the patchable attribute, but [unexpected] nops after ld8.mov and before "add r8" are generated by ia64 bundle packing.
nop 0
nop 0
.prologue
.body
.mmi
addl r14 = @ltoffx(a#), r1
;;
ld8.mov r14 = [r14], a#
nop 0
;;
.mmi
ld4 r14 = [r14]
;;
shladd r8 = r14, 2, r0
nop 0
;;
.mib
nop 0
add r8 = r8, r14
br.ret.sptk.many b0
I don't see an easy way to correctly differentiate between "attribute" nops and "bundle" nops, so XFAILing these tests on ia64 seems like a valid approach.
I speculate that other tests fail on ia64 for the same reason, but I didn't check.
--
Maxim Kuvyrkov
www.linaro.org