diff options
author | Jeffrey Walton <noloader@gmail.com> | 2021-04-20 04:44:21 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2021-04-20 04:44:21 -0400 |
commit | c15aeaa7b5cdf4409d034a50efb3c0d2959a3f6a (patch) | |
tree | 0aabdf1ae1eccc30a641901e3c87144c6a6a6338 /TestPrograms/test_asm_mixed.cpp | |
parent | 21799b1fba6d9d3148cb56003a21f42f6fd086ed (diff) | |
download | cryptopp-git-c15aeaa7b5cdf4409d034a50efb3c0d2959a3f6a.tar.gz |
Use *.cpp file extension for test programs (GH #1024)
Diffstat (limited to 'TestPrograms/test_asm_mixed.cpp')
-rw-r--r-- | TestPrograms/test_asm_mixed.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/TestPrograms/test_asm_mixed.cpp b/TestPrograms/test_asm_mixed.cpp new file mode 100644 index 00000000..03ed5795 --- /dev/null +++ b/TestPrograms/test_asm_mixed.cpp @@ -0,0 +1,31 @@ +// Most Clang cannot handle mixed asm with positional arguments, where the
+// body is Intel style with no prefix and the templates are AT&T style.
+// Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
+#include <cstddef>
+int main(int argc, char* argv[])
+{
+ size_t ret = 1, N = 1;
+ asm __volatile__
+ (
+#if defined(__amd64__) || defined(__x86_64__)
+ ".intel_syntax noprefix ;\n"
+ "xor rsi, rsi ;\n"
+ "neg %1 ;\n"
+ "inc %1 ;\n"
+ "push %1 ;\n"
+ "pop rax ;\n"
+ ".att_syntax prefix ;\n"
+ : "=a" (ret) : "c" (N) : "%rsi"
+#else
+ ".intel_syntax noprefix ;\n"
+ "xor esi, esi ;\n"
+ "neg %1 ;\n"
+ "inc %1 ;\n"
+ "push %1 ;\n"
+ "pop eax ;\n"
+ ".att_syntax prefix ;\n"
+ : "=a" (ret) : "c" (N) : "%esi"
+#endif
+ );
+ return (int)ret;
+}
|