[PATCH] D80013: [x86] favor vector constant load to avoid GPR to XMM transfer

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 15 08:39:37 PDT 2020


spatel marked 5 inline comments as done.
spatel added inline comments.


================
Comment at: llvm/test/CodeGen/X86/combine-udiv.ll:602
 ; XOP:       # %bb.0:
 ; XOP-NEXT:    movl $65535, %eax # imm = 0xFFFF
 ; XOP-NEXT:    vmovd %eax, %xmm1
----------------
This would improve without the -1 restriction.


================
Comment at: llvm/test/CodeGen/X86/combine-udiv.ll:681-682
+; AVX2:       # %bb.0:
+; AVX2-NEXT:    movl $171, %eax
+; AVX2-NEXT:    vmovd %eax, %xmm1
+; AVX2-NEXT:    vpmovzxbw {{.*#+}} xmm2 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
----------------
No change for AVX2 is probably caused by the 128-bit limit.


================
Comment at: llvm/test/CodeGen/X86/sad.ll:547-548
 ; SSE2-NEXT:    movq $-1024, %rax # imm = 0xFC00
 ; SSE2-NEXT:    movl $65535, %ecx # imm = 0xFFFF
 ; SSE2-NEXT:    movd %ecx, %xmm1
 ; SSE2-NEXT:    .p2align 4, 0x90
----------------
This would improve without the -1 restriction.


================
Comment at: llvm/test/CodeGen/X86/sad.ll:1019-1020
+; AVX2-NEXT:    vpsadbw (%rcx), %xmm1, %xmm1
+; AVX2-NEXT:    movl $1, %eax
+; AVX2-NEXT:    vmovd %eax, %xmm2
+; AVX2-NEXT:    vpaddd %xmm2, %xmm1, %xmm1
----------------
No change for AVX2/AXV512 is probably caused by the 128-bit limit.


================
Comment at: llvm/test/CodeGen/X86/vec_shift2.ll:13
 ; X64:       # %bb.0:
-; X64-NEXT:    psrlw $14, %xmm0
+; X64-NEXT:    psrlw {{.*}}(%rip), %xmm0
 ; X64-NEXT:    retq
----------------
This is a regression, but I'm assuming it does not matter because we have been using standard IR for vector shifts for at least 5 years. If it does matter, then I think the next test shows an existing failure of constant analysis. Also, if the high part of the shift amount is undef, then can't we fold both of these tests to constant 0 (no shift needed)?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80013/new/

https://reviews.llvm.org/D80013





More information about the llvm-commits mailing list