From f66e777337d0d609b8bfa4cbc21630a2024fde7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Sat, 22 Jun 2019 00:00:00 +0000 Subject: [PATCH] x86 asm: sqrt x87 --- userland/arch/x86_64/inline_asm/sqrt_x87.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 userland/arch/x86_64/inline_asm/sqrt_x87.c diff --git a/userland/arch/x86_64/inline_asm/sqrt_x87.c b/userland/arch/x86_64/inline_asm/sqrt_x87.c new file mode 100644 index 0000000..b37aa06 --- /dev/null +++ b/userland/arch/x86_64/inline_asm/sqrt_x87.c @@ -0,0 +1,15 @@ +/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly */ + +#include + +int main(void) { + double io = 4.0; + __asm__ ( + "fsqrt" + : "+t" (io) + : + : + ); + assert(io == 2.0); + return 0; +}