Commit f3afc8a7 by Uros Bizjak

driver-i386.c (describe_cache): Optimize concatenation of strings.

	* config/i386/driver-i386.c (describe_cache): Optimize
	concatenation of strings.  Use snprintf instead of sprintf.
	(host_detect_local_cpu): Ditto.  Ignore -march and -mtune for native
	target when not compiling with GCC.

From-SVN: r148115
parent 394e9195
......@@ -46,12 +46,15 @@ describe_cache (struct cache_desc level1, struct cache_desc level2)
/* At the moment, gcc does not use the information
about the associativity of the cache. */
sprintf (size, "--param l1-cache-size=%u", level1.sizekb);
sprintf (line, "--param l1-cache-line-size=%u", level1.line);
snprintf (size, sizeof (size),
"--param l1-cache-size=%u ", level1.sizekb);
snprintf (line, sizeof (line),
"--param l1-cache-line-size=%u ", level1.line);
sprintf (size2, "--param l2-cache-size=%u", level2.sizekb);
snprintf (size2, sizeof (size2),
"--param l2-cache-size=%u ", level2.sizekb);
return concat (size, " ", line, " ", size2, " ", NULL);
return concat (size, line, size2, NULL);
}
/* Detect L2 cache parameters using CPUID extended function 0x80000006. */
......@@ -608,55 +611,38 @@ const char *host_detect_local_cpu (int argc, const char **argv)
if (arch)
{
if (has_cmpxchg16b)
options = concat (options, "-mcx16 ", NULL);
options = concat (options, " -mcx16", NULL);
if (has_lahf_lm)
options = concat (options, "-msahf ", NULL);
options = concat (options, " -msahf", NULL);
if (has_movbe)
options = concat (options, "-mmovbe ", NULL);
options = concat (options, " -mmovbe", NULL);
if (has_aes)
options = concat (options, "-maes ", NULL);
options = concat (options, " -maes", NULL);
if (has_pclmul)
options = concat (options, "-mpclmul ", NULL);
options = concat (options, " -mpclmul", NULL);
if (has_popcnt)
options = concat (options, "-mpopcnt ", NULL);
options = concat (options, " -mpopcnt", NULL);
if (has_avx)
options = concat (options, "-mavx ", NULL);
options = concat (options, " -mavx", NULL);
else if (has_sse4_2)
options = concat (options, "-msse4.2 ", NULL);
options = concat (options, " -msse4.2", NULL);
else if (has_sse4_1)
options = concat (options, "-msse4.1 ", NULL);
options = concat (options, " -msse4.1", NULL);
}
done:
return concat (cache, "-m", argv[0], "=", cpu, " ", options, NULL);
return concat (cache, "-m", argv[0], "=", cpu, options, NULL);
}
#else
/* If we aren't compiling with GCC we just provide a minimal
default value. */
/* If we aren't compiling with GCC then the driver will just ignore
-march and -mtune "native" target and will leave to the newly
built compiler to generate code for its default target. */
const char *host_detect_local_cpu (int argc, const char **argv)
const char *host_detect_local_cpu (int argc ATTRIBUTE_UNUSED,
const char **argv ATTRIBUTE_UNUSED)
{
const char *cpu;
bool arch;
if (argc < 1)
return NULL;
arch = !strcmp (argv[0], "arch");
if (!arch && strcmp (argv[0], "tune"))
return NULL;
if (arch)
{
/* FIXME: i386 is wrong for 64bit compiler. How can we tell if
we are generating 64bit or 32bit code? */
cpu = "i386";
}
else
cpu = "generic";
return concat ("-m", argv[0], "=", cpu, NULL);
}
#endif /* __GNUC__ */
......@@ -154,8 +154,7 @@
2009-05-28 Kai Tietz <kai.tietz@onevision.com>
* g++.dg/ext/packed6.C (size_t): Use __extension__ and
__SIZE_TYPE__.
* g++.dg/ext/packed6.C (size_t): Use __extension__ and __SIZE_TYPE__.
* g++.dg/opt/memcpy1.C (size_t): Likewise.
* g++.dg/pr37742.C (size_t): Likewise.
* g++.dg/torture/pr34850.C (size_t): Likewise.
......@@ -314,7 +313,7 @@
* gcc.dg/vect/pr40238.c: New test.
2009-05-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Dominique Dhumieres
Dominique Dhumieres <dominiq@lps.ens.fr>
PR fortran/35732
PR fortran/39872
......@@ -580,8 +579,10 @@
* gcc.target/i386/align-main-2.c (check): Mark noinline.
* gcc.dg/ipa/ipa-4.c: Disable early inlining.
* gcc.dg/vect/vect-iv-10.c (main1): Mark noinline.
* gcc.dg/vect/costmodel/i386/costmodel-vect-33.c (main1): Mark noinline.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c (main1): Mark noinline.
* gcc.dg/vect/costmodel/i386/costmodel-vect-33.c (main1):
Mark noinline.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c (main1):
Mark noinline.
* gcc.dg/vect/pr31699.c (foo): Mark noinline.
* gcc.dg/vect/pr18400.c (main1): Mark noinline.
......@@ -669,8 +670,8 @@
2009-05-12 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-ssa/loop-36.c: Reduce amount of iterations to 2 so unrolling
still happens.
* gcc.dg/tree-ssa/loop-36.c: Reduce amount of iterations to 2
so unrolling still happens.
* gcc.dg/ipa/ipacost-1.c: Prevent inlining
* gcc.dg/ipa/ipacost-2.c: Likewise.
* gcc.dg/vect/slp-3.c: Loop is no longer unrolled.
......
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