Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: gcc/libgfortran/m4/maxloc0.m4

Issue 3050029: [gcc] GCC 4.5.0=>4.5.1 (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-toolchain.git
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gcc/libgfortran/m4/matmull.m4 ('k') | gcc/libgfortran/m4/maxval.m4 » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcc/libgfortran/m4/maxloc0.m4
diff --git a/gcc/libgfortran/m4/maxloc0.m4 b/gcc/libgfortran/m4/maxloc0.m4
index ce56ab44d143ebfd92625b155a52f8601b31616d..aef7b9b8dc75fac059b08594a1415ce5c97e10c1 100644
--- a/gcc/libgfortran/m4/maxloc0.m4
+++ b/gcc/libgfortran/m4/maxloc0.m4
@@ -34,28 +34,93 @@ include(iforeach.m4)dnl
`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
FOREACH_FUNCTION(
-` atype_name maxval;
+` atype_name maxval;
+#if defined('atype_nan`)
+ int fast = 0;
+#endif
- maxval = atype_min;'
-,
-` if (*base > maxval || !dest[0])
- {
- maxval = *base;
- for (n = 0; n < rank; n++)
- dest[n * dstride] = count[n] + 1;
- }')
+#if defined('atype_inf`)
+ maxval = -atype_inf;
+#else
+ maxval = atype_min;
+#endif',
+`#if defined('atype_nan`)
+ }
+ while (0);
+ if (unlikely (!fast))
+ {
+ do
+ {
+ if (*base >= maxval)
+ {
+ fast = 1;
+ maxval = *base;
+ for (n = 0; n < rank; n++)
+ dest[n * dstride] = count[n] + 1;
+ break;
+ }
+ base += sstride[0];
+ }
+ while (++count[0] != extent[0]);
+ if (likely (fast))
+ continue;
+ }
+ else do
+ {
+#endif
+ if (*base > maxval)
+ {
+ maxval = *base;
+ for (n = 0; n < rank; n++)
+ dest[n * dstride] = count[n] + 1;
+ }')
MASKED_FOREACH_FUNCTION(
` atype_name maxval;
+ int fast = 0;
- maxval = atype_min;'
-,
-` if (*mbase && (*base > maxval || !dest[0]))
- {
- maxval = *base;
- for (n = 0; n < rank; n++)
- dest[n * dstride] = count[n] + 1;
- }')
+#if defined('atype_inf`)
+ maxval = -atype_inf;
+#else
+ maxval = atype_min;
+#endif',
+` }
+ while (0);
+ if (unlikely (!fast))
+ {
+ do
+ {
+ if (*mbase)
+ {
+#if defined('atype_nan`)
+ if (unlikely (dest[0] == 0))
+ for (n = 0; n < rank; n++)
+ dest[n * dstride] = count[n] + 1;
+ if (*base >= maxval)
+#endif
+ {
+ fast = 1;
+ maxval = *base;
+ for (n = 0; n < rank; n++)
+ dest[n * dstride] = count[n] + 1;
+ break;
+ }
+ }
+ base += sstride[0];
+ mbase += mstride[0];
+ }
+ while (++count[0] != extent[0]);
+ if (likely (fast))
+ continue;
+ }
+ else do
+ {
+ if (*mbase && *base > maxval)
+ {
+ maxval = *base;
+ for (n = 0; n < rank; n++)
+ dest[n * dstride] = count[n] + 1;
+ }')
SCALAR_FOREACH_FUNCTION(`0')
#endif
« no previous file with comments | « gcc/libgfortran/m4/matmull.m4 ('k') | gcc/libgfortran/m4/maxval.m4 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698