asm: start x86 intrinsics examples

Split userland/arch/<arch>/c/ into inline_asm and intrinsics, and move programs
that don't match either up.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-31 00:00:00 +00:00
parent a336201b06
commit a90271c6af
55 changed files with 228 additions and 43 deletions

View File

@@ -0,0 +1,25 @@
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-floating-point-arm */
#include <assert.h>
int main(void) {
float my_float = 1.5;
__asm__ (
"fmov s0, 1.0;"
"fadd %s[my_float], %s[my_float], s0;"
: [my_float] "+w" (my_float)
:
: "s0"
);
assert(my_float == 2.5);
double my_double = 1.5;
__asm__ (
"fmov d0, 1.0;"
"fadd %d[my_double], %d[my_double], d0;"
: [my_double] "+w" (my_double)
:
: "d0"
);
assert(my_double == 2.5);
}