1 2 /* This isn't really an x86 specific test. It checks for an 3 iropt CSE failure that appeared in 3.2.2: 4 5 ex: the `impossible' happened: 6 eqIRConst 7 vex storage: T total 68337344 bytes allocated 8 9 valgrind: the 'impossible' happened: 10 LibVEX called failure_exit(). 11 ==23986== at 0x38017803: report_and_quit (m_libcassert.c:136) 12 ==23986== by 0x38017941: panic (m_libcassert.c:210) 13 ==23986== by 0x38017997: vgPlain_core_panic_at (m_libcassert.c:215) 14 ==23986== by 0x380179B5: vgPlain_core_panic (m_libcassert.c:220) 15 ==23986== by 0x3802A650: failure_exit (m_translate.c:487) 16 ==23986== by 0x38071678: vpanic (vex_util.c:225) 17 ==23986== by 0x3806A1B0: eqIRConst (irdefs.c:2576) 18 ==23986== by 0x3810BB84: do_cse_BB (iropt.c:2279) 19 ==23986== by 0x3810CBBD: do_iropt_BB (iropt.c:4208) 20 ==23986== by 0x3807010B: LibVEX_Translate (vex_main.c:478) 21 ==23986== by 0x38029365: vgPlain_translate (m_translate.c:1097) 22 ==23986== by 0x38037610: vgPlain_scheduler (scheduler.c:693) 23 ==23986== by 0x38052FBE: run_a_thread_NORETURN (syswrap-linux.c:87) 24 */ 25 26 #include <stdio.h> 27 28 int main ( void ) 29 { 30 /* This bombs 3.2.2 w/ V128 non-match in eqIRConst. */ 31 printf("V128 cse:\n"); 32 __asm__ __volatile__( 33 "xorps %%xmm0,%%xmm0\n\t" 34 "movaps %%xmm1,%%xmm2\n\t" 35 "addps %%xmm0,%%xmm1\n\t" 36 "addps %%xmm0,%%xmm2\n\t" 37 "addps %%xmm1,%%xmm2\n\t" 38 : : : "xmm0","xmm1", "st" 39 ); 40 41 /* This ought to cause it to fail w/ F64i non-match in eqIRConst, 42 but it doesn't. I don't understand why not. */ 43 printf("F64i cse:\n"); 44 __asm__ __volatile__( 45 "fninit\n\t" 46 47 "fldz\n\t" 48 "fldz\n\t" 49 "fstp %%st(4)\n\t" 50 "fstp %%st(3)\n\t" 51 52 "fldpi\n\t" 53 "fldpi\n\t" 54 "fsqrt\n\t" 55 "fxch %%st(1)\n\t" 56 "fsqrt\n\t" 57 "faddp %%st(1)\n\t" 58 59 : : : "st" 60 ); 61 return 0; 62 } 63