Commit 8feb61a3 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/90096 (Misleading option hint for AVX intrinsics)

	PR target/90096
	* config/i386/i386.c (ix86_target_string): Add ADD_ABI_P argument, only
	print -m64/-mx32/-m32 if it is true.
	(ix86_debug_options, ix86_function_specific_print): Pass true as
	ADD_ABI_P to ix86_target_string.
	(ix86_expand_builtin): Adjust ix86_target_string caller, pass true as
	ADD_ABI_P only if OPTION_MASK_ISA_64BIT is set in bisa and in that case
	or into it OPTION_MASK_ISA_ABI_64 or OPTION_MASK_ISA_ABI_X32.

	* gcc.target/i386/pr90096.c: New test.
	* gcc.target/i386/pr69255-1.c: Adjust expected diagnostics.
	* gcc.target/i386/pr69255-2.c: Likewise.
	* gcc.target/i386/pr69255-3.c: Likewise.

From-SVN: r270381
parent 234b5365
2019-04-16 Jakub Jelinek <jakub@redhat.com> 2019-04-16 Jakub Jelinek <jakub@redhat.com>
PR target/90096
* config/i386/i386.c (ix86_target_string): Add ADD_ABI_P argument, only
print -m64/-mx32/-m32 if it is true.
(ix86_debug_options, ix86_function_specific_print): Pass true as
ADD_ABI_P to ix86_target_string.
(ix86_expand_builtin): Adjust ix86_target_string caller, pass true as
ADD_ABI_P only if OPTION_MASK_ISA_64BIT is set in bisa and in that case
or into it OPTION_MASK_ISA_ABI_64 or OPTION_MASK_ISA_ABI_X32.
PR rtl-optimization/90082 PR rtl-optimization/90082
* dce.c (can_delete_call): New function. * dce.c (can_delete_call): New function.
(deletable_insn_p, mark_insn): Use it. (deletable_insn_p, mark_insn): Use it.
......
...@@ -838,7 +838,7 @@ enum ix86_function_specific_strings ...@@ -838,7 +838,7 @@ enum ix86_function_specific_strings
static char *ix86_target_string (HOST_WIDE_INT, HOST_WIDE_INT, int, int, static char *ix86_target_string (HOST_WIDE_INT, HOST_WIDE_INT, int, int,
const char *, const char *, enum fpmath_unit, const char *, const char *, enum fpmath_unit,
bool); bool, bool);
static void ix86_function_specific_save (struct cl_target_option *, static void ix86_function_specific_save (struct cl_target_option *,
struct gcc_options *opts); struct gcc_options *opts);
static void ix86_function_specific_restore (struct gcc_options *opts, static void ix86_function_specific_restore (struct gcc_options *opts,
...@@ -2928,7 +2928,7 @@ static char * ...@@ -2928,7 +2928,7 @@ static char *
ix86_target_string (HOST_WIDE_INT isa, HOST_WIDE_INT isa2, ix86_target_string (HOST_WIDE_INT isa, HOST_WIDE_INT isa2,
int flags, int flags2, int flags, int flags2,
const char *arch, const char *tune, const char *arch, const char *tune,
enum fpmath_unit fpmath, bool add_nl_p) enum fpmath_unit fpmath, bool add_nl_p, bool add_abi_p)
{ {
struct ix86_target_opts struct ix86_target_opts
{ {
...@@ -3095,19 +3095,20 @@ ix86_target_string (HOST_WIDE_INT isa, HOST_WIDE_INT isa2, ...@@ -3095,19 +3095,20 @@ ix86_target_string (HOST_WIDE_INT isa, HOST_WIDE_INT isa2,
} }
/* Add -m32/-m64/-mx32. */ /* Add -m32/-m64/-mx32. */
if ((isa & OPTION_MASK_ISA_64BIT) != 0) if (add_abi_p)
{ {
if ((isa & OPTION_MASK_ABI_64) != 0) if ((isa & OPTION_MASK_ISA_64BIT) != 0)
abi = "-m64"; {
if ((isa & OPTION_MASK_ABI_64) != 0)
abi = "-m64";
else
abi = "-mx32";
}
else else
abi = "-mx32"; abi = "-m32";
isa &= ~ (OPTION_MASK_ISA_64BIT opts[num++][0] = abi;
| OPTION_MASK_ABI_64
| OPTION_MASK_ABI_X32);
} }
else isa &= ~(OPTION_MASK_ISA_64BIT | OPTION_MASK_ABI_64 | OPTION_MASK_ABI_X32);
abi = "-m32";
opts[num++][0] = abi;
/* Pick out the options in isa2 options. */ /* Pick out the options in isa2 options. */
for (i = 0; i < ARRAY_SIZE (isa2_opts); i++) for (i = 0; i < ARRAY_SIZE (isa2_opts); i++)
...@@ -3269,7 +3270,7 @@ ix86_debug_options (void) ...@@ -3269,7 +3270,7 @@ ix86_debug_options (void)
char *opts = ix86_target_string (ix86_isa_flags, ix86_isa_flags2, char *opts = ix86_target_string (ix86_isa_flags, ix86_isa_flags2,
target_flags, ix86_target_flags, target_flags, ix86_target_flags,
ix86_arch_string,ix86_tune_string, ix86_arch_string,ix86_tune_string,
ix86_fpmath, true); ix86_fpmath, true, true);
if (opts) if (opts)
{ {
...@@ -5121,7 +5122,7 @@ ix86_function_specific_print (FILE *file, int indent, ...@@ -5121,7 +5122,7 @@ ix86_function_specific_print (FILE *file, int indent,
char *target_string char *target_string
= ix86_target_string (ptr->x_ix86_isa_flags, ptr->x_ix86_isa_flags2, = ix86_target_string (ptr->x_ix86_isa_flags, ptr->x_ix86_isa_flags2,
ptr->x_target_flags, ptr->x_ix86_target_flags, ptr->x_target_flags, ptr->x_ix86_target_flags,
NULL, NULL, ptr->x_ix86_fpmath, false); NULL, NULL, ptr->x_ix86_fpmath, false, true);
gcc_assert (ptr->arch < PROCESSOR_max); gcc_assert (ptr->arch < PROCESSOR_max);
fprintf (file, "%*sarch = %d (%s)\n", fprintf (file, "%*sarch = %d (%s)\n",
...@@ -36709,8 +36710,13 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, ...@@ -36709,8 +36710,13 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
isa |= (OPTION_MASK_ISA_FMA | OPTION_MASK_ISA_FMA4); isa |= (OPTION_MASK_ISA_FMA | OPTION_MASK_ISA_FMA4);
if ((bisa & isa) != bisa || (bisa2 & isa2) != bisa2) if ((bisa & isa) != bisa || (bisa2 & isa2) != bisa2)
{ {
bool add_abi_p = bisa & OPTION_MASK_ISA_64BIT;
if (TARGET_ABI_X32)
bisa |= OPTION_MASK_ABI_X32;
else
bisa |= OPTION_MASK_ABI_64;
char *opts = ix86_target_string (bisa, bisa2, 0, 0, NULL, NULL, char *opts = ix86_target_string (bisa, bisa2, 0, 0, NULL, NULL,
(enum fpmath_unit) 0, false); (enum fpmath_unit) 0, false, add_abi_p);
if (!opts) if (!opts)
error ("%qE needs unknown isa option", fndecl); error ("%qE needs unknown isa option", fndecl);
else else
2019-04-16 Jakub Jelinek <jakub@redhat.com> 2019-04-16 Jakub Jelinek <jakub@redhat.com>
PR target/90096
* gcc.target/i386/pr90096.c: New test.
* gcc.target/i386/pr69255-1.c: Adjust expected diagnostics.
* gcc.target/i386/pr69255-2.c: Likewise.
* gcc.target/i386/pr69255-3.c: Likewise.
PR rtl-optimization/90082 PR rtl-optimization/90082
* gcc.dg/pr90082.c: New test. * gcc.dg/pr90082.c: New test.
......
...@@ -12,7 +12,7 @@ __attribute__ ((__vector_size__ (16))) int b; ...@@ -12,7 +12,7 @@ __attribute__ ((__vector_size__ (16))) int b;
void void
foo (const long long *p) foo (const long long *p)
{ {
a = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ a = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -mavx512vl" } */
/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } .-1 } */ /* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } .-1 } */
/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } .-2 } */ /* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } .-2 } */
} }
...@@ -13,7 +13,7 @@ void ...@@ -13,7 +13,7 @@ void
foo (const long long *p) foo (const long long *p)
{ {
volatile __attribute__ ((__vector_size__ (32))) long long c; volatile __attribute__ ((__vector_size__ (32))) long long c;
c = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ c = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -mavx512vl" } */
/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } .-1 } */ /* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } .-1 } */
/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } .-2 } */ /* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } .-2 } */
} }
...@@ -12,7 +12,7 @@ __attribute__ ((__vector_size__ (16))) int b; ...@@ -12,7 +12,7 @@ __attribute__ ((__vector_size__ (16))) int b;
void void
foo (const long long *p, __attribute__ ((__vector_size__ (32))) long long *q) foo (const long long *p, __attribute__ ((__vector_size__ (32))) long long *q)
{ {
*q = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ *q = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -mavx512vl" } */
/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } .-1 } */ /* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } .-1 } */
/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } .-2 } */ /* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } .-2 } */
} }
/* PR target/90096 */
/* { dg-do compile } */
/* { dg-options "-O0 -mno-gfni -mno-avx512f -Wno-psabi" } */
#include <x86intrin.h>
volatile __m512i x1, x2;
volatile __mmask64 m64;
void
foo (int i)
{
x1 = _mm512_gf2p8affineinv_epi64_epi8 (x1, x2, 3); /* { dg-error "needs isa option -mgfni -mavx512f" } */
}
#ifdef __x86_64__
unsigned long long
bar (__m128 *p)
{
return _mm_cvtt_roundss_u64 (*p, _MM_FROUND_TO_ZERO |_MM_FROUND_NO_EXC);
/* { dg-error "needs isa option -m64 -mavx512f" "" { target lp64 } .-1 } */
/* { dg-error "needs isa option -mx32 -mavx512f" "" { target x32 } .-1 } */
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment