sse4_1-roundps-1.c: Remove ASM_SUFFIX define.
[gcc.git] / libgfortran / generated / product_r16.c
index dcad0eda649bed8926c325c5847c3944e0b47061..377bed61e5e4f1c12ecc74315c00ef84a2dc71c0 100644 (file)
@@ -1,8 +1,8 @@
 /* Implementation of the PRODUCT intrinsic
-   Copyright 2002, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2002-2015 Free Software Foundation, Inc.
    Contributed by Paul Brook <paul@nowt.org>
 
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
 
 Libgfortran is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public
@@ -79,7 +79,7 @@ product_r16 (gfc_array_r16 * const restrict retarray,
        extent[n] = 0;
     }
 
-  if (retarray->data == NULL)
+  if (retarray->base_addr == NULL)
     {
       size_t alloc_size, str;
 
@@ -97,9 +97,9 @@ product_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -107,8 +107,6 @@ product_r16 (gfc_array_r16 * const restrict retarray,
          return;
 
        }
-      else
-       retarray->data = internal_malloc_size (alloc_size);
     }
   else
     {
@@ -128,11 +126,11 @@ product_r16 (gfc_array_r16 * const restrict retarray,
       count[n] = 0;
       dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
       if (extent[n] <= 0)
-       len = 0;
+       return;
     }
 
-  base = array->data;
-  dest = retarray->data;
+  base = array->base_addr;
+  dest = retarray->base_addr;
 
   continue_loop = 1;
   while (continue_loop)
@@ -152,6 +150,7 @@ product_r16 (gfc_array_r16 * const restrict retarray,
 
   result *= *src;
              }
+           
            *dest = result;
          }
       }
@@ -221,7 +220,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
   if (len <= 0)
     return;
 
-  mbase = mask->data;
+  mbase = mask->base_addr;
 
   mask_kind = GFC_DESCRIPTOR_SIZE (mask);
 
@@ -257,7 +256,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
        extent[n] = 0;
     }
 
-  if (retarray->data == NULL)
+  if (retarray->base_addr == NULL)
     {
       size_t alloc_size, str;
 
@@ -272,8 +271,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->data = internal_malloc_size (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
     }
   else
@@ -310,8 +308,8 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
        return;
     }
 
-  dest = retarray->data;
-  base = array->data;
+  dest = retarray->base_addr;
+  base = array->base_addr;
 
   while (base)
     {
@@ -323,18 +321,13 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
       {
 
   result = 1;
-       if (len <= 0)
-         *dest = 1;
-       else
+       for (n = 0; n < len; n++, src += delta, msrc += mdelta)
          {
-           for (n = 0; n < len; n++, src += delta, msrc += mdelta)
-             {
 
   if (*msrc)
     result *= *src;
-             }
-           *dest = result;
          }
+       *dest = result;
       }
       /* Advance to the next element.  */
       count[0]++;
@@ -417,7 +410,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray,
        extent[n] = 0;
     }
 
-  if (retarray->data == NULL)
+  if (retarray->base_addr == NULL)
     {
       size_t alloc_size, str;
 
@@ -435,8 +428,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -445,7 +437,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->data = internal_malloc_size (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
     }
   else
     {
@@ -477,7 +469,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray,
       dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
     }
 
-  dest = retarray->data;
+  dest = retarray->base_addr;
 
   while(1)
     {