public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to detect user uses -masm=intel?
@ 2021-07-29  1:39 unlvsur unlvsur
  2021-07-29  1:42 ` Andrew Pinski
  0 siblings, 1 reply; 7+ messages in thread
From: unlvsur unlvsur @ 2021-07-29  1:39 UTC (permalink / raw)
  To: gcc

Any GCC macro that can tell the code it is using the intel format’s assembly instead of at&t??

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


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

* Re: How to detect user uses -masm=intel?
  2021-07-29  1:39 How to detect user uses -masm=intel? unlvsur unlvsur
@ 2021-07-29  1:42 ` Andrew Pinski
  2021-07-29  2:04   ` unlvsur unlvsur
  2021-07-29  2:48   ` unlvsur unlvsur
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Pinski @ 2021-07-29  1:42 UTC (permalink / raw)
  To: unlvsur unlvsur; +Cc: gcc

On Wed, Jul 28, 2021 at 6:41 PM unlvsur unlvsur via Gcc <gcc@gcc.gnu.org> wrote:
>
> Any GCC macro that can tell the code it is using the intel format’s assembly instead of at&t??

Inside the inline-asm you can use the alternative.
Like this:
cmp{b}\t{%1, %h0|%h0, %1}

This is how GCC implements this inside too.

Thanks,
Andrew

>
> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>

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

* RE: How to detect user uses -masm=intel?
  2021-07-29  1:42 ` Andrew Pinski
@ 2021-07-29  2:04   ` unlvsur unlvsur
  2021-07-29  2:48   ` unlvsur unlvsur
  1 sibling, 0 replies; 7+ messages in thread
From: unlvsur unlvsur @ 2021-07-29  2:04 UTC (permalink / raw)
  To: Andrew Pinski, gcc

Do not quite understand. Can you show me an example??

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Andrew Pinski<mailto:pinskia@gmail.com>
Sent: Wednesday, July 28, 2021 21:43
To: unlvsur unlvsur<mailto:unlvsur@live.com>
Cc: gcc@gcc.gnu.org<mailto:gcc@gcc.gnu.org>
Subject: Re: How to detect user uses -masm=intel?

On Wed, Jul 28, 2021 at 6:41 PM unlvsur unlvsur via Gcc <gcc@gcc.gnu.org> wrote:
>
> Any GCC macro that can tell the code it is using the intel format’s assembly instead of at&t??

Inside the inline-asm you can use the alternative.
Like this:
cmp{b}\t{%1, %h0|%h0, %1}

This is how GCC implements this inside too.

Thanks,
Andrew

>
> Sent from Mail<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D550986&amp;data=04%7C01%7C%7C9ff9312911b84c6126dc08d952323529%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637631197911449533%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ygQvHY1b7whxaAMvhglHY12E688oc%2F%2BqBe7AKwVQfBs%3D&amp;reserved=0> for Windows 10
>


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

* RE: How to detect user uses -masm=intel?
  2021-07-29  1:42 ` Andrew Pinski
  2021-07-29  2:04   ` unlvsur unlvsur
@ 2021-07-29  2:48   ` unlvsur unlvsur
  2021-07-29  7:04     ` Hongtao Liu
  2021-07-29  8:38     ` Florian Weimer
  1 sibling, 2 replies; 7+ messages in thread
From: unlvsur unlvsur @ 2021-07-29  2:48 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc

What I mean is that what macro GCC sets when it compiles -masm=intel


Int main()
{
#ifdef /*__INTEL_ASM????*/
                printf(“intel”);
#else
                printf(“at&t”);
#endif
}

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Andrew Pinski<mailto:pinskia@gmail.com>
Sent: Wednesday, July 28, 2021 21:43
To: unlvsur unlvsur<mailto:unlvsur@live.com>
Cc: gcc@gcc.gnu.org<mailto:gcc@gcc.gnu.org>
Subject: Re: How to detect user uses -masm=intel?

On Wed, Jul 28, 2021 at 6:41 PM unlvsur unlvsur via Gcc <gcc@gcc.gnu.org> wrote:
>
> Any GCC macro that can tell the code it is using the intel format’s assembly instead of at&t??

Inside the inline-asm you can use the alternative.
Like this:
cmp{b}\t{%1, %h0|%h0, %1}

This is how GCC implements this inside too.

Thanks,
Andrew

>
> Sent from Mail<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D550986&amp;data=04%7C01%7C%7C9ff9312911b84c6126dc08d952323529%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637631197911449533%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ygQvHY1b7whxaAMvhglHY12E688oc%2F%2BqBe7AKwVQfBs%3D&amp;reserved=0> for Windows 10
>


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

