bug279698.c revision 8f943afc22a6a683b78271836c8ddc462b4824a9
1/* A very trivial test for undefinedness propagation through
2   saturating narrowing.  Obviously need a much more thorough test.
3*/
4#include <stdio.h>
5#include <assert.h>
6#include "../../memcheck.h"
7int main()
8{
9    unsigned char data[32], vbits[32];
10    __asm__ __volatile__
11       ("movdqu     (%0), %%xmm0 \n"
12        "packuswb %%xmm0, %%xmm0 \n"
13        "movdqu   %%xmm0, 16(%0) \n"
14        ::"r"(data)
15        :"memory","xmm0"
16    );
17    unsigned int res =
18       VALGRIND_GET_VBITS( data, vbits, 32 );
19    assert(res == 1); /* 1 == success */
20    int i, j;
21    for(i=0; i<2; i++) {
22        for(j=0; j<16; j++)
23            printf("%02x ", vbits[i*16+j]);
24        printf("\n");
25    }
26    return 0;
27}
28