I am reading AMD and Intel manuals and find that when masked and unmasked exceptions coexist, the SIMD execution unit will give priority to the unmasked exceptions (before or after calculation) and then process the masked exceptions, but is it also to set the flag bit for unmasked exceptions first, and then set the flag bit for masked exceptions after the exception handler of #XM has resolved all unmasked exceptions? In this way, the exception handler of #XM only needs to resolve the unmasked exception reported by MXCSR.
Or the SIMD execution unit will give priority to setting the exception flags in MXCSR regardless of whether they are masked or not once it finds a floating-point exception, which will cause the #XM handler can check both the masked and unmasked flags in MXCSR, then directly correct the masked exception to avoid triggering the next time instruction is executed.