[PATCH] D29385: Clzero intrinsic and its addition under znver1

Ganesh Gopalasubramanian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 04:00:35 PST 2017


GGanesh added a comment.

I think it is okay even if we don't set the mayStore attribute.
I wrote a simple test to check the following

1. Schedules based on the instruction attribute
2. Side-effect handling

As Craig Topper says it falls back the UnmodeledSideEffects case by default.

**Test:**

  #include "xmmintrin.h"
  int a[2];
  int b[2];
  int c,d, *p;
  int main ()
  {
    b[0] += a[0];
    __builtin_ia32_clzero (p) ;
    d += c;
    b[1] += a[0];
    return 0;
  }

We can notice that the schedule without the intrinsic has two mov scheduled for the first cycle. Without the intrinsic they go back to safe-order.
**Without clzero intrinsic: $>clang -O3 ClzeroFoldTest.c -S -march=znver1**

  # BB#0:                                 # %entry
          movl    a(%rip), %eax
          movl    c(%rip), %ecx
          addl    %eax, b(%rip)
          addl    %eax, b+4(%rip)
          addl    %ecx, d(%rip)
          xorl    %eax, %eax
          retq

**With clzero intrinsic: $>clang -O3 ClzeroFoldTest.c -S -march=znver1**

  # BB#0:
          movl    a(%rip), %eax
          addl    %eax, b(%rip)
          movq    p(%rip), %rax
          leaq    (%rax), %rax
          clzero
          movl    c(%rip), %eax
          addl    %eax, d(%rip)
          movl    a(%rip), %eax
          addl    %eax, b+4(%rip)
          xorl    %eax, %eax
          retq


Repository:
  rL LLVM

https://reviews.llvm.org/D29385





More information about the llvm-commits mailing list