test inline assembly

master
orange 12 years ago
parent f1d1727bf6
commit fcdc22b861

2
.gitignore vendored

@ -17,3 +17,5 @@ bloom
wo-lernen
lua-foo
binsearch
test-inline-assembly
test-inline-assembly.s

@ -1,8 +1,8 @@
CFLAGS=-std=c99 -Wall -g -O2
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
EXTRAS=mandelbrot.bmp multibrot.png
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 test-inline-assembly.s
.PHONY: all
all: $(TARGETS) $(EXTRAS)
@ -34,3 +34,9 @@ multibrot.png: multibrot
lua-foo: lua-foo.c
$(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 $@ $<

@ -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…
Cancel
Save