summaryrefslogtreecommitdiff
path: root/src/arch/sparc/isa/formats
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-04-21 17:50:47 -0400
committerAli Saidi <saidi@eecs.umich.edu>2007-04-21 17:50:47 -0400
commite8ace88e897a4b0f61526ac0fe88740d337f0509 (patch)
treebf3b1eb65aea520338da80271333406d2aecc17c /src/arch/sparc/isa/formats
parent5825104982d75daee20cd82da3ea2581c31d5292 (diff)
downloadgem5-e8ace88e897a4b0f61526ac0fe88740d337f0509.tar.xz
create base/fenv.c to standerdize fenv across platforms. It's a c file and not a cpp file because c99
(which defines fenv) doesn't necessarily extend to c++ and it is a problem with solaris. If really desired this could wrap the ieeefp interface found in bsd* as well, but I see no need at the moment. src/arch/alpha/isa/fp.isa: src/arch/sparc/isa/formats/basic.isa: use m5_fesetround()/m5_fegetround() istead of fenv interface directly src/arch/sparc/isa/includes.isa: use base/fenv instead of fenv directly src/base/SConscript: add fenv to sconscript src/base/fenv.hh: src/base/random.cc: m5 implementation to standerdize fenv across platforms. --HG-- extra : convert_revision : 38d2629affd964dcd1a5ab0db4ac3cb21438e72c
Diffstat (limited to 'src/arch/sparc/isa/formats')
-rw-r--r--src/arch/sparc/isa/formats/basic.isa31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/arch/sparc/isa/formats/basic.isa b/src/arch/sparc/isa/formats/basic.isa
index 7665d2d4f..5b0868132 100644
--- a/src/arch/sparc/isa/formats/basic.isa
+++ b/src/arch/sparc/isa/formats/basic.isa
@@ -109,37 +109,22 @@ def format FpBasic(code, *flags) {{
fp_code = """
Fsr |= bits(Fsr,4,0) << 5;
Fsr = insertBits(Fsr,4,0,0);
-#if defined(__sun) || defined (__OpenBSD__)
- fp_rnd newrnd = FP_RN;
+ int newrnd = M5_FE_TONEAREST;
switch (Fsr<31:30>) {
- case 0: newrnd = FP_RN; break;
- case 1: newrnd = FP_RZ; break;
- case 2: newrnd = FP_RP; break;
- case 3: newrnd = FP_RM; break;
+ case 0: newrnd = M5_FE_TONEAREST; break;
+ case 1: newrnd = M5_FE_TOWARDZERO; break;
+ case 2: newrnd = M5_FE_UPWARD; break;
+ case 3: newrnd = M5_FE_DOWNWARD; break;
}
- fp_rnd oldrnd = fpsetround(newrnd);
-#else
- int newrnd = FE_TONEAREST;
- switch (Fsr<31:30>) {
- case 0: newrnd = FE_TONEAREST; break;
- case 1: newrnd = FE_TOWARDZERO; break;
- case 2: newrnd = FE_UPWARD; break;
- case 3: newrnd = FE_DOWNWARD; break;
- }
- int oldrnd = fegetround();
- fesetround(newrnd);
-#endif
+ int oldrnd = m5_fegetround();
+ m5_fesetround(newrnd);
"""
fp_code += code
fp_code += """
-#if defined(__sun) || defined (__OpenBSD__)
- fpsetround(oldrnd);
-#else
- fesetround(oldrnd);
-#endif
+ m5_fesetround(oldrnd);
"""
fp_code = filterDoubles(fp_code)
iop = InstObjParams(name, Name, 'SparcStaticInst', fp_code, flags)