[clang] [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow SSE/AVX COMI/UCOMI/CMPS/CMPP fp comparison intrinsics to be used in constexpr (PR #182589)

Zaky Hermawan via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 01:22:16 PDT 2026


================
@@ -15,21 +15,70 @@
 #define LLVM_CLANG_LIB_AST_EXPRCONSTSHARED_H
 
 #include "clang/Basic/TypeTraits.h"
+#include "llvm/ADT/APFloat.h"
----------------
ZakyHermawan wrote:

Looks like it is required for my helper function (`MatchesPredicate`) that requires `APFloatBase`. If this being removed, it will produce compile error: 

```
FAILED: tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ByteCode/InterpBuiltin.cpp.o
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/c++ -DCLANG_EXPORTS -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/zaky/workspace/llvm-project/build/tools/clang/lib/AST -I/home/zaky/workspace/llvm-project/clang/lib/AST -I/home/zaky/workspace/llvm-project/clang/include -I/home/zaky/workspace/llvm-project/build/tools/clang/include -I/home/zaky/workspace/llvm-project/build/include -I/home/zaky/workspace/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-dangling-pointer -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -O2 -g -DNDEBUG -std=c++17 -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -MD -MT tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ByteCode/InterpBuiltin.cpp.o -MF tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ByteCode/InterpBuiltin.cpp.o.d -o tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ByteCode/InterpBuiltin.cpp.o -c /home/zaky/workspace/llvm-project/clang/lib/AST/ByteCode/InterpBuiltin.cpp
In file included from /home/zaky/workspace/llvm-project/clang/lib/AST/ByteCode/InterpBuiltin.cpp:8:
/home/zaky/workspace/llvm-project/clang/lib/AST/ByteCode/../ExprConstShared.h:78:43: error: ‘llvm::APFloatBase’ has not been declared
   78 | bool MatchesPredicate(uint32_t Imm, llvm::APFloatBase::cmpResult CompareResult);
      |                                           ^~~~~~~~~~~
/home/zaky/workspace/llvm-project/clang/lib/AST/ByteCode/../ExprConstShared.h:78:66: error: expected ‘,’ or ‘...’ before ‘CompareResult’
   78 | bool MatchesPredicate(uint32_t Imm, llvm::APFloatBase::cmpResult CompareResult);
      |                                                                  ^~~~~~~~~~~~~
[4/506] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ByteCode/Interp.cpp.o
```

https://github.com/llvm/llvm-project/pull/182589


More information about the cfe-commits mailing list