File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -448,3 +448,31 @@ TEST(InterpreterTest, MultipleInterpreter) {
448448 std::string cerrs = testing::internal::GetCapturedStderr ();
449449 EXPECT_STREQ (cerrs.c_str (), " printf_jit called!\n " );
450450}
451+
452+ TEST (InterpreterTest, ASMParsing) {
453+ #ifdef EMSCRIPTEN
454+ GTEST_SKIP () << " Test fails for Emscipten builds" ;
455+ #endif
456+ #ifdef _WIN32
457+ GTEST_SKIP () << " Disabled on Windows. Needs fixing." ;
458+ #endif
459+ if (llvm::sys::RunningOnValgrind ())
460+ GTEST_SKIP () << " XFAIL due to Valgrind report" ;
461+ if (!IsTargetX86 ())
462+ GTEST_SKIP () << " Skipped on ARM, we test ASM for x86_64" ;
463+ std::vector<const char *> interpreter_args = {" -include" , " new" };
464+ auto * I = Cpp::CreateInterpreter (interpreter_args);
465+ EXPECT_TRUE (I);
466+
467+ EXPECT_TRUE (Cpp::Declare (R"(
468+ void foo(int &input) {
469+ __asm__ volatile ("addl $10, %0" : "+r"(input));
470+ }
471+ )" ,
472+ I) == 0 );
473+
474+ bool hasError;
475+ EXPECT_TRUE (Cpp::Process (" int b = 42; foo(b);" ) == 0 );
476+ EXPECT_TRUE (Cpp::Evaluate (" b" , &hasError) == 52 );
477+ EXPECT_FALSE (hasError);
478+ }
You can’t perform that action at this time.
0 commit comments