public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step
@ 2015-10-24 20:38 noloader at gmail dot com
  2015-10-24 20:52 ` [Bug target/68081] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: noloader at gmail dot com @ 2015-10-24 20:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081

            Bug ID: 68081
           Summary: Cygwin GCC cannot compile program that uses
                    __builtin_ia32_rdseed64_step
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: noloader at gmail dot com
  Target Milestone: ---

I'm testing on Cygwin64. Cygwin64 provides the 5.2.0 compiler.

Attempting to compile the following results in an error:

  $ cat rdseed.c
  #include <stdint.h>

  int main()
  {
    uint64_t val;
    __builtin_ia32_rdseed64_step(&val);
    return (int)val;
  }

The error is:

  $ gcc -mrdseed rdseed.c -o rdseed.exe
  ...
  rdseed.c:6:36: error: '__builtin_ia32_rdseed64_step' was not declared in this
scope.

The expected define appears to be defined:

  $ cpp -mrdseed -dM </dev/null | grep -i seed
  #define __RDSEED__ 1

The RDRAND equivalent compiles and executes.

-----

My apologies if this should be reported to Cygwin. I cannot find their bug
reporter. In fact, I can't even find a mailing list to discuss it. Their
mailing list page tells me where *not* to discuss or report bugs, but does not
state where to discuss or report them.


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

* [Bug target/68081] Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step
  2015-10-24 20:38 [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step noloader at gmail dot com
@ 2015-10-24 20:52 ` pinskia at gcc dot gnu.org
  2015-10-24 20:58 ` noloader at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-10-24 20:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Why are you using the builtin directly?  You should be using the intrinsics
form instead.


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

* [Bug target/68081] Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step
  2015-10-24 20:38 [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step noloader at gmail dot com
  2015-10-24 20:52 ` [Bug target/68081] " pinskia at gcc dot gnu.org
@ 2015-10-24 20:58 ` noloader at gmail dot com
  2015-10-24 21:11 ` noloader at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: noloader at gmail dot com @ 2015-10-24 20:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081

--- Comment #2 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> Why are you using the builtin directly?  You should be using the intrinsics
> form instead.

Its a cross product of (1) that's what the docs tell me to use for RDRAND and
(2) lack of documentation for RDSEED.

The doc I am referring to is
http://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html#x86-Built-in-Functions
lists. It tells me to use "__builtin_ia32_rdrand{16|32|64}_step" for RDRAND.
But it does not tell me what to use for RDSEED. I made the leap I should use
the *_rdseed variants for RDSEED.

(My apologies for the literal read. If I should be doing something different,
then I need to be told to do so :)


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

