test inline assembly
This commit is contained in:
parent
f1d1727bf6
commit
fcdc22b861
3 changed files with 23 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -17,3 +17,5 @@ bloom
|
||||||
wo-lernen
|
wo-lernen
|
||||||
lua-foo
|
lua-foo
|
||||||
binsearch
|
binsearch
|
||||||
|
test-inline-assembly
|
||||||
|
test-inline-assembly.s
|
||||||
|
|
10
Makefile
10
Makefile
|
@ -1,8 +1,8 @@
|
||||||
CFLAGS=-std=c99 -Wall -g -O2
|
CFLAGS=-std=c99 -Wall -g -O2
|
||||||
INDENTOPTS=-kr --no-tabs --braces-on-func-def-line --indent-level2
|
INDENTOPTS=-kr --no-tabs --braces-on-func-def-line --indent-level2
|
||||||
|
|
||||||
TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom wo-lernen lua-foo binsearch
|
TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom wo-lernen lua-foo binsearch test-inline-assembly
|
||||||
EXTRAS=mandelbrot.bmp multibrot.png
|
EXTRAS=mandelbrot.bmp multibrot.png test-inline-assembly.s
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(TARGETS) $(EXTRAS)
|
all: $(TARGETS) $(EXTRAS)
|
||||||
|
@ -34,3 +34,9 @@ multibrot.png: multibrot
|
||||||
|
|
||||||
lua-foo: lua-foo.c
|
lua-foo: lua-foo.c
|
||||||
$(CC) $(CFLAGS) -o $@ $< -llua -lm
|
$(CC) $(CFLAGS) -o $@ $< -llua -lm
|
||||||
|
|
||||||
|
test-inline-assembly: test-inline-assembly.c
|
||||||
|
$(CC) -Wall -o $@ $<
|
||||||
|
|
||||||
|
test-inline-assembly.s: test-inline-assembly.c
|
||||||
|
$(CC) -Wall -S -o $@ $<
|
||||||
|
|
13
test-inline-assembly.c
Normal file
13
test-inline-assembly.c
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int i = 0xffff;
|
||||||
|
|
||||||
|
asm("movl $23, %0"
|
||||||
|
: "=r" (i) /* output */
|
||||||
|
/* : no input */
|
||||||
|
/* : no clobbered */
|
||||||
|
);
|
||||||
|
|
||||||
|
printf("i = %d\n", i);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue