public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/gcc-9)] re PR target/90867 (Multiplication or typecast of integer and double always zero when...)
@ 2020-02-04 20:58 Peter Bergner
  0 siblings, 0 replies; only message in thread
From: Peter Bergner @ 2020-02-04 20:58 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a52713cbf0d5e8f6735798b6163634fe182b3a67

commit a52713cbf0d5e8f6735798b6163634fe182b3a67
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Nov 20 10:54:02 2019 +0100

    re PR target/90867 (Multiplication or typecast of integer and double always zero when...)
    
    	PR target/90867
    	* config/i386/i386.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: r278490

Diff:
---
 gcc/ChangeLog                           |  6 ++++++
 gcc/config/i386/i386.c                  | 34 ++++++++++++++++++++-------------
 gcc/testsuite/ChangeLog                 |  3 +++
 gcc/testsuite/gcc.target/i386/pr90867.c | 30 +++++++++++++++++++++++++++++
 4 files changed, 60 insertions(+), 13 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 83766ae..8fff114 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
 2019-11-20  Jakub Jelinek  <jakub@redhat.com>
 
+	PR target/90867
+	* config/i386/i386.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.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 73a3ef3..ce3fbd1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5423,7 +5423,25 @@ ix86_valid_target_attribute_inner_p (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)
@@ -5498,18 +5516,8 @@ ix86_valid_target_attribute_tree (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;
 
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a0b764d..9f6b7c8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
 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.
 
diff --git a/gcc/testsuite/gcc.target/i386/pr90867.c b/gcc/testsuite/gcc.target/i386/pr90867.c
new file mode 100644
index 0000000..1ed96b5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr90867.c
@@ -0,0 +1,30 @@
+/* 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 ();
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-04 20:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 20:58 [gcc(refs/vendors/ibm/heads/gcc-9)] re PR target/90867 (Multiplication or typecast of integer and double always zero when...) Peter Bergner

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).