public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, PR target/65103, 3/3] Change rtx cost for i386 address constants
@ 2015-03-10 15:11 Ilya Enkovich
  2015-03-10 16:14 ` Ilya Enkovich
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Enkovich @ 2015-03-10 15:11 UTC (permalink / raw)
  To: gcc-patches

Hi,

This patch changes rtx cost for address constants to 0 similar to what we have in address cost hook beacuse we expect them to be propagated into address expression anyway.  Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK for trunk or stage 1?

Thanks,
Ilya
--
gcc/

2015-03-10  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR target/65103
	* gcc/config/i386/i386.c (ix86_rtx_costs): We want to propagate
	link time constants into adress expressions and therefore set
	their cost to 0.

gcc/testsuite/

2015-03-10  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR target/65103
	* gcc.target/i386/pr65103-3.c: New.


diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b3971b8..341a157 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -42039,7 +42039,8 @@ ix86_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
 	       && !(TARGET_64BIT
 		    && (GET_CODE (x) == LABEL_REF
 			|| (GET_CODE (x) == SYMBOL_REF
-			    && SYMBOL_REF_LOCAL_P (x)))))
+			    && SYMBOL_REF_LOCAL_P (x))))
+	       && (TARGET_64BIT || GET_CODE (x) != CONST))
 	*total = 1;
       else
 	*total = 0;
diff --git a/gcc/testsuite/gcc.target/i386/pr65103-3.c b/gcc/testsuite/gcc.target/i386/pr65103-3.c
new file mode 100644
index 0000000..1481bf9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr65103-3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-m32 -O2 -fPIE" } */
+/* { dg-final { scan-assembler-not "GOTOFF," } } */
+
+static int *data[100];
+
+void test (long a, long b)
+{
+  do
+    {
+      if( a < b )
+        {
+	  data[a] = data[b];
+	  a++;
+        }
+    }
+  while (a <= b);
+}

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH, PR target/65103, 3/3] Change rtx cost for i386 address constants
@ 2015-05-12 15:47 Uros Bizjak
  2015-05-13  8:39 ` Ilya Enkovich
  0 siblings, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2015-05-12 15:47 UTC (permalink / raw)
  To: gcc-patches
  Cc: Илья
	Энкович

Hello!

>> 2015-03-10  Ilya Enkovich  <ilya.enkovich@intel.com>
>>
>>         PR target/65103
>>         * config/i386/i386.c (ix86_rtx_costs): We want to propagate
>>         link time constants into adress expressions and therefore set
>>         their cost to 0.
>>
>> gcc/testsuite/
>>
>> 2015-03-10  Ilya Enkovich  <ilya.enkovich@intel.com>
>>
>>         PR target/65103
>>         * gcc.target/i386/pr65103-3.c: New.
>>
>>
>> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
>> index b3971b8..341a157 100644
>> --- a/gcc/config/i386/i386.c
>> +++ b/gcc/config/i386/i386.c
>> @@ -42039,7 +42039,8 @@ ix86_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
>>                && !(TARGET_64BIT
>>                     && (GET_CODE (x) == LABEL_REF
>>                         || (GET_CODE (x) == SYMBOL_REF
>> -                           && SYMBOL_REF_LOCAL_P (x)))))
>> +                           && SYMBOL_REF_LOCAL_P (x))))
>> +              && (TARGET_64BIT || GET_CODE (x) != CONST))

Please also add a one-line comment for the new condition.

OK with this change.

Uros.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-13  8:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-10 15:11 [PATCH, PR target/65103, 3/3] Change rtx cost for i386 address constants Ilya Enkovich
2015-03-10 16:14 ` Ilya Enkovich
2015-05-12 14:43   ` Ilya Enkovich
2015-05-12 15:47 Uros Bizjak
2015-05-13  8:39 ` Ilya Enkovich

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