Skip to content

Commit

Permalink
Use vcmpunordps instead of vcmpps (#45)
Browse files Browse the repository at this point in the history
This is equivalent, but more obvious.
  • Loading branch information
mkeeter authored Mar 22, 2024
1 parent f85bb6b commit 6cac755
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fidget/src/jit/x86_64/float_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ impl Assembler for FloatSliceAssembler {
fn build_max(&mut self, out_reg: u8, lhs_reg: u8, rhs_reg: u8) {
dynasm!(self.0.ops
// Build a mask of NANs; conveniently, all 1s is a NAN
; vcmpps ymm1, Ry(reg(lhs_reg)), Ry(reg(lhs_reg)), 3
; vcmpps ymm2, Ry(reg(rhs_reg)), Ry(reg(rhs_reg)), 3
; vcmpunordps ymm1, Ry(reg(lhs_reg)), Ry(reg(lhs_reg))
; vcmpunordps ymm2, Ry(reg(rhs_reg)), Ry(reg(rhs_reg))
; vorps ymm1, ymm2, ymm1

// Calculate the max, which ignores NANs
Expand All @@ -255,8 +255,8 @@ impl Assembler for FloatSliceAssembler {
fn build_min(&mut self, out_reg: u8, lhs_reg: u8, rhs_reg: u8) {
dynasm!(self.0.ops
// Build a mask of NANs; conveniently, all 1s is a NAN
; vcmpps ymm1, Ry(reg(lhs_reg)), Ry(reg(lhs_reg)), 3
; vcmpps ymm2, Ry(reg(rhs_reg)), Ry(reg(rhs_reg)), 3
; vcmpunordps ymm1, Ry(reg(lhs_reg)), Ry(reg(lhs_reg))
; vcmpunordps ymm2, Ry(reg(rhs_reg)), Ry(reg(rhs_reg))
; vorps ymm1, ymm2, ymm1

// Calculate the min, which ignores NANs
Expand Down

0 comments on commit 6cac755

Please sign in to comment.