[llvm-dev] Instruction Combine Cast (fptrunc (floor x)) -> (floor (fptrunc x))

Shiva Chen via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 16 20:08:30 PDT 2017


Hi,

I have a test case would fail due to instruction combine cast
from floor to floorf.

double d = 1024.0 - 1.0 / 32768.0;
extern double floor(double);
extern float floorf(float);
extern void abort();

int main() {

    float f1 = (float)floor(d);

    if ((int)f1 != 1023)
      abort ();

    return 0;
}

My question is: Is the transformation legal for this case?

Thanks,
Shiva


More information about the llvm-dev mailing list