Skip to content

Commit ee6c5af

Browse files
committed
x86: Don't enable APX_F in 32-bit mode
gcc/ChangeLog: PR target/115978 * config/i386/driver-i386.cc (host_detect_local_cpu): Enable APX_F only for 64-bit codegen. * config/i386/i386-options.cc (DEF_PTA): Skip PTA_APX_F if not in 64-bit mode. gcc/testsuite/ChangeLog: PR target/115978 * gcc.target/i386/pr115978-1.c: New test. * gcc.target/i386/pr115978-2.c: Ditto.
1 parent 7c688e0 commit ee6c5af

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

gcc/config/i386/driver-i386.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,8 @@ const char *host_detect_local_cpu (int argc, const char **argv)
893893
if (has_feature (isa_names_table[i].feature))
894894
{
895895
if (codegen_x86_64
896-
|| isa_names_table[i].feature != FEATURE_UINTR)
896+
|| (isa_names_table[i].feature != FEATURE_UINTR
897+
&& isa_names_table[i].feature != FEATURE_APX_F))
897898
options = concat (options, " ",
898899
isa_names_table[i].option, NULL);
899900
}

gcc/config/i386/i386-options.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2385,7 +2385,8 @@ ix86_option_override_internal (bool main_args_p,
23852385
#define DEF_PTA(NAME) \
23862386
if (((processor_alias_table[i].flags & PTA_ ## NAME) != 0) \
23872387
&& PTA_ ## NAME != PTA_64BIT \
2388-
&& (TARGET_64BIT || PTA_ ## NAME != PTA_UINTR) \
2388+
&& (TARGET_64BIT || (PTA_ ## NAME != PTA_UINTR \
2389+
&& PTA_ ## NAME != PTA_APX_F))\
23892390
&& !TARGET_EXPLICIT_ ## NAME ## _P (opts)) \
23902391
SET_TARGET_ ## NAME (opts);
23912392
#include "i386-isa.def"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* { dg-do run } */
2+
/* { dg-options "-O2 -march=native" } */
3+
4+
int
5+
main ()
6+
{
7+
if (__builtin_cpu_supports ("apxf"))
8+
{
9+
#ifdef __x86_64__
10+
# ifndef __APX_F__
11+
__builtin_abort ();
12+
# endif
13+
#else
14+
# ifdef __APX_F__
15+
__builtin_abort ();
16+
# endif
17+
#endif
18+
return 0;
19+
}
20+
21+
return 0;
22+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* { dg-do compile } */
2+
/* { dg-options "-O2 -march=native -mno-apxf" } */
3+
4+
#ifdef __APX_F__
5+
# error APX_F should be disabled
6+
#endif

0 commit comments

Comments
 (0)