* Re: How to detect user uses -masm=intel?
  2021-07-29  2:48   ` unlvsur unlvsur
@ 2021-07-29  7:04     ` Hongtao Liu
  2021-07-29  8:38     ` Florian Weimer
  1 sibling, 0 replies; 7+ messages in thread
From: Hongtao Liu @ 2021-07-29  7:04 UTC (permalink / raw)
  To: unlvsur unlvsur; +Cc: Andrew Pinski, gcc

On Thu, Jul 29, 2021 at 10:49 AM unlvsur unlvsur via Gcc
<gcc@gcc.gnu.org> wrote:
>
> What I mean is that what macro GCC sets when it compiles -masm=intel
>
>
> Int main()
> {
> #ifdef /*__INTEL_ASM????*/
>                 printf(“intel”);
> #else
>                 printf(“at&t”);
> #endif
> }
not fully understand what you're seeking, probably you're looking for
ASSEMBLER_DIALECT.

cut from i386.c
---------------
void
ix86_print_operand (FILE *file, rtx x, int code)
{
  if (code)
    {
      switch (code)
{
case 'A':
  switch (ASSEMBLER_DIALECT)
    {
    case ASM_ATT:
      putc ('*', file);
      break;

    case ASM_INTEL:
      /* Intel syntax. For absolute addresses, registers should not
be surrounded by braces.  */
      if (!REG_P (x))
{
  putc ('[', file);
  ix86_print_operand (file, x, 0);
  putc (']', file);
  return;
}
      break;
--------------

> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>
> From: Andrew Pinski<mailto:pinskia@gmail.com>
> Sent: Wednesday, July 28, 2021 21:43
> To: unlvsur unlvsur<mailto:unlvsur@live.com>
> Cc: gcc@gcc.gnu.org<mailto:gcc@gcc.gnu.org>
> Subject: Re: How to detect user uses -masm=intel?
>
> On Wed, Jul 28, 2021 at 6:41 PM unlvsur unlvsur via Gcc <gcc@gcc.gnu.org> wrote:
> >
> > Any GCC macro that can tell the code it is using the intel format’s assembly instead of at&t??
>
> Inside the inline-asm you can use the alternative.
> Like this:
> cmp{b}\t{%1, %h0|%h0, %1}
>
> This is how GCC implements this inside too.
>
> Thanks,
> Andrew
>
> >
> > Sent from Mail<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D550986&amp;data=04%7C01%7C%7C9ff9312911b84c6126dc08d952323529%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637631197911449533%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ygQvHY1b7whxaAMvhglHY12E688oc%2F%2BqBe7AKwVQfBs%3D&amp;reserved=0> for Windows 10
> >
>


-- 
BR,
Hongtao

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

* Re: How to detect user uses -masm=intel?
  2021-07-29  2:48   ` unlvsur unlvsur
  2021-07-29  7:04     ` Hongtao Liu
@ 2021-07-29  8:38     ` Florian Weimer
  2021-07-30  0:32       ` unlvsur unlvsur
  1 sibling, 1 reply; 7+ messages in thread
From: Florian Weimer @ 2021-07-29  8:38 UTC (permalink / raw)
  To: unlvsur unlvsur via Gcc; +Cc: Andrew Pinski, unlvsur unlvsur

* unlvsur unlvsur via Gcc:

> What I mean is that what macro GCC sets when it compiles -masm=intel
>
>
> Int main()
> {
> #ifdef /*__INTEL_ASM????*/
>                 printf(“intel”);
> #else
>                 printf(“at&t”);
> #endif
> }

There doesn't seem to be such a macro:

$ diff -u <(gcc -dM -E -x c /dev/null) <(gcc -masm=intel -dM -E -x c /dev/null)
$ 

It doesn't look like it's possible to detect this as the GAS level
directly.  So you have to use the alternatives syntax that Andrew
suggested.

Thanks,
Florian


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

* RE: How to detect user uses -masm=intel?
  2021-07-29  8:38     ` Florian Weimer
@ 2021-07-30  0:32       ` unlvsur unlvsur
  0 siblings, 0 replies; 7+ messages in thread
From: unlvsur unlvsur @ 2021-07-30  0:32 UTC (permalink / raw)
  To: Florian Weimer, unlvsur unlvsur via Gcc

Can we add one??

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Florian Weimer<mailto:fweimer@redhat.com>
Sent: Thursday, July 29, 2021 04:39
To: unlvsur unlvsur via Gcc<mailto:gcc@gcc.gnu.org>
Cc: Andrew Pinski<mailto:pinskia@gmail.com>; unlvsur unlvsur<mailto:unlvsur@live.com>
Subject: Re: How to detect user uses -masm=intel?

* unlvsur unlvsur via Gcc:

> What I mean is that what macro GCC sets when it compiles -masm=intel
>
>
> Int main()
> {
> #ifdef /*__INTEL_ASM????*/
>                 printf(“intel”);
> #else
>                 printf(“at&t”);
> #endif
> }

There doesn't seem to be such a macro:

$ diff -u <(gcc -dM -E -x c /dev/null) <(gcc -masm=intel -dM -E -x c /dev/null)
$

It doesn't look like it's possible to detect this as the GAS level
directly.  So you have to use the alternatives syntax that Andrew
suggested.

Thanks,
Florian


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

end of thread, other threads:[~2021-07-30  0:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  1:39 How to detect user uses -masm=intel? unlvsur unlvsur
2021-07-29  1:42 ` Andrew Pinski
2021-07-29  2:04   ` unlvsur unlvsur
2021-07-29  2:48   ` unlvsur unlvsur
2021-07-29  7:04     ` Hongtao Liu
2021-07-29  8:38     ` Florian Weimer
2021-07-30  0:32       ` unlvsur unlvsur

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).