Mercurial > projects > ldc
comparison gen/complex.cpp @ 445:cc40db549aea
Changed the handling of variadic intrinsics a bit.
Removed the -fp80 option and made real be 80bit floats on X86, this is what the D spec really says it should be and fixes a bunch of issues.
Changed the handling of parameter attributes to a bit more generalized approach.
Added sext/zext attributes for byte/short/ubyte/ushort parameters, fixes #60 .
Parameter attribs now properly set for intrinsic calls if necessary.
Made the tango.math.Math patch less intrusive.
Fixed/added some mini tests.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Fri, 01 Aug 2008 17:59:58 +0200 |
parents | 3c133dd1eda3 |
children | 672eb4893b55 |
comparison
equal
deleted
inserted
replaced
444:f2b5f86348ef | 445:cc40db549aea |
---|---|
33 } | 33 } |
34 else if (ty == Tcomplex64) { | 34 else if (ty == Tcomplex64) { |
35 return LLType::DoubleTy; | 35 return LLType::DoubleTy; |
36 } | 36 } |
37 else if (ty == Tcomplex80) { | 37 else if (ty == Tcomplex80) { |
38 return (global.params.useFP80) ? LLType::X86_FP80Ty : LLType::DoubleTy; | 38 if (global.params.cpu == ARCHx86) |
39 return LLType::X86_FP80Ty; | |
40 else | |
41 return LLType::DoubleTy; | |
39 } | 42 } |
40 else { | 43 else { |
41 assert(0); | 44 assert(0); |
42 } | 45 } |
43 } | 46 } |
71 } | 74 } |
72 else if (ty == Tcomplex64) { | 75 else if (ty == Tcomplex64) { |
73 base = Type::tfloat64; | 76 base = Type::tfloat64; |
74 } | 77 } |
75 else if (ty == Tcomplex80) { | 78 else if (ty == Tcomplex80) { |
76 base = (global.params.useFP80) ? Type::tfloat80 : Type::tfloat64; | 79 base = Type::tfloat80; |
77 } | 80 } |
78 | 81 |
79 std::vector<LLConstant*> inits; | 82 std::vector<LLConstant*> inits; |
80 inits.push_back(DtoConstFP(base, re)); | 83 inits.push_back(DtoConstFP(base, re)); |
81 inits.push_back(DtoConstFP(base, im)); | 84 inits.push_back(DtoConstFP(base, im)); |
119 baseimty = Type::timaginary32; | 122 baseimty = Type::timaginary32; |
120 } else if (ty == Tcomplex64) { | 123 } else if (ty == Tcomplex64) { |
121 baserety = Type::tfloat64; | 124 baserety = Type::tfloat64; |
122 baseimty = Type::timaginary64; | 125 baseimty = Type::timaginary64; |
123 } else if (ty == Tcomplex80) { | 126 } else if (ty == Tcomplex80) { |
124 baserety = global.params.useFP80 ? Type::tfloat80 : Type::tfloat64; | 127 baserety = Type::tfloat80; |
125 baseimty = global.params.useFP80 ? Type::timaginary80 : Type::timaginary64; | 128 baseimty = Type::timaginary80; |
126 } | 129 } |
127 | 130 |
128 if (t->isimaginary()) { | 131 if (t->isimaginary()) { |
129 return new DComplexValue(to, LLConstant::getNullValue(DtoType(baserety)), DtoCastFloat(loc, val, baseimty)->getRVal()); | 132 return new DComplexValue(to, LLConstant::getNullValue(DtoType(baserety)), DtoCastFloat(loc, val, baseimty)->getRVal()); |
130 } | 133 } |