[PATCH] Value soft float calls as more expensive in the inliner.

Cameron Esfahani dirty at apple.com
Fri Jan 23 16:58:07 PST 2015


It's in the CodeGen directory.  Here's the current testcase:

[dirty at girlyouknowitstrue work]$ cat llvm/tools/clang/test/CodeGen/inline-fp.c
// RUN: %clang -Oz -target armv7-apple-macosx10.8.0 -mcpu=cortex-a8 -march=armv7 -S -emit-llvm %s -o - | FileCheck %s
// RUN: %clang -Oz -target armv7-apple-macosx10.8.0 -mcpu=cortex-m3 -march=armv7 -S -emit-llvm %s -o - | FileCheck -check-prefix NO-FP %s

extern float powf(float x, float y);
extern float fabsf(float x);

static float f1(int response, unsigned char value1) {

  float value2 = 2620.0f * powf(1.01f, value1 - 1);
  float responseDelta = (response - value2) / value2;
  
  return (responseDelta);

}

extern void getX(int *responseX, unsigned char *valueX);
extern void getY(int *responseY, unsigned char *valueY);
extern void getZ(int *responseZ, unsigned char *valueZ);

// CHECK-NOT: define internal arm_aapcscc float @f1(
// NO-FP: define internal arm_aapcscc float @f1(
int test_all(void) {

  int responseX;
  int responseY;
  int responseZ;
  unsigned char valueX;
  unsigned char valueY;
  unsigned char valueZ;
  
  getX(&responseX, &valueX);
  getY(&responseY, &valueY);
  getZ(&responseZ, &valueZ);
  
  float responseDeltaX = f1(responseX, valueX);
  float responseDeltaY = f1(responseY, valueY);
  float responseDeltaZ = f1(responseZ, valueZ);
  
  int success = 1;
  
  if (fabsf(responseDeltaX) > 0.14f)
    success = 0;
  else if (fabsf(responseDeltaY) > 0.14f)
    success = 0;
  else if (fabsf(responseDeltaZ) > 0.14f)
    success = 0;
  
  return (success);

}

Cameron Esfahani
dirty at apple.com

"Americans are very skilled at creating a custom meaning from something that's mass-produced."

Ann Powers


http://reviews.llvm.org/D6936

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list