x86: ZERO_UPPER_VEC_REGISTERS_RETURN_XTEST expect no transactions
authorNoah Goldstein <goldstein.w.n@gmail.com>
Fri, 3 Jun 2022 23:52:37 +0000 (18:52 -0500)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Tue, 7 Jun 2022 20:10:32 +0000 (13:10 -0700)
Give fall-through path to `vzeroupper` and taken-path to `vzeroall`.

Generally even on machines with RTM the expectation is the
string-library functions will not be called in transactions.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
sysdeps/x86_64/sysdep.h

index 4f512d5566b797fa2a690cc13646888804c69df1..7f5defa4ecd45d1acc2aae894847ea6e56120e1e 100644 (file)
@@ -99,11 +99,11 @@ lose:                                                                             \
    to avoid RTM abort triggered by VZEROUPPER inside transactionally.  */
 #define ZERO_UPPER_VEC_REGISTERS_RETURN_XTEST \
        xtest;                                                  \
-       j     1f;                                             \
-       vzeroall;                                               \
+       jnz     1f;                                             \
+       vzeroupper;                                             \
        ret;                                                    \
 1:                                                             \
-       vzeroupper;                                             \
+       vzeroall;                                               \
        ret
 
 /* Can be used to replace vzeroupper that is not directly before a