]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
arm64 isel: in a couple places, use `xzr` as a source rather than loading zero into...
authorJulian Seward <jseward@acm.org>
Mon, 4 Jan 2021 14:16:41 +0000 (15:16 +0100)
committerJulian Seward <jseward@acm.org>
Mon, 4 Jan 2021 14:16:41 +0000 (15:16 +0100)
Reduces code size by 0.27% for /usr/bin/date.

VEX/priv/host_arm64_defs.c
VEX/priv/host_arm64_isel.c

index 67dd06c78af9766aefc9f8b53498bafa206e64e7..526da570a52c5108f1707f4900fe80c640d4b601 100644 (file)
@@ -3955,9 +3955,9 @@ Int emit_ARM64Instr ( /*MB_MOD*/Bool* is_profInc,
          /* 100 1101 0100 mm cond 00 nn dd = CSEL Xd, Xn, Xm, cond */
          UInt dd   = iregEnc(i->ARM64in.CSel.dst);
          UInt nn   = iregEnc(i->ARM64in.CSel.argL);
-         UInt mm   = iregEnc(i->ARM64in.CSel.argR);
+         UInt mm   = iregEncOr31(i->ARM64in.CSel.argR); // Can be XZR
          UInt cond = (UInt)i->ARM64in.CSel.cond;
-         vassert(dd < 31 && nn < 31 && mm < 31 && cond < 16);
+         vassert(dd < 31 && nn < 31 && mm <= 31 && cond < 16);
          *p++ = X_3_8_5_6_5_5(X100, X11010100, mm, cond << 2, nn, dd);
          goto done;
       }
index d76973507b94e527e9ce7575afe11921f4f19cc1..1b8ad20a5aa72b2367b1c340f818eedd80278c8a 100644 (file)
@@ -2085,11 +2085,10 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, IRExpr* e )
          case Iop_1Sto32:
          case Iop_1Sto64: {
             /* As with the iselStmt case for 'tmp:I1 = expr', we could
-               do a lot better here if it ever became necessary. */
-            HReg zero = newVRegI(env);
+               do a lot better here if it ever became necessary.  (CSDEC?) */
+            HReg zero = hregARM64_XZR_XSP(); // XZR in this context
             HReg one  = newVRegI(env);
             HReg dst  = newVRegI(env);
-            addInstr(env, ARM64Instr_Imm64(zero, 0));
             addInstr(env, ARM64Instr_Imm64(one,  1));
             ARM64CondCode cc = iselCondCode_C(env, e->Iex.Unop.arg);
             addInstr(env, ARM64Instr_CSel(dst, one, zero, cc));
@@ -2159,9 +2158,8 @@ static HReg iselIntExpr_R_wrk ( ISelEnv* env, IRExpr* e )
                addInstr(env, ARM64Instr_Logic(dst, src, one, ARM64lo_AND));
             } else {
                /* CLONE-01 */
-               HReg zero = newVRegI(env);
+               HReg zero = hregARM64_XZR_XSP(); // XZR in this context
                HReg one  = newVRegI(env);
-               addInstr(env, ARM64Instr_Imm64(zero, 0));
                addInstr(env, ARM64Instr_Imm64(one,  1));
                ARM64CondCode cc = iselCondCode_C(env, e->Iex.Unop.arg);
                addInstr(env, ARM64Instr_CSel(dst, one, zero, cc));
@@ -3985,10 +3983,9 @@ static void iselStmt ( ISelEnv* env, IRStmt* stmt )
             in that case.  Also, could do this just with a single CINC
             insn. */
          /* CLONE-01 */
-         HReg zero = newVRegI(env);
+         HReg zero = hregARM64_XZR_XSP(); // XZR in this context
          HReg one  = newVRegI(env);
          HReg dst  = lookupIRTemp(env, tmp);
-         addInstr(env, ARM64Instr_Imm64(zero, 0));
          addInstr(env, ARM64Instr_Imm64(one,  1));
          ARM64CondCode cc = iselCondCode_C(env, stmt->Ist.WrTmp.data);
          addInstr(env, ARM64Instr_CSel(dst, one, zero, cc));