OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [powerpc/] [pr48258-1.c] - Rev 801

Go to most recent revision | Compare with Previous | Blame | View Log

/* { dg-do compile } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O3 -mcpu=power7 -mabi=altivec -ffast-math -fno-unroll-loops" } */
/* { dg-final { scan-assembler-times "xvaddsp" 3 } } */
/* { dg-final { scan-assembler-times "xvminsp" 3 } } */
/* { dg-final { scan-assembler-times "xvmaxsp" 3 } } */
/* { dg-final { scan-assembler-times "xxsldwi" 6 } } */
/* { dg-final { scan-assembler-times "xscvspdp" 3 } } */
/* { dg-final { scan-assembler-not "stvewx" } } */
/* { dg-final { scan-assembler-not "stvx" } } */
/* { dg-final { scan-assembler-not "stxvd2x" } } */
/* { dg-final { scan-assembler-not "stxvw4x" } } */
 
#include <stddef.h>
 
#ifndef SIZE
#define SIZE 1024
#endif
 
float values[SIZE] __attribute__((__aligned__(32)));
 
float
vector_sum (void)
{
  size_t i;
  float sum = 0.0f;
 
  for (i = 0; i < SIZE; i++)
    sum += values[i];
 
  return sum;
}
 
float
vector_min (void)
{
  size_t i;
  float min = values[0];
 
  for (i = 0; i < SIZE; i++)
    min = __builtin_fminf (min, values[i]);
 
  return min;
}
 
float
vector_max (void)
{
  size_t i;
  float max = values[0];
 
  for (i = 0; i < SIZE; i++)
    max = __builtin_fmaxf (max, values[i]);
 
  return max;
}
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.