mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 12:04:27 +01:00
x86 asm: sqrt x87
This commit is contained in:
15
userland/arch/x86_64/inline_asm/sqrt_x87.c
Normal file
15
userland/arch/x86_64/inline_asm/sqrt_x87.c
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly */
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
double io = 4.0;
|
||||||
|
__asm__ (
|
||||||
|
"fsqrt"
|
||||||
|
: "+t" (io)
|
||||||
|
:
|
||||||
|
:
|
||||||
|
);
|
||||||
|
assert(io == 2.0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user