public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Enable one ISA for my code, and another ISA for GCC code?
@ 2018-08-15 11:55 Jeffrey Walton
  2018-08-15 12:01 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Jeffrey Walton @ 2018-08-15 11:55 UTC (permalink / raw)
  To: gcc-help

I'm catching a SIGILL on POWER7 ppc64-le machine. I compiled the
source with -mcpu=power8 so I could enable some builtins I may need.
Use of the builtins is guarded at runtime. (This is the classic distro
model, where most source code is compiled for a minimum machine but
higher ISAs are guarded at runtime).

GCC converted some C code into POWER8 code. The SIGILL is happening in
the function prologue due to use of mtfprwz. Apparently mtfprwz is a
ISA 2.07B/POWER8 instruction.

My question is, how do I tell GCC to use a different ISA than I am
using? I need a solution for compielrs found in the field, and that
includes GCC 4.8:


Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Enable one ISA for my code, and another ISA for GCC code?
  2018-08-15 11:55 Enable one ISA for my code, and another ISA for GCC code? Jeffrey Walton
@ 2018-08-15 12:01 ` Jonathan Wakely
  2018-08-15 12:08   ` Jeffrey Walton
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2018-08-15 12:01 UTC (permalink / raw)
  To: Jeffrey Walton; +Cc: gcc-help

GCC to gnerate code for On Wed, 15 Aug 2018 at 12:55, Jeffrey Walton wrote:
>
> I'm catching a SIGILL on POWER7 ppc64-le machine. I compiled the
> source with -mcpu=power8 so I could enable some builtins I may need.
> Use of the builtins is guarded at runtime. (This is the classic distro
> model, where most source code is compiled for a minimum machine but

You haven't compiled for a minimum machine, you've compiled for POWER8
when your minimum is POWER7.

> higher ISAs are guarded at runtime).
>
> GCC converted some C code into POWER8 code. The SIGILL is happening in
> the function prologue due to use of mtfprwz. Apparently mtfprwz is a
> ISA 2.07B/POWER8 instruction.
>
> My question is, how do I tell GCC to use a different ISA than I am
> using? I need a solution for compielrs found in the field, and that
> includes GCC 4.8:

You told GCC to generate code for POWER8. If you don't want to it
generate POWER8 instructions, don't tell it to use that ISA.

Maybe you want to use the target attribute:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Enable one ISA for my code, and another ISA for GCC code?
  2018-08-15 12:01 ` Jonathan Wakely
@ 2018-08-15 12:08   ` Jeffrey Walton
  0 siblings, 0 replies; 3+ messages in thread
From: Jeffrey Walton @ 2018-08-15 12:08 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

On Wed, Aug 15, 2018 at 8:00 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> GCC to gnerate code for On Wed, 15 Aug 2018 at 12:55, Jeffrey Walton wrote:
>>
>> I'm catching a SIGILL on POWER7 ppc64-le machine. I compiled the
>> source with -mcpu=power8 so I could enable some builtins I may need.
>> Use of the builtins is guarded at runtime. (This is the classic distro
>> model, where most source code is compiled for a minimum machine but
>
> You haven't compiled for a minimum machine, you've compiled for POWER8
> when your minimum is POWER7.

Right, that's the problem. To enable the built-in I need -mcpu=power8.
My code is guarded. (I've never really understood this requirement on
some platforms but not others).

But I don't want GCC using the cpu I'm writing for. GCC needs to use
POWER4 or so.

The problem seems to be GCC conflates what I want with what it can do.
They are two different things.

> Maybe you want to use the target attribute:
> https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html

Thanks. Let me give it a try.

Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-15 12:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15 11:55 Enable one ISA for my code, and another ISA for GCC code? Jeffrey Walton
2018-08-15 12:01 ` Jonathan Wakely
2018-08-15 12:08   ` Jeffrey Walton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).