cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

test-i386-pcmpistri.c (690B)


      1/* Test pcmpistri instruction.  */
      2
      3#include <nmmintrin.h>
      4#include <stdio.h>
      5
      6union u {
      7    __m128i x;
      8    unsigned char uc[16];
      9};
     10
     11union u s0 = { .uc = { 0 } };
     12union u s1 = { .uc = "abcdefghijklmnop" };
     13union u s2 = { .uc = "bcdefghijklmnopa" };
     14union u s3 = { .uc = "bcdefghijklmnab" };
     15
     16int
     17main(void)
     18{
     19    int ret = 0;
     20    if (_mm_cmpistri(s0.x, s0.x, 0x4c) != 15) {
     21        printf("FAIL: pcmpistri test 1\n");
     22        ret = 1;
     23    }
     24    if (_mm_cmpistri(s1.x, s2.x, 0x4c) != 15) {
     25        printf("FAIL: pcmpistri test 2\n");
     26        ret = 1;
     27    }
     28    if (_mm_cmpistri(s1.x, s3.x, 0x4c) != 16) {
     29        printf("FAIL: pcmpistri test 3\n");
     30        ret = 1;
     31    }
     32    return ret;
     33}