Mercurial > projects > ldc
view tests/mini/intrinsics.d @ 1052:12ea38902e83
Add '-singleobj' command line switch that will tell LDC to link LLVM modules internally and only emit a single object file.
The switch allows the optimizer and inliner to run on all modules at once and opens the door for template instantiation improvements that should lower compile time and executable size.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 07 Mar 2009 19:38:00 +0100 |
parents | 4ac97ec7c18e |
children | 146d8dfa0043 |
line wrap: on
line source
import ldc.intrinsics; extern(C) int printf(char*,...); extern(C) int scanf(char*,...); void main() { float f; printf("Enter float: "); //scanf("%f", &f); f = 1.22345; float sf = llvm_sqrt_f32(f); printf("sqrt(%f) = %f\n", f, sf); double d; printf("Enter double: "); //scanf("%lf", &d); d = 2.2311167895435245; double sd = llvm_sqrt_f64(d); printf("sqrt(%lf) = %lf\n", d, sd); real r; printf("Enter real: "); //scanf("%llf", &r); r = 3.2311167891231231234754764576; version(X86) { real sr = llvm_sqrt_f80(r); printf("sqrt(%llf) = %llf\n", r, sr); } else version (X86_64) { real sr = llvm_sqrt_f80(r); printf("sqrt(%llf) = %llf\n", r, sr); } else { real sr = llvm_sqrt_f64(r); printf("sqrt(%f) = %lf\n", r, sr); } }