On 3/3/25 15:18, Andrew Waterman wrote: >> So in some convoluted way both the above scenarios have callee-saved >> semantics >> for FRM, except for the leaf function which unconditionally sets FRM where >> this >> save/restore is not done. > I don't follow the last part about leaf functions. Unless the leaf > function intends to change FRM globally (e.g. the leaf function in > question is fesetround), then, if it changes FRM, it must restore FRM > before returning.
Yeah I didn't know how to articulate it (and perhaps this still requires clarification) Say we have following // reduced version of gcc.target/riscv/rvv/base/float-point-frm-run-1.c main set_frm (4); // orig global FRM update test_float_point_frm_run_1 (op1, op2, vl) set_frm (0); result = __riscv_vfadd_vv_f32m1_rm (op1, result, 1, vl); assert_equal (1, get_frm ()) // restore global 4 before returning assert_equal (4, get_frm () <-- here call restores global vs. // reduced version of gcc.target/riscv/rvv/base/float-point-frm-run-5.c main set_frm (1); // orig global FRM update test_float_point_frm_run_1 (op1, op2, vl) other_function() set_frm (2); // also global update assert_equal (2, get_frm () <-- here call doesn't restore There's no explicit annotation or anything about the FRM, yet in 2nd example other_function () we consider frm write a global event but not in test_float_point_frm_run_1 () in 1st example: I'm missing words how to explain that :-) Thx, -Vineet