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

            Bug ID: 91275
           Summary: __builtin_crypto_vpmsumd gives different results
                    -O[123] vs -O0
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cand at gmx dot com
  Target Milestone: ---
              Host: ppc64le
            Target: ppc64le

C:
#include <stdio.h>
#include <altivec.h>

int main() {

        const unsigned long long r0l = 0x8e7dfceac070e3a0;
        vector unsigned long long r0 = (vector unsigned long long) {r0l, 0}, v;
        const vector unsigned long long pd = (vector unsigned long) {0xc2LLU <<
56, 0};

        v = __builtin_crypto_vpmsumd((vector unsigned long long) {r0[0], 0},
pd);

        printf("Got      %016lx %016lx\n", v[0], v[1]);
        printf("Expected %016lx %016lx\n", 0x4000000000000000,
0x65bd7ab605a4a8ff);

        return 0;
}

$ gcc -o bug bug.c && ./bug
Got      4000000000000000 65bd7ab605a4a8ff
Expected 4000000000000000 65bd7ab605a4a8ff

$ gcc -o bug bug.c -O1 && ./bug
Got      65bd7ab605a4a8ff 4000000000000000
Expected 4000000000000000 65bd7ab605a4a8ff

--

Note that I'm not sure which is wrong, -O0 or -O1-3, but certainly one of them
is.

Reply via email to