* [Bug target/68081] Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step
  2015-10-24 20:38 [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step noloader at gmail dot com
  2015-10-24 20:52 ` [Bug target/68081] " pinskia at gcc dot gnu.org
  2015-10-24 20:58 ` noloader at gmail dot com
@ 2015-10-24 21:11 ` noloader at gmail dot com
  2015-10-25  8:09 ` glisse at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: noloader at gmail dot com @ 2015-10-24 21:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081

--- Comment #3 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Jeffrey Walton from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > Why are you using the builtin directly?  You should be using the intrinsics
> > form instead.
> 
> Its a cross product of (1) that's what the docs tell me to use for RDRAND
> and (2) lack of documentation for RDSEED.
> 
> The doc I am referring to is
> http://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html#x86-Built-in-
> Functions lists. It tells me to use "__builtin_ia32_rdrand{16|32|64}_step"
> for RDRAND. But it does not tell me what to use for RDSEED. I made the leap
> I should use the *_rdseed variants for RDSEED.
> 
> (My apologies for the literal read. If I should be doing something
> different, then I need to be told to do so :)

By the way, I tried to find RDRAND and RDSEED intrinsic functions in the past:
http://www.google.com/search?q=RDRAND+intrinsic+site:gnu.org . The best I can
tell, they are undocumented.

I did find H.J. Lu's patches that provide __builtin_ia32_rdseed{X}_step, so I
used them instead. They are documented, so I used them.

Its very important (to me) to find provenance in vendor documentation.


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

* [Bug target/68081] Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step
  2015-10-24 20:38 [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step noloader at gmail dot com
                   ` (2 preceding siblings ...)
  2015-10-24 21:11 ` noloader at gmail dot com
@ 2015-10-25  8:09 ` glisse at gcc dot gnu.org
  2015-10-25 10:44 ` noloader at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-10-25  8:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
For intrinsics, gcc mostly considers Intel as the standard, so the
documentation would be https://software.intel.com/en-us/node/523865 .


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

* [Bug target/68081] Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step
  2015-10-24 20:38 [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step noloader at gmail dot com
                   ` (3 preceding siblings ...)
  2015-10-25  8:09 ` glisse at gcc dot gnu.org
@ 2015-10-25 10:44 ` noloader at gmail dot com
  2015-10-25 12:08 ` glisse at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: noloader at gmail dot com @ 2015-10-25 10:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081

--- Comment #5 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Marc Glisse from comment #4)
> For intrinsics, gcc mostly considers Intel as the standard, so the
> documentation would be https://software.intel.com/en-us/node/523865 .

Thanks Andrew.

Please don't take this in an argumentative manner... Intel is aggressive at
times with respect to anti-competivie practices. Intel builds software that is
fast for its processors, and slow or non-existent for other maker's CPUs.
Microsoft uses Intel intrinsics too, and they even link back to the Intel docs.
Microsoft has lots of footnotes that effectively state "does not work with AMD
CPUs". Confer, check out the use of footnote [2] at
http://msdn.microsoft.com/en-us/library/hh977022.aspx.

Does GCC arbitrarily penalize AMD? Should I just do this in ASM and forgo
builtins/intrinsics?

I had to do it in ASM on Microsoft platforms precisely because of the
anti-competivie practices percolated up from Intel. And using the documented
GCC functions is proving to be more trouble than its worth. I just checked
another Cygwin installation providing X86, and it can't compile the program
either. A copy/paste of the code into NASM is not a hardship.


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

* [Bug target/68081] Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step
  2015-10-24 20:38 [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step noloader at gmail dot com
                   ` (4 preceding siblings ...)
  2015-10-25 10:44 ` noloader at gmail dot com
@ 2015-10-25 12:08 ` glisse at gcc dot gnu.org
  2015-10-25 12:39 ` noloader at gmail dot com
  2021-04-03 10:22 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-10-25 12:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081

--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
This comment makes no sense (sorry, couldn't find a nice way to say it).

> Intel builds software

We are talking about gcc, not Intel software. Documentation is not fast or
slow.

> Microsoft has lots of footnotes

Those aren't footnotes.

> that effectively state "does not work with AMD CPUs".

And they have [1] for intrinsics that only work with AMD, not Intel.

> Does GCC arbitrarily penalize AMD?

In what way is anyone penalizing AMD here? Intrinsics are an interface to get
access to specific hardware instructions. They are mostly equivalent to a
suitable inline asm written by knowledgeable compiler writers. Like asm, they
only work on hardware that does provide said instruction. AVX2 intrinsics will
fail on older Intel CPUs. Gcc also provides intrinsics that currently only work
on some AMD CPUs.

> And using the documented GCC functions is proving to be more trouble than its worth.

I was never in favor of documenting those builtins, it makes people believe
that they can use them...


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

* [Bug target/68081] Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step
  2015-10-24 20:38 [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step noloader at gmail dot com
                   ` (5 preceding siblings ...)
  2015-10-25 12:08 ` glisse at gcc dot gnu.org
@ 2015-10-25 12:39 ` noloader at gmail dot com
  2021-04-03 10:22 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: noloader at gmail dot com @ 2015-10-25 12:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081

--- Comment #7 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Marc Glisse from comment #6)
> This comment makes no sense (sorry, couldn't find a nice way to say it).
> 
> > Intel builds software
> 
> We are talking about gcc, not Intel software. Documentation is not fast or
> slow.

Yeah, I can understand how it can be confusing. One thing I know is Intel now
documents some of the penalties for using AMD. The FTC required it in their
settlement.

How can we determine what applies, and what does not apply, from the various
Intel docs?

Maybe it would be better if GCC just documented things on its own, and stopped
relying on outside documentation?

> ...
> I was never in favor of documenting those builtins, it makes people believe
> that they can use them...

I thought I was allowed to use documented functions; and I was not supposed to
use undocumented ones. Yeah, this seems to be turned on its head :)


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

* [Bug target/68081] Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step
  2015-10-24 20:38 [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step noloader at gmail dot com
                   ` (6 preceding siblings ...)
  2015-10-25 12:39 ` noloader at gmail dot com
@ 2021-04-03 10:22 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-03 10:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68081

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Can this be closed as invalid? The program can't compile because it tries to
use something that doesn't exist, which is not a GCC bug.

(In reply to Jeffrey Walton from comment #7)
> I thought I was allowed to use documented functions; and I was not supposed
> to use undocumented ones. Yeah, this seems to be turned on its head :)

Many built-in functions are documented so that authors of other compilers and
other tools (like static analysis checkers) can implement the same thing in a
compatible way. That doesn't mean users are supposed to use them directly.

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

end of thread, other threads:[~2021-04-03 10:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-24 20:38 [Bug c/68081] New: Cygwin GCC cannot compile program that uses __builtin_ia32_rdseed64_step noloader at gmail dot com
2015-10-24 20:52 ` [Bug target/68081] " pinskia at gcc dot gnu.org
2015-10-24 20:58 ` noloader at gmail dot com
2015-10-24 21:11 ` noloader at gmail dot com
2015-10-25  8:09 ` glisse at gcc dot gnu.org
2015-10-25 10:44 ` noloader at gmail dot com
2015-10-25 12:08 ` glisse at gcc dot gnu.org
2015-10-25 12:39 ` noloader at gmail dot com
2021-04-03 10:22 ` redi at gcc dot gnu.org

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