[clang] [clang][x86][bytecode] added trailing type for ffs, missed in pr llvm#162346 for llvm#160288 (PR #163905)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 16 21:17:04 PDT 2025


https://github.com/donneypr updated https://github.com/llvm/llvm-project/pull/163905

>From c84d8396f21d349bb4e1fbafd35c73ad5bd249e3 Mon Sep 17 00:00:00 2001
From: donneypr <donatoprabahar at gmail.com>
Date: Fri, 17 Oct 2025 00:06:46 -0400
Subject: [PATCH 1/2] added trailing type for ffs, missed in pr llvm#162346 for
 llvm#160288

---
 clang/lib/AST/ByteCode/InterpBuiltin.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 922d67940e22f..517c51a5f7de1 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -3173,7 +3173,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
   case Builtin::BI__builtin_ffsl:
   case Builtin::BI__builtin_ffsll:
     return interp__builtin_elementwise_int_unaryop(
-        S, OpPC, Call, [](const APSInt &Val) {
+        S, OpPC, Call, [](const APSInt &Val) -> APInt {
           return APInt(Val.getBitWidth(),
                        Val.isZero() ? 0u : Val.countTrailingZeros() + 1u);
         });

>From 6261a0574664b199903e69af1d81b668dfc93ec2 Mon Sep 17 00:00:00 2001
From: donneypr <donatoprabahar at gmail.com>
Date: Fri, 17 Oct 2025 00:16:42 -0400
Subject: [PATCH 2/2] addded trailing type to other
 interp__builtin_elementwise_int_unaryop callbacks for uniformity

---
 clang/lib/AST/ByteCode/InterpBuiltin.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 517c51a5f7de1..35812d4e25981 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -3319,7 +3319,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
   case clang::X86::BI__builtin_ia32_lzcnt_u32:
   case clang::X86::BI__builtin_ia32_lzcnt_u64:
     return interp__builtin_elementwise_int_unaryop(
-        S, OpPC, Call, [](const APSInt &Src) {
+        S, OpPC, Call, [](const APSInt &Src) -> APInt {
           return APInt(Src.getBitWidth(), Src.countLeadingZeros());
         });
 
@@ -3327,7 +3327,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
   case clang::X86::BI__builtin_ia32_tzcnt_u32:
   case clang::X86::BI__builtin_ia32_tzcnt_u64:
     return interp__builtin_elementwise_int_unaryop(
-        S, OpPC, Call, [](const APSInt &Src) {
+        S, OpPC, Call, [](const APSInt &Src) -> APInt {
           return APInt(Src.getBitWidth(), Src.countTrailingZeros());
         });
 
@@ -3799,7 +3799,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
   case X86::BI__builtin_ia32_knotsi:
   case X86::BI__builtin_ia32_knotdi:
     return interp__builtin_elementwise_int_unaryop(
-        S, OpPC, Call, [](const APSInt &Src) { return ~Src; });
+        S, OpPC, Call, [](const APSInt &Src) -> APInt { return ~Src; });
 
   case X86::BI__builtin_ia32_kaddqi:
   case X86::BI__builtin_ia32_kaddhi:



More information about the cfe-commits mailing list