Language: C

#include <x86intrin.h>
#include <stdio.h>
// #include <bits/stdc++.h>
// using namespace std;

 
// using tpl = tuple<char, int>;
// typedef pair<int,int> pii;
// typedef long long ll;

// void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

#define ALIGNED(n) __attribute((aligned(n)))


// struct TimeWatch{
//   clock_t start_,end_;
//   void start(){start_=clock();}
//   double stop(){return (double)(clock()-start_)/CLOCKS_PER_SEC;}
// };


int N;
ALIGNED(16) int A[1000100];
ALIGNED(16) int B[1000100];

// void print(__m128i a){
//     ALIGNED(16) int C[4];
//     _mm_store_si128(reinterpret_cast<__m128i*>(C), a);
//     for(int i = 0; i < 4; i++){
//         cout << C[i] << " ";
//     }
//     cout << endl;
// }


#define ONE_SEQUENCE(b)        \
    c = _mm_add_epi32(a1, b);  \
    d = _mm_xor_si128(c, d);   \
    c = _mm_add_epi32(a2, b);  \
    d = _mm_xor_si128(c, d);   \
    c = _mm_add_epi32(a3, b);  \
    d = _mm_xor_si128(c, d);   \
    c = _mm_add_epi32(a4, b);  \
    d = _mm_xor_si128(c, d);   \
    

int calc(int *A, int *B, int N){
    int i, j;

    __m128i d = {0};

    const int shift1 = (2 << 6) | (1 << 4) | (0 << 2) | (3 << 0);
    const int shift2 = (1 << 6) | (0 << 4) | (3 << 2) | (2 << 0);
    const int shift3 = (0 << 6) | (3 << 4) | (2 << 2) | (1 << 0);

    for(i = 0; i < N / 4; i++){
        __m128i a1 = _mm_load_si128((__m128i*)(&A[i*4]));
        __m128i a2 = _mm_shuffle_epi32(a1, shift1);
        __m128i a3 = _mm_shuffle_epi32(a1, shift2);
        __m128i a4 = _mm_shuffle_epi32(a1, shift3);

        __m128i *p = (__m128i*)(B);
        for(j = 0; j < N / 24; j++){
            __m128i c;

            __m128i b1 = _mm_load_si128(p + j * 6);
            __m128i b2 = _mm_load_si128(p + j * 6 + 1);
            __m128i b3 = _mm_load_si128(p + j * 6 + 2);
            __m128i b4 = _mm_load_si128(p + j * 6 + 3);
            __m128i b5 = _mm_load_si128(p + j * 6 + 4);
            __m128i b6 = _mm_load_si128(p + j * 6 + 5);

            ONE_SEQUENCE(b1);
            ONE_SEQUENCE(b2);
            ONE_SEQUENCE(b3);
            ONE_SEQUENCE(b4);
            ONE_SEQUENCE(b5);
            ONE_SEQUENCE(b6);
        }
    }


    ALIGNED(16) int C[4];
    _mm_store_si128((__m128i*)(C), d);

    int res = 0;
    for(i = 0; i < 4; i++){
        res ^= C[i];
    }

    // 端数の計算
    for(i = N / 24 * 24; i < N; i++){
        for(j = 0; j < N; j++){
            res ^= (A[j] + B[i]);
        }
    }

    for(i = N / 4 * 4; i < N; i++){
        for(j = 0; j < N / 24 * 24; j++){
            res ^= (B[j] + A[i]);
        }
    }
    return res;
 }


// void simple(){
//     int ans = 0;
//     for(int i = 0; i < N; i++){
//         for(int j = 0; j < N; j++){
//             ans ^= A[i] + B[j];
//         }
//     }
//     cout << ans << endl;
// }

void simd(){
    printf("%d\n", calc(A, B, N));
    // cout << calc(A, B, N) << endl;
}

// typedef long long ll;
// // xor_shift
// ll make_rand(){
//   static ll x=123456789;
//   static ll y=362436069;
//   static ll z=521288629;
//   static ll w=88675123;
//   ll t;
//   t=x^(x<<11);
//   x=y;y=z;z=w;
//   return w=(w^(w>>19))^(t^(t>>8));
// }


int main(){

    int i;
    scanf("%d", &N);
    for(i = 0; i < N; i++) scanf("%d", A + i);
    for(i = 0; i < N; i++) scanf("%d", B + i);

    // N = 200000;
    // for(int i = 0; i < N; i++) A[i] = make_rand() % (1 << 28);
    // for(int i = 0; i < N; i++) B[i] = make_rand() % (1 << 28);

    //simple();
    simd();

    return 0;
}


Compiler output:
In file included from /usr/lib/gcc/x86_64-linux-gnu/14/include/xmmintrin.h:1322,
                 from /usr/lib/gcc/x86_64-linux-gnu/14/include/immintrin.h:31,
                 from /usr/lib/gcc/x86_64-linux-gnu/14/include/x86intrin.h:32,
                 from main.c:1:
main.c: In function 'calc':
main.c:59:22: error: the last argument must be an 8-bit immediate
   59 |         __m128i a2 = _mm_shuffle_epi32(a1, shift1);
      |                      ^~~~~~~~~~~~~~~~~
main.c:60:22: error: the last argument must be an 8-bit immediate
   60 |         __m128i a3 = _mm_shuffle_epi32(a1, shift2);
      |                      ^~~~~~~~~~~~~~~~~
main.c:61:22: error: the last argument must be an 8-bit immediate
   61 |         __m128i a4 = _mm_shuffle_epi32(a1, shift3);
      |                      ^~~~~~~~~~~~~~~~~