From 99c522b14dbbf6b26be35b6e7bb8da7b29070287 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Wed, 8 Jun 2022 16:36:28 +0300 Subject: Inline asm external call --- test/Feature/InlineAsm.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/Feature/InlineAsm.c (limited to 'test/Feature') diff --git a/test/Feature/InlineAsm.c b/test/Feature/InlineAsm.c new file mode 100644 index 00000000..25e0e72e --- /dev/null +++ b/test/Feature/InlineAsm.c @@ -0,0 +1,25 @@ +// RUN: %clang %s -emit-llvm %O0opt -c -g -o %t.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee --external-calls=all --exit-on-error --output-dir=%t.klee-out %t.bc > %t.output.log 2>&1 + +#include + +int main() { + + int x; + klee_make_symbolic(&x, sizeof(x), "x"); + if (x == 239) { + __asm__("neg %0" + : "+r"(x)); + assert(x == -239); + } + + int y = x; + __asm__("add $5, %0" + : "+r"(x)); + __asm__("add $0, %0" + : "+r"(y)); + assert(x == y + 5); + + return 0; +} -- cgit 1.4.1