Mercurial > projects > ldc
view test/intrinsics.d @ 220:ccc2e6898a78 trunk
[svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
work!
author | lindquist |
---|---|
date | Fri, 06 Jun 2008 20:14:51 +0200 |
parents | 44a95ac7368a |
children |
line wrap: on
line source
import llvm.intrinsic; extern(C) int printf(char*,...); extern(C) int scanf(char*,...); void main() { { float f; printf("Enter float: "); scanf("%f", &f); float sf = llvm_sqrt(f); printf("sqrt(%f) = %f\n", f, sf); } { double d; printf("Enter double: "); scanf("%lf", &d); double sd = llvm_sqrt(d); printf("sqrt(%lf) = %lf\n", d, sd); } { real d; printf("Enter real: "); scanf("%lf", &d); real sd = llvm_sqrt(d); printf("sqrt(%lf) = %lf\n", d, sd); } }