Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad codegen on structured gather #214

Closed
mattkretz opened this issue Oct 12, 2018 · 0 comments
Closed

bad codegen on structured gather #214

mattkretz opened this issue Oct 12, 2018 · 0 comments

Comments

@mattkretz
Copy link
Member

Vc version / revision Operating System Compiler & Version Compiler Flags Assembler & Version CPU
0a7836f Linux GCC 8 -DNDEBUG -std=c++17 -O2 -march=skylake

Testcase

struct X { float a; int b; };

int_v gather(X *ptr, int_v idx) {
    return Vc::span<X>(ptr, 100)[idx][&X::b];
}

Actual Results

gather(X*, Vc_1::Vector<int, Vc_1::VectorAbi::Avx>):
  pushq %rbp
  addq $4, %rdi
  movq %rsp, %rbp
  andq $-32, %rsp
  subq $40, %rsp
  leaq -120(%rsp), %rax
  leaq 32(%rax), %rdx
  vmovdqa %ymm0, -88(%rsp)
  vmovdqa %ymm0, -24(%rsp)
  vmovdqa %ymm0, -120(%rsp)
.L2:
  sall (%rax)
  addq $4, %rax
  cmpq %rdx, %rax
  jne .L2
  vmovdqa -120(%rsp), %ymm2
  vpcmpeqd %ymm1, %ymm1, %ymm1
  vpgatherdd %ymm1, (%rdi,%ymm2,4), %ymm0
  leave
  ret

Expected Results

  vpcmpeqd %ymm1, %ymm1, %ymm1
  vpgatherdd %ymm1, (%rdi,%ymm0,8), %ymm2
  vmovdqa %ymm2, %ymm0
  ret
@mattkretz mattkretz added this to the Vc 1.4.1 milestone Oct 12, 2018
@mattkretz mattkretz self-assigned this Oct 12, 2018
mattkretz added a commit that referenced this issue Oct 24, 2018
This was supposed to work already but regressed after stricter type
conversion checks on mixed type binary operations. Now the factor uses
`int` instead of `auto`, which was basically `maxint_t`.

Refs: gh-214

Signed-off-by: Matthias Kretz <kretz@kde.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant