https://github.com/andykaylor commented:
This needs a test. The existing tests are using the default cc1 settings, which
means math errno is disabled. You need a test that passes `-fmath-errno` on the
RUN line and also has a separate RUN line without it. Calling one function
would be sufficient. Also, note that the normal libm declarations go through
this path as if they were builtins. So something like this would be good:
```
float cosf(float);
float test_normal(float f) {
return cosf(f);
// CIR-ERRNO: cir.call @cosf
// CIR-NO-ERRNO: cir.cos
// LLVM-ERRNO: call float @cosf
// LLVM-NO-ERRNO: call float @llvm.cos.f32
// OGCG-ERRNO: call float @cosf
// OGCG-NO-ERRNO: call float @llvm.cos.f32
}
float test_precise(float f) {
#pragma float_control(precise, on)
// Should never produce an intrinsic
return cosf(f);
// CIR-ERRNO: cir.call @cosf
// CIR-NO-ERRNO: cir.call @cosf
// LLVM-ERRNO: call float @cosf
// LLVM-NO-ERRNO: cir.call @cosf
// OGCG-ERRNO: call float @cosf
// OGCG-NO-ERRNO: cir.call @cosf
}
float test_fast(float f) {
#pragma float_control(precise, off)
// Should produce an intrinsic at -O1
return cosf(f);
// CIR-ERRNO-O1: cir.cos
// CIR-NO-ERRNO-O1: cir.cos
// LLVM-ERRNO-O1: call float @llvm.cos.f32
// LLVM-NO-ERRNO-O1: call float @llvm.cos.f32
// OGCG-ERRNO-O1: call float @llvm.cos.f32
// OGCG-NO-ERRNO-O1: call float @llvm.cos.f32
}
```
Note that you'll need RUN lines that include `-O1` to get the fast pragma to
have an effect.
https://github.com/llvm/llvm-project/pull/169424
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits