public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/67994] New: __attribute__ ((target("arch=XXX"))) enables unsupported ISA
Date: Fri, 16 Oct 2015 18:32:00 -0000	[thread overview]
Message-ID: <bug-67994-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 67994
           Summary: __attribute__ ((target("arch=XXX"))) enables
                    unsupported ISA
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: ubizjak at gmail dot com
  Target Milestone: ---

[hjl@gnu-6 pr67985]$ cat r.i
unsigned int
__attribute__ ((target("arch=core2")))
__x86_rdrand(void)
{
  unsigned int retries = 100;
  unsigned int val;

  while (__builtin_ia32_rdrand32_step(&val) == 0)
    if (--retries == 0)
      return 0;

  return val;
}
[hjl@gnu-6 pr67985]$ /export/build/gnu/gcc-test/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-test/build-x86_64-linux/gcc/ -O2 -march=haswell -S -o
r.s r.i
[hjl@gnu-6 pr67985]$ cat r.s
        .file   "r.i"
        .text
        .p2align 4,,15
        .globl  __x86_rdrand
        .type   __x86_rdrand, @function
__x86_rdrand:
.LFB0:
        .cfi_startproc
        movl    $100, %eax
        movl    $1, %ecx
        jmp     .L2
        .p2align 4
.L4:
        subl    $1, %eax
        je      .L8
.L2:
        rdrand  %edx
        movl    %edx, -4(%rsp)
        cmovc   %ecx, %edx
        testl   %edx, %edx
        je      .L4
        movl    -4(%rsp), %eax
.L8:
        ret
        .cfi_endproc
.LFE0:
        .size   __x86_rdrand, .-__x86_rdrand
        .ident  "GCC: (GNU) 6.0.0 20151016 (experimental)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-6 pr67985]$ 

There should be a warning since rdrand isn't supported on Intel Core 2.


             reply	other threads:[~2015-10-16 18:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 18:32 hjl.tools at gmail dot com [this message]
2015-10-17 13:02 ` [Bug target/67994] " hjl.tools at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-67994-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).