This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v12] add -fpatchable-function-entry=N,M option


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]