Commit 94cdd3b7 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/90867 (Multiplication or typecast of integer and double always zero when...)

	PR target/90867
	* config/i386/i386-options.c (ix86_valid_target_attribute_tree): Don't
	clear opts->x_ix86_isa_flags{,2} here...
	(ix86_valid_target_attribute_inner_p): ... but here when seeing
	arch=.  Also clear opts->x_ix86_isa_flags{,2}_explicit.

	* gcc.target/i386/pr90867.c: New test.

From-SVN: r278482
parent 7313f6cf
2019-11-20 Jakub Jelinek <jakub@redhat.com>
PR target/90867
* config/i386/i386-options.c (ix86_valid_target_attribute_tree): Don't
clear opts->x_ix86_isa_flags{,2} here...
(ix86_valid_target_attribute_inner_p): ... but here when seeing
arch=. Also clear opts->x_ix86_isa_flags{,2}_explicit.
PR c/90898
* tree-ssa-ccp.c (insert_clobber_before_stack_restore): Remove
assertion.
......@@ -1147,7 +1147,25 @@ ix86_valid_target_attribute_inner_p (tree fndecl, tree args, char *p_strings[],
ret = false;
}
else
p_strings[opt] = xstrdup (p + opt_len);
{
p_strings[opt] = xstrdup (p + opt_len);
if (opt == IX86_FUNCTION_SPECIFIC_ARCH)
{
/* If arch= is set, clear all bits in x_ix86_isa_flags,
except for ISA_64BIT, ABI_64, ABI_X32, and CODE16
and all bits in x_ix86_isa_flags2. */
opts->x_ix86_isa_flags &= (OPTION_MASK_ISA_64BIT
| OPTION_MASK_ABI_64
| OPTION_MASK_ABI_X32
| OPTION_MASK_CODE16);
opts->x_ix86_isa_flags_explicit &= (OPTION_MASK_ISA_64BIT
| OPTION_MASK_ABI_64
| OPTION_MASK_ABI_X32
| OPTION_MASK_CODE16);
opts->x_ix86_isa_flags2 = 0;
opts->x_ix86_isa_flags2_explicit = 0;
}
}
}
else if (type == ix86_opt_enum)
......@@ -1225,18 +1243,8 @@ ix86_valid_target_attribute_tree (tree fndecl, tree args,
/* If we are using the default tune= or arch=, undo the string assigned,
and use the default. */
if (option_strings[IX86_FUNCTION_SPECIFIC_ARCH])
{
opts->x_ix86_arch_string
= ggc_strdup (option_strings[IX86_FUNCTION_SPECIFIC_ARCH]);
/* If arch= is set, clear all bits in x_ix86_isa_flags,
except for ISA_64BIT, ABI_64, ABI_X32, and CODE16. */
opts->x_ix86_isa_flags &= (OPTION_MASK_ISA_64BIT
| OPTION_MASK_ABI_64
| OPTION_MASK_ABI_X32
| OPTION_MASK_CODE16);
opts->x_ix86_isa_flags2 = 0;
}
opts->x_ix86_arch_string
= ggc_strdup (option_strings[IX86_FUNCTION_SPECIFIC_ARCH]);
else if (!orig_arch_specified)
opts->x_ix86_arch_string = NULL;
......
2019-11-20 Jakub Jelinek <jakub@redhat.com>
PR target/90867
* gcc.target/i386/pr90867.c: New test.
PR c/90898
* gcc.dg/pr90898.c: New test.
......
/* PR target/90867 */
/* { dg-do run { target lp64 } } */
/* { dg-options "-O2 -msse2" } */
unsigned long long freq = 3600000000UL; /* 3.6 GHz = 3600.0 MHz */
__attribute__((noipa)) void
bar (double x)
{
static double d = 3600000000.0;
if (x != d)
__builtin_abort ();
d /= 1000.0;
}
__attribute__ ((target ("arch=x86-64"))) int
foo ()
{
bar ((double) freq);
bar (1e-3 * freq);
bar (1e-6 * freq);
bar (1e-9 * freq);
return 0;
}
int
main ()
{
return foo ();
}
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