https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127481

            Bug ID: 127481
           Summary: Consider implementing bitreverse{qi,hi,si,di}2 using
                    vpshufbitqmb
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Right now we implement bitreverse (e.g. bitreversedi2) for GFNI using
        vmovq   %rdi, %xmm0
        vgf2p8affineqb  $0, .LC0(%rip), %xmm0, %xmm0
        vmovq   %xmm0, %rax
        bswap   %rax
where .LC0 is
.LC0:
        .byte   1
        .byte   2
        .byte   4
        .byte   8
        .byte   16
        .byte   32
        .byte   64
        .byte   -128
        .byte   1
        .byte   2
        .byte   4
        .byte   8
        .byte   16
        .byte   32
        .byte   64
        .byte   -128
It can be also implemented using
        vpbroadcastq    %rdi, %zmm0
        vpshufbitqmb    .LC1(%rip), %zmm0, %k0
        kmovq   %k0, %rax
where .LC1 is
.LC1:
        .byte   63
        .byte   62
        .byte   61
        .byte   60
        .byte   59
        .byte   58
        .byte   57
        .byte   56
        .byte   55
        .byte   54
        .byte   53
        .byte   52
        .byte   51
        .byte   50
        .byte   49
        .byte   48
        .byte   47
        .byte   46
        .byte   45
        .byte   44
        .byte   43
        .byte   42
        .byte   41
        .byte   40
        .byte   39
        .byte   38
        .byte   37
        .byte   36
        .byte   35
        .byte   34
        .byte   33
        .byte   32
        .byte   31
        .byte   30
        .byte   29
        .byte   28
        .byte   27
        .byte   26
        .byte   25
        .byte   24
        .byte   23
        .byte   22
        .byte   21
        .byte   20
        .byte   19
        .byte   18
        .byte   17
        .byte   16
        .byte   15
        .byte   14
        .byte   13
        .byte   12
        .byte   11
        .byte   10
        .byte   9
        .byte   8
        .byte   7
        .byte   6
        .byte   5
        .byte   4
        .byte   3
        .byte   2
        .byte   1
        .byte   0
I admit I don't know what from these is faster and if there are CPUs without
GFNI and with AVX512_BITALG or vice versa.

Reply via email to