Browse Source
* x64: Add instruction helpers for `mov{d,q}` These will soon grow AVX-equivalents so move them to instruction helpers to have clauses for AVX in the future. * x64: Don't auto-convert between RegMemImm and XmmMemImm The previous conversion, `mov_rmi_to_xmm`, would move from GPR registers to XMM registers which isn't what many of the other `convert` statements between these newtypes do. This seemed like a possible footgun so I've removed the auto-conversion and added an explicit helper to go from a `u32` to an `XmmMemImm`. * x64: Add AVX encodings of some more GPR-related insns This commit adds some more support for AVX instructions where GPRs are in use mixed in with XMM registers. This required a few more variants of `Inst` to handle the new instructions. * Fix vpmovmskb encoding * Fix xmm-to-gpr encoding of vmovd/vmovq * Fix typo * Fix rebase conflict * Fix rebase conflict with testspull/5934/head
Alex Crichton
2 years ago
committed by
GitHub
14 changed files with 695 additions and 83 deletions
@ -0,0 +1,104 @@ |
|||
test compile precise-output |
|||
set enable_simd |
|||
target x86_64 has_avx |
|||
|
|||
function %f3(i32) -> f32 { |
|||
block0(v0: i32): |
|||
v1 = fcvt_from_sint.f32 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vcvtsi2ss %edi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vcvtsi2ssl %edi, %xmm0, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f4(i64) -> f32 { |
|||
block0(v0: i64): |
|||
v1 = fcvt_from_sint.f32 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vcvtsi2ss %rdi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vcvtsi2ssq %rdi, %xmm0, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f7(i32) -> f64 { |
|||
block0(v0: i32): |
|||
v1 = fcvt_from_sint.f64 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vcvtsi2sd %edi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vcvtsi2sdl %edi, %xmm0, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f8(i64) -> f64 { |
|||
block0(v0: i64): |
|||
v1 = fcvt_from_sint.f64 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vcvtsi2sd %rdi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vcvtsi2sdq %rdi, %xmm0, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
@ -0,0 +1,104 @@ |
|||
test compile precise-output |
|||
set enable_simd |
|||
target x86_64 has_avx |
|||
|
|||
function %i32_to_f32(i32) -> f32 { |
|||
block0(v0: i32): |
|||
v1 = bitcast.f32 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vmovd %edi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vmovd %edi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %i64_to_f64(i64) -> f64 { |
|||
block0(v0: i64): |
|||
v1 = bitcast.f64 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vmovq %rdi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vmovq %rdi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f32_to_i32(f32) -> i32 { |
|||
block0(v0: f32): |
|||
v1 = bitcast.i32 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vmovd %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vmovd %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f64_to_i64(f64) -> i64 { |
|||
block0(v0: f64): |
|||
v1 = bitcast.i64 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vmovq %xmm0, %rax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vmovq %xmm0, %rax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
@ -0,0 +1,104 @@ |
|||
test compile precise-output |
|||
set enable_simd |
|||
target x86_64 |
|||
|
|||
function %i32_to_f32(i32) -> f32 { |
|||
block0(v0: i32): |
|||
v1 = bitcast.f32 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; movd %edi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; movd %edi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %i64_to_f64(i64) -> f64 { |
|||
block0(v0: i64): |
|||
v1 = bitcast.f64 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; movq %rdi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; movq %rdi, %xmm0 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f32_to_i32(f32) -> i32 { |
|||
block0(v0: f32): |
|||
v1 = bitcast.i32 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; movd %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; movd %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f64_to_i64(f64) -> i64 { |
|||
block0(v0: f64): |
|||
v1 = bitcast.i64 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; movq %xmm0, %rax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; movq %xmm0, %rax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
@ -0,0 +1,108 @@ |
|||
test compile precise-output |
|||
set enable_simd |
|||
target x86_64 has_avx |
|||
|
|||
function %f1(i8x16) -> i8 { |
|||
block0(v0: i8x16): |
|||
v1 = vhigh_bits.i8 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vpmovmskb %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vpmovmskb %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f3(i16x8) -> i8 { |
|||
block0(v0: i16x8): |
|||
v1 = vhigh_bits.i8 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vpacksswb %xmm0, %xmm0, %xmm2 |
|||
; vpmovmskb %xmm2, %eax |
|||
; shrq $8, %rax, %rax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vpacksswb %xmm0, %xmm0, %xmm2 |
|||
; vpmovmskb %xmm2, %eax |
|||
; shrq $8, %rax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f4(i32x4) -> i8 { |
|||
block0(v0: i32x4): |
|||
v1 = vhigh_bits.i8 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vmovmskps %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vmovmskps %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
|||
function %f5(i64x2) -> i8 { |
|||
block0(v0: i64x2): |
|||
v1 = vhigh_bits.i8 v0 |
|||
return v1 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vmovmskpd %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vmovmskpd %xmm0, %eax |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
Loading…
Reference in new issue