Skip to content

Commit

Permalink
cmov: Set asm options (#746)
Browse files Browse the repository at this point in the history
Those options tell the compiler that ASM statements do not read
or write memory, can be removed if the dst ends up unused during
compilation, and that they don't push data to the stack.
  • Loading branch information
KamilaBorowska authored Mar 2, 2022
1 parent b945341 commit 286dc1a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmov/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ pub fn cmovz(condition: usize, src: usize, dst: &mut usize) {
"cmovz {1}, {2}",
in(reg) condition,
inlateout(reg) *dst,
in(reg) src
in(reg) src,
options(pure, nomem, nostack),
};
}
}
Expand All @@ -44,6 +45,7 @@ pub fn cmovz(condition: usize, src: usize, dst: &mut usize) {
inlateout(reg) *dst,
in(reg) src,
in(reg) *dst,
options(pure, nomem, nostack),
};
}
}
Expand All @@ -64,6 +66,7 @@ pub fn cmovnz(condition: usize, src: usize, dst: &mut usize) {
inlateout(reg) *dst,
in(reg) src,
in(reg) *dst,
options(pure, nomem, nostack),
};
}
}
Expand All @@ -82,7 +85,8 @@ pub fn cmovnz(condition: usize, src: usize, dst: &mut usize) {
"cmovnz {1}, {2}",
in(reg) condition,
inlateout(reg) *dst,
in(reg) src
in(reg) src,
options(pure, nomem, nostack),
};
}
}
Expand Down

0 comments on commit 286dc1a

Please sign in to comment.