public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/67995] New: __attribute__ ((target("arch=XXX"))) enables unsupported ISA
@ 2015-10-16 18:33 hjl.tools at gmail dot com
2015-10-16 18:56 ` [Bug target/67995] " hjl.tools at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2015-10-16 18:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67995
Bug ID: 67995
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
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/67995] __attribute__ ((target("arch=XXX"))) enables unsupported ISA
2015-10-16 18:33 [Bug target/67995] New: __attribute__ ((target("arch=XXX"))) enables unsupported ISA hjl.tools at gmail dot com
@ 2015-10-16 18:56 ` hjl.tools at gmail dot com
2015-10-17 13:02 ` hjl.tools at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2015-10-16 18:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67995
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 36532
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36532&action=edit
A patch
I am testing this patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/67995] __attribute__ ((target("arch=XXX"))) enables unsupported ISA
2015-10-16 18:33 [Bug target/67995] New: __attribute__ ((target("arch=XXX"))) enables unsupported ISA hjl.tools at gmail dot com
2015-10-16 18:56 ` [Bug target/67995] " hjl.tools at gmail dot com
@ 2015-10-17 13:02 ` hjl.tools at gmail dot com
2015-10-19 11:18 ` hjl at gcc dot gnu.org
2015-10-19 11:46 ` hjl.tools at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2015-10-17 13:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67995
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
*** Bug 67994 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/67995] __attribute__ ((target("arch=XXX"))) enables unsupported ISA
2015-10-16 18:33 [Bug target/67995] New: __attribute__ ((target("arch=XXX"))) enables unsupported ISA hjl.tools at gmail dot com
2015-10-16 18:56 ` [Bug target/67995] " hjl.tools at gmail dot com
2015-10-17 13:02 ` hjl.tools at gmail dot com
@ 2015-10-19 11:18 ` hjl at gcc dot gnu.org
2015-10-19 11:46 ` hjl.tools at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: hjl at gcc dot gnu.org @ 2015-10-19 11:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67995
--- Comment #3 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Mon Oct 19 11:18:14 2015
New Revision: 228967
URL: https://gcc.gnu.org/viewcvs?rev=228967&root=gcc&view=rev
Log:
Don't leak ISA to __attribute__ ((target("arch=XXX")))
When processing __attribute__ ((target("arch=XXX"))), we should clear
the ISA bits in x_ix86_isa_flags first to avoid leaking ISA from
command line.
gcc/
PR target/67995
* config/i386/i386.c (ix86_valid_target_attribute_tree): If
arch= is set, clear all bits in x_ix86_isa_flags, except for
ISA_64BIT, ABI_64, ABI_X32, and CODE16.
gcc/testsuite/
PR target/67995
* gcc.target/i386/pr67995-1.c: New test.
* gcc.target/i386/pr67995-2.c: Likewise.
* gcc.target/i386/pr67995-3.c: Likewise.
Added:
trunk/gcc/testsuite/gcc.target/i386/pr67995-1.c
trunk/gcc/testsuite/gcc.target/i386/pr67995-2.c
trunk/gcc/testsuite/gcc.target/i386/pr67995-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/67995] __attribute__ ((target("arch=XXX"))) enables unsupported ISA
2015-10-16 18:33 [Bug target/67995] New: __attribute__ ((target("arch=XXX"))) enables unsupported ISA hjl.tools at gmail dot com
` (2 preceding siblings ...)
2015-10-19 11:18 ` hjl at gcc dot gnu.org
@ 2015-10-19 11:46 ` hjl.tools at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2015-10-19 11:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67995
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-10-19
Known to work| |6.0
Ever confirmed|0 |1
Known to fail| |4.9.4, 5.3.0
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-19 11:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-16 18:33 [Bug target/67995] New: __attribute__ ((target("arch=XXX"))) enables unsupported ISA hjl.tools at gmail dot com
2015-10-16 18:56 ` [Bug target/67995] " hjl.tools at gmail dot com
2015-10-17 13:02 ` hjl.tools at gmail dot com
2015-10-19 11:18 ` hjl at gcc dot gnu.org
2015-10-19 11:46 ` hjl.tools at gmail dot com
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).