From owner-svn-src-all@freebsd.org Thu Feb 18 23:03:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 894E1AAD125; Thu, 18 Feb 2016 23:03:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 640F21D9; Thu, 18 Feb 2016 23:03:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1IN3b7N045211; Thu, 18 Feb 2016 23:03:37 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1IN3bQc045210; Thu, 18 Feb 2016 23:03:37 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201602182303.u1IN3bQc045210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 18 Feb 2016 23:03:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r295776 - head/sys/contrib/x86emu X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2016 23:03:38 -0000 Author: jkim Date: Thu Feb 18 23:03:37 2016 New Revision: 295776 URL: https://svnweb.freebsd.org/changeset/base/295776 Log: Optimize ROL and ROR emulations and fix comments. Modified: head/sys/contrib/x86emu/x86emu.c Modified: head/sys/contrib/x86emu/x86emu.c ============================================================================== --- head/sys/contrib/x86emu/x86emu.c Thu Feb 18 23:00:01 2016 (r295775) +++ head/sys/contrib/x86emu/x86emu.c Thu Feb 18 23:03:37 2016 (r295776) @@ -6995,15 +6995,13 @@ rol_byte(struct x86emu *emu, uint8_t d, mask = (1 << cnt) - 1; res |= (d >> (8 - cnt)) & mask; - /* set the new carry flag, Note that it is the low order bit - * of the result!!! */ - CONDITIONAL_SET_FLAG(res & 0x1, F_CF); /* OVERFLOW is set *IFF* s==1, then it is the xor of CF and * the most significant bit. Blecck. */ CONDITIONAL_SET_FLAG(s == 1 && XOR2((res & 0x1) + ((res >> 6) & 0x2)), F_OF); - } else if (s != 0) { + } + if (s != 0) { /* set the new carry flag, Note that it is the low order bit * of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x1, F_CF); @@ -7025,11 +7023,11 @@ rol_word(struct x86emu *emu, uint16_t d, res = (d << cnt); mask = (1 << cnt) - 1; res |= (d >> (16 - cnt)) & mask; - CONDITIONAL_SET_FLAG(res & 0x1, F_CF); CONDITIONAL_SET_FLAG(s == 1 && XOR2((res & 0x1) + ((res >> 14) & 0x2)), F_OF); - } else if (s != 0) { + } + if (s != 0) { /* set the new carry flag, Note that it is the low order bit * of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x1, F_CF); @@ -7051,11 +7049,11 @@ rol_long(struct x86emu *emu, uint32_t d, res = (d << cnt); mask = (1 << cnt) - 1; res |= (d >> (32 - cnt)) & mask; - CONDITIONAL_SET_FLAG(res & 0x1, F_CF); CONDITIONAL_SET_FLAG(s == 1 && XOR2((res & 0x1) + ((res >> 30) & 0x2)), F_OF); - } else if (s != 0) { + } + if (s != 0) { /* set the new carry flag, Note that it is the low order bit * of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x1, F_CF); @@ -7093,14 +7091,12 @@ ror_byte(struct x86emu *emu, uint8_t d, mask = (1 << (8 - cnt)) - 1; res |= (d >> (cnt)) & mask; - /* set the new carry flag, Note that it is the low order bit - * of the result!!! */ - CONDITIONAL_SET_FLAG(res & 0x80, F_CF); /* OVERFLOW is set *IFF* s==1, then it is the xor of the two * most significant bits. Blecck. */ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF); - } else if (s != 0) { - /* set the new carry flag, Note that it is the low order bit + } + if (s != 0) { + /* set the new carry flag, Note that it is the high order bit * of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x80, F_CF); } @@ -7121,10 +7117,10 @@ ror_word(struct x86emu *emu, uint16_t d, res = (d << (16 - cnt)); mask = (1 << (16 - cnt)) - 1; res |= (d >> (cnt)) & mask; - CONDITIONAL_SET_FLAG(res & 0x8000, F_CF); CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF); - } else if (s != 0) { - /* set the new carry flag, Note that it is the low order bit + } + if (s != 0) { + /* set the new carry flag, Note that it is the high order bit * of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF); } @@ -7145,10 +7141,10 @@ ror_long(struct x86emu *emu, uint32_t d, res = (d << (32 - cnt)); mask = (1 << (32 - cnt)) - 1; res |= (d >> (cnt)) & mask; - CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF); CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF); - } else if (s != 0) { - /* set the new carry flag, Note that it is the low order bit + } + if (s != 0) { + /* set the new carry flag, Note that it is the high order bit * of the result!!! */ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF); }