regtest: broaden none/tests/linux/bug498317 suppression for PPC
[valgrind.git] / none / tests / amd64 / bug487439.cpp
blobf86bb65ce9eb75344715ad6300f18d614632d1dd
1 // This is more or less a copy/paste from the generated insn_sse2.c
2 // I didn't want to mess with the perl generator because
3 // GCC and clang don't agree on the asm syntax
4 // Using the rex prefix looks like a bug or misfeature in OpenJDK
5 // so I'm assuming that this is a one-off and not a general issue
7 #include <iostream>
8 #include <csetjmp>
9 #include <csignal>
11 union reg128_t {
12 char sb[16];
13 unsigned char ub[16];
14 short sw[8];
15 unsigned short uw[8];
16 int sd[4];
17 unsigned int ud[4];
18 long long int sq[2];
19 unsigned long long int uq[2];
20 float ps[4];
21 double pd[2];
22 } __attribute__ ((aligned (16)));
24 static sigjmp_buf catchpoint;
26 static void handle_sigill(int signum)
28 siglongjmp(catchpoint, 1);
31 /* with redundant rex.W */
32 static void psllq_4(void)
34 reg128_t arg1 = { .uq = { 0x0123456789abcdefULL, 0x0123456789abcdefULL } };
35 reg128_t result0;
36 char state[108];
38 if (sigsetjmp(catchpoint, 1) == 0)
40 asm(
41 "ffree %%st(7)\n"
42 "ffree %%st(6)\n"
43 "ffree %%st(5)\n"
44 "ffree %%st(4)\n"
45 "movlps %2, %%xmm1\n"
46 "movhps %3, %%xmm1\n"
47 // only GCC
48 //".rex.W psllq $12, %%xmm1\n"
49 // only clang
50 //"data16 rex64 psllq $12, %mm1\n"
51 ".byte 0x66,0x48,0x0f,0x73,0xf1,0x0c\n"
52 "movlps %%xmm1, %0\n"
53 "movhps %%xmm1, %1\n"
54 "cld\n"
55 : "=m" (result0.uq[0]), "=m" (result0.uq[1])
56 : "m" (arg1.uq[0]), "m" (arg1.uq[1]), "m" (state[0])
57 : "xmm1"
60 if (result0.uq[0] == 0x3456789abcdef000ULL && result0.uq[1] == 0x3456789abcdef000ULL )
62 std::cout << "psllq_4 ... ok\n";
64 else
66 std::cout << "psllq_4 ... not ok\n";
67 std::cout << " result0.uq[0] = " << result0.uq[0] << " (expected " << 0x3456789abcdef000ULL << ")\n";
68 std::cout << " result0.uq[1] = " << result0.uq[1] << " (expected " << 0x3456789abcdef000ULL << ")\n";
71 else
73 std::cout << "psllq_4 ... failed\n";
76 return;
79 int main()
81 signal(SIGILL, handle_sigill);
82 psllq_4();