Browse Source
* cranelift/x64: Fix XmmRmREvex pretty-printing The operand collector had these operands in src1/src2/dst order, but the pretty-printer fetched the allocations in dst/src1/src2 order instead. Although our pretty-printer looked like it was printing src1/src2/dst, because it consumed operands in the wrong order, what it actually printed was src2/dst/src1. Meanwhile, Capstone actually uses src2/src1/dst order in AT&T mode. (GNU objdump agrees.) In the only filetest covering the vpsraq instruction, our output agreed with Capstone because register allocation picked the same register for both src1 and dst, so the two orders were indistinguishable. I've extended the filetest to force register allocation to pick different registers. This format is also used for vpmullq, but we didn't have any compile filetests covering that instruction, so I've added one with the same register allocation pattern. Now our pretty-printer agrees with Capstone on both instructions. * Fix emit-tests and vpermi2b This test for vpmullq had what we have now determined is the wrong order for src1 and src2. There were no emit-tests for vpsraq, so I added one. The vpermi2b tests used the wrong form of the Inst enum, judging by the assertions that are in x64_get_operands (which is not exercised by emit tests) and the fact that we never use that form for that instruction anywhere else. Pretty-printing vpermi2b disagreed with Capstone in the same way as vpsraq and vpmullq. I've fixed that form to agree with Capstone as well, aside from the duplicated src1/dst operand which are required to be different before register allocation and equal afterward.pull/8523/head
Jamey Sharp
6 months ago
committed by
GitHub
5 changed files with 100 additions and 16 deletions
@ -0,0 +1,33 @@ |
|||
test compile precise-output |
|||
target x86_64 sse42 has_avx has_avx2 has_avx512dq has_avx512vl |
|||
|
|||
function %imul(i64x2, i64x2) -> i64x2, i64x2 { |
|||
block0(v0: i64x2, v1: i64x2): |
|||
;; Force register allocation to pick a different destination than |
|||
;; source for at least one of these instructions. |
|||
v2 = imul v0, v1 |
|||
v3 = imul v2, v1 |
|||
return v2, v3 |
|||
} |
|||
|
|||
; VCode: |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block0: |
|||
; vpmullq %xmm1, %xmm0, %xmm0 |
|||
; vpmullq %xmm1, %xmm0, %xmm1 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; ret |
|||
; |
|||
; Disassembled: |
|||
; block0: ; offset 0x0 |
|||
; pushq %rbp |
|||
; movq %rsp, %rbp |
|||
; block1: ; offset 0x4 |
|||
; vpmullq %xmm1, %xmm0, %xmm0 |
|||
; vpmullq %xmm1, %xmm0, %xmm1 |
|||
; movq %rbp, %rsp |
|||
; popq %rbp |
|||
; retq |
|||
|
Loading…
Reference in new issue