Skip to content

Commit 286dc1a

Browse files
authored
cmov: Set asm options (#746)
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.
1 parent b945341 commit 286dc1a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmov/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ pub fn cmovz(condition: usize, src: usize, dst: &mut usize) {
2323
"cmovz {1}, {2}",
2424
in(reg) condition,
2525
inlateout(reg) *dst,
26-
in(reg) src
26+
in(reg) src,
27+
options(pure, nomem, nostack),
2728
};
2829
}
2930
}
@@ -44,6 +45,7 @@ pub fn cmovz(condition: usize, src: usize, dst: &mut usize) {
4445
inlateout(reg) *dst,
4546
in(reg) src,
4647
in(reg) *dst,
48+
options(pure, nomem, nostack),
4749
};
4850
}
4951
}
@@ -64,6 +66,7 @@ pub fn cmovnz(condition: usize, src: usize, dst: &mut usize) {
6466
inlateout(reg) *dst,
6567
in(reg) src,
6668
in(reg) *dst,
69+
options(pure, nomem, nostack),
6770
};
6871
}
6972
}
@@ -82,7 +85,8 @@ pub fn cmovnz(condition: usize, src: usize, dst: &mut usize) {
8285
"cmovnz {1}, {2}",
8386
in(reg) condition,
8487
inlateout(reg) *dst,
85-
in(reg) src
88+
in(reg) src,
89+
options(pure, nomem, nostack),
8690
};
8791
}
8892
}

0 commit comments

Comments
 (0)