This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: ARMv8, GCC 4.9 and necessary code optimized away?
- From: "Richard Earnshaw (lists)" <Richard dot Earnshaw at arm dot com>
- To: noloader at gmail dot com, Andrew Haley <aph at redhat dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 1 Jun 2016 11:26:39 +0100
- Subject: Re: ARMv8, GCC 4.9 and necessary code optimized away?
- Authentication-results: sourceware.org; auth=none
- References: <CAH8yC8=KPf7edhTRgKV4nVJfwMpSXwmU+PDGfL6i4xA4SDwJwQ at mail dot gmail dot com> <574D89F2 dot 70108 at foss dot arm dot com> <CAH8yC8m0p+N2duSKcBMo4TKFrMwo6Ed+j+Frt2SjT=ZBR14CPA at mail dot gmail dot com> <574E8F75 dot 6020805 at redhat dot com> <CAH8yC8kz4-+UYciiDiQx+X0O9VBkrN21FNQHdcrPygLgmGVdqA at mail dot gmail dot com> <574E9E3F dot 3080507 at redhat dot com> <CAH8yC8=oAU=kcgsW5PGJ6UChjN_hFoRhcPCnP=M+t-35tKDyvw at mail dot gmail dot com>
On 01/06/16 10:36, Jeffrey Walton wrote:
>>> ...
>>>
>>> An statement to test for the presence of an instruction is only code.
>>
>> This is a mistake by the programmer. To test for the presence of an
>> instruction, they need to emit the instruction. Asm statements do
>> that.
>
> Thanks Andrew. Doesn't the intrinsic do that?
>
> ARM instrinsics are very appealing for us. They work on Linux,
> Android, iOS, Windows Phone, Windows Store, and Aarch32 on Aarch64.
>
> (I want to ensure I'm not wandering into unwanted or unseen side effects).
>
> Jeff
>
ARM intrinsics, as with most constructs in programming languages are
governed by the 'as if' rule. That is, the behaviour (from the
view-point of the abstract machine defined by the programming language)
is as if the operation were performed. If the compiler can determine
that an alternative code sequence can satisfy that requirement it is at
liberty to substitute that alternative sequence.
By and large, any result that is not used, can be removed by this rule
since the observable behaviour of the abstract machine is the same.
Note, finally, that asm constructs are not defined by the language
standards, so you won't get very far appealing to the relevant language
standards in this area.
R.