From 7525ff23cf1802cbeb6e4d51394eac3974de4c70 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Thu, 25 Feb 2016 17:59:08 +0300 Subject: [PATCH] removed artefact cls/pushf/popf --- util/src/uint.rs | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/util/src/uint.rs b/util/src/uint.rs index 98c16ab90..bebaade22 100644 --- a/util/src/uint.rs +++ b/util/src/uint.rs @@ -168,7 +168,6 @@ macro_rules! uint_overflowing_mul { let overflow: u8; unsafe { asm!(" - clc mov $5, %rax mulq $9 mov %rax, $0 @@ -176,77 +175,59 @@ macro_rules! uint_overflowing_mul { mov $6, %rax mulq $9 - clc - adc %rax, $1 + add %rax, $1 mov %rdx, $2 mov $5, %rax - pushf mulq $10 - popf - adc %rax, $1 + add %rax, $1 adc %rdx, $2 mov $6, %rax mulq $10 - clc - adc %rax, $2 + add %rax, $2 mov %rdx, $3 mov $7, %rax mulq $9 - clc - adc %rax, $2 + add %rax, $2 adc %rdx, $3 mov $5, %rax mulq $11 - clc - adc %rax, $2 + add %rax, $2 adc %rdx, $3 mov $8, %rax - pushf mulq $9 - popf adc %rax, $3 adc $$0, %rdx mov %rdx, %rcx - clc mov $7, %rax - pushf mulq $10 - popf - adc %rax, $3 + add %rax, $3 adc $$0, %rdx or %rdx, %rcx - clc mov $6, %rax - pushf mulq $11 - popf - adc %rax, $3 + add %rax, $3 adc $$0, %rdx or %rdx, %rcx - clc mov $5, %rax - pushf mulq $12 - popf - adc %rax, $3 + add %rax, $3 adc $$0, %rdx or %rdx, %rcx - clc cmpq $$0, %rcx jne 2f mov $8, %rax cmpq $$0, %rax - setz %cl + sete %cl mov $7, %rax cmpq $$0, %rax @@ -264,7 +245,8 @@ macro_rules! uint_overflowing_mul { and %dl, %cl - 2: " + 2: + " : /* $0 */ "={r8}"(result[0]), /* $1 */ "={r9}"(result[1]), /* $2 */ "={r10}"(result[2]), /* $3 */ "={r11}"(result[3]), /* $4 */ "={rcx}"(overflow)