fp.isa (12234:78ece221f9f5) fp.isa (12849:7f43ad13ebf0)
1// -*- mode:c++ -*-
2
3// Copyright (c) 2015 Riscv Developers
4// Copyright (c) 2016-2017 The University of Virginia
5// All rights reserved.
6//
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions are

--- 43 unchanged lines hidden (view full) ---

52 case 0x2:
53 std::fesetround(FE_DOWNWARD);
54 break;
55 case 0x3:
56 std::fesetround(FE_UPWARD);
57 break;
58 case 0x4:
59 // Round to nearest, ties to max magnitude not implemented
1// -*- mode:c++ -*-
2
3// Copyright (c) 2015 Riscv Developers
4// Copyright (c) 2016-2017 The University of Virginia
5// All rights reserved.
6//
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions are

--- 43 unchanged lines hidden (view full) ---

52 case 0x2:
53 std::fesetround(FE_DOWNWARD);
54 break;
55 case 0x3:
56 std::fesetround(FE_UPWARD);
57 break;
58 case 0x4:
59 // Round to nearest, ties to max magnitude not implemented
60 fault = make_shared(ROUND_MODE);
60 fault = make_shared<IllegalFrmFault>(ROUND_MODE, machInst);
61 break;
62 case 0x7: {
63 uint8_t frm = xc->readMiscReg(MISCREG_FRM);
64 switch (frm) {
65 case 0x0:
66 std::fesetround(FE_TONEAREST);
67 break;
68 case 0x1:
69 std::fesetround(FE_TOWARDZERO);
70 break;
71 case 0x2:
72 std::fesetround(FE_DOWNWARD);
73 break;
74 case 0x3:
75 std::fesetround(FE_UPWARD);
76 break;
77 case 0x4:
78 // Round to nearest, ties to max magnitude not implemented
61 break;
62 case 0x7: {
63 uint8_t frm = xc->readMiscReg(MISCREG_FRM);
64 switch (frm) {
65 case 0x0:
66 std::fesetround(FE_TONEAREST);
67 break;
68 case 0x1:
69 std::fesetround(FE_TOWARDZERO);
70 break;
71 case 0x2:
72 std::fesetround(FE_DOWNWARD);
73 break;
74 case 0x3:
75 std::fesetround(FE_UPWARD);
76 break;
77 case 0x4:
78 // Round to nearest, ties to max magnitude not implemented
79 fault = make_shared(ROUND_MODE);
79 fault = make_shared<IllegalFrmFault>(ROUND_MODE, machInst);
80 break;
81 default:
80 break;
81 default:
82 fault = std::make_shared(frm);
82 fault = std::make_shared<IllegalFrmFault>(frm, machInst);
83 break;
84 }
85 break;
86 }
87 default:
83 break;
84 }
85 break;
86 }
87 default:
88 fault = std::make_shared<IllegalFrmFault>(ROUND_MODE);
88 fault = std::make_shared<IllegalFrmFault>(ROUND_MODE,
89 machInst);
89 break;
90 }
91
92 if (fault == NoFault) {
93 MiscReg FFLAGS = xc->readMiscReg(MISCREG_FFLAGS);
94 std::feclearexcept(FE_ALL_EXCEPT);
95 %(code)s;
96 if (std::fetestexcept(FE_INEXACT)) {

--- 32 unchanged lines hidden ---
90 break;
91 }
92
93 if (fault == NoFault) {
94 MiscReg FFLAGS = xc->readMiscReg(MISCREG_FFLAGS);
95 std::feclearexcept(FE_ALL_EXCEPT);
96 %(code)s;
97 if (std::fetestexcept(FE_INEXACT)) {

--- 32 unchanged lines hidden ---