[clang] [C23] [CLANG] Adding C23 constexpr math functions: fmin and frexp. (PR #88978)

2024-04-17 Thread Aaron Ballman via cfe-commits


@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -std=c++23 \
+// RUN: -emit-llvm -o - %s | FileCheck %s
+
+// RUN %clang_cc1 -x c++ -triple x86_64-linux-gnu -emit-llvm -o - %s \
+// RUN -std=c++23
+
+#define INFINITY ((float)(1e+300 * 1e+300))

AaronBallman wrote:

You should also add tests in SemaCXX that the calculations work at compile 
time. e.g.,
```
static_assert(__builtin_fmin(15.24, 1.3) == 1.3, "");
```

https://github.com/llvm/llvm-project/pull/88978
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [C23] [CLANG] Adding C23 constexpr math functions: fmin and frexp. (PR #88978)

2024-04-17 Thread Aaron Ballman via cfe-commits


@@ -14547,6 +14547,18 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr 
*E) {
   default:
 return false;
 
+  case Builtin::BI__builtin_frexpf:

AaronBallman wrote:

I think it would be helpful to also update 
`clang\lib\AST\Interp\InterpBuiltin.cpp` to support the builtins for C++23 
constexpr math functions. CC @tbaederr for his opinion.

https://github.com/llvm/llvm-project/pull/88978
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [C23] [CLANG] Adding C23 constexpr math functions: fmin and frexp. (PR #88978)

2024-04-17 Thread Aaron Ballman via cfe-commits

https://github.com/AaronBallman commented:

C++23, not C23, right? (You should update the patch title and summary 
accordingly.)

https://github.com/llvm/llvm-project/pull/88978
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [C23] [CLANG] Adding C23 constexpr math functions: fmin and frexp. (PR #88978)

2024-04-17 Thread Aaron Ballman via cfe-commits

https://github.com/AaronBallman edited 
https://github.com/llvm/llvm-project/pull/88978
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [C23] [CLANG] Adding C23 constexpr math functions: fmin and frexp. (PR #88978)

2024-04-17 Thread Zahira Ammarguellat via cfe-commits

https://github.com/zahiraam edited 
https://github.com/llvm/llvm-project/pull/88978
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits