Skip to content

Commit

Permalink
add asm-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mishok2503 authored and ladisgin committed Aug 31, 2022
1 parent 98cf1ad commit 51d4106
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions integration-tests/c-example/lib/inline_asm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
int very_easy(int x) {
asm(" ");
return 3 * x;
}

int asm_example(int a) {
if (a == 42) {
return -1;
}
asm("addl $5, %0" : "+r"(a));
return a;
}

int jmp_asm(int a) {
asm volatile ("mov $0x10, %%eax\n\t"
"sub %%eax, %0\n\t"
"cmp $4, %0\n\t"
"jle end\n\t"
"add $0300, %0\n\t"
"end:\n\t"
: "+r"(a)
:: "eax");
return a;
}

float float_avx(float a, float b) {
if (a == 239) {
float data[4] = {a, b, 1, 9};
float res;

asm("movups %0, %%xmm0\n\t"
"haddps %%xmm0, %%xmm0\n\t"
"haddps %%xmm0, %%xmm0\n\t"
"movss %%xmm0, %1\n\t"
: "=m"(data)
: "m"(res)
: "xmm0");

return res;
}
return 42;
}
2 changes: 1 addition & 1 deletion server/test/framework/Server_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ namespace {
Status status = Server::TestsGenServiceImpl::ProcessBaseTestRequest(testGen, writer.get());
ASSERT_TRUE(status.ok()) << status.error_message();

EXPECT_EQ(0, testUtils::getNumberOfTests(testGen.tests));
testUtils::checkMinNumberOfTests(testGen.tests, 1);
}

TEST_F(Server_Test, Memory_Test) {
Expand Down

0 comments on commit 51d4106

Please sign in to comment.