[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 25 10:58:08 PDT 2025


================
@@ -961,3 +961,51 @@ static_assert(fmaDouble1[3] == 26.0);
 constexpr float fmaArray[] = {2.0f, 2.0f, 2.0f, 2.0f};
 constexpr float fmaResult = __builtin_elementwise_fma(fmaArray[1], fmaArray[2], fmaArray[3]);
 static_assert(fmaResult == 6.0f, "");
+
+static_assert(__builtin_elementwise_fshl((unsigned char)255, (unsigned char)0, (unsigned char)8) == (unsigned char)255);
----------------
RKSimon wrote:

Funnel shifts modulo the shift amount by the bitwidth and has a defined output when that modulo'd value is zero. It doesn't create undef/poison unlike regular but shift operators.

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


More information about the cfe-commits mailing list