Skip to content

Commit

Permalink
x86: add encoding for bnot.b1.
Browse files Browse the repository at this point in the history
Fixes bytecodealliance#1743.

Co-authored-by: iximeow <git@iximeow.net>
  • Loading branch information
whitequark and iximeow committed May 28, 2020
1 parent 26ee986 commit 0ad0976
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions cranelift/codegen/meta/src/isa/x86/encodings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ fn define_alu(
// x86 has a bitwise not instruction NOT.
e.enc_i32_i64(bnot, rec_ur.opcodes(&NOT).rrr(2));
e.enc_b32_b64(bnot, rec_ur.opcodes(&NOT).rrr(2));
e.enc_both(bnot.bind(B1), rec_ur.opcodes(&NOT).rrr(2));

// Also add a `b1` encodings for the logic instructions.
// TODO: Should this be done with 8-bit instructions? It would improve partial register
Expand Down
14 changes: 14 additions & 0 deletions cranelift/filetests/filetests/isa/x86/bnot-b1.clif
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
test binemit
test run

target x86_64

function u0:323() -> b1 {
block0:
[-,%rax] v221 = bconst.b1 false ; bin: 40 b8 00000000
[-,%rcx] v222 = bconst.b1 true ; bin: 40 b9 00000001
[-,%rax] v223 = bnot v221 ; bin: 40 f7 d0
[-,%rax] v224 = band v223, v222 ; bin: 40 21 c8
return v224
}
; run

0 comments on commit 0ad0976

Please sign in to comment.