================
@@ -3288,7 +3288,15 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, 
const CallExpr *Call,
   case Builtin::BI__builtin_elementwise_ctzg:
     return interp__builtin_elementwise_countzeroes(S, OpPC, Frame, Call,
                                                    BuiltinID);
-
+  case Builtin::BI__builtin_bswapg: {
+    const APSInt &Val = popToAPSInt(S, Call->getArg(0));
+      assert(Val.getActiveBits() <= 64);
+    if (Val.getBitWidth() == 8)
+        pushInteger(S, Val, Call->getType());
+    else
+        pushInteger(S, Val.byteSwap(), Call->getType());
+    return true;
+  }
----------------
tbaederr wrote:

Don't add the implementation in the switch. We already have 
`interp__builtin_swap` which you can just use here, provided the special case 
for 8 doesn't break anything.

https://github.com/llvm/llvm-project/pull/162433
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to