1#include "io.h" 2 3int main(void) 4{ 5 long long rd, rs, rt; 6 long long dsp; 7 long long result; 8 9 rs = 0xFFFFFFFF; 10 rt = 0x10101010; 11 result = 0x100F100F; 12 __asm 13 ("addq_s.ph %0, %1, %2\n\t" 14 : "=r"(rd) 15 : "r"(rs), "r"(rt) 16 ); 17 if (rd != result) { 18 printf("1 addq_s.ph wrong\n"); 19 20 return -1; 21 } 22 23 rs = 0x3712847D; 24 rt = 0x0031AF2D; 25 result = 0x37438000; 26 __asm 27 ("addq_s.ph %0, %1, %2\n\t" 28 : "=r"(rd) 29 : "r"(rs), "r"(rt) 30 ); 31 32 __asm 33 ("rddsp %0\n\t" 34 : "=r"(dsp) 35 ); 36 37 if ((rd != result) || (((dsp >> 20) & 0x01) != 1)) { 38 printf("2 addq_s.ph wrong\n"); 39 40 return -1; 41 } 42 43 rs = 0x7fff847D; 44 rt = 0x0031AF2D; 45 result = 0x7fff8000; 46 __asm 47 ("addq_s.ph %0, %1, %2\n\t" 48 : "=r"(rd) 49 : "r"(rs), "r"(rt) 50 ); 51 52 __asm 53 ("rddsp %0\n\t" 54 : "=r"(dsp) 55 ); 56 57 if ((rd != result) || (((dsp >> 20) & 0x01) != 1)) { 58 printf("3 addq_s.ph wrong\n"); 59 60 return -1; 61 } 62 63 rs = 0x8030847D; 64 rt = 0x8a00AF2D; 65 result = 0xffffffff80008000; 66 __asm 67 ("addq_s.ph %0, %1, %2\n\t" 68 : "=r"(rd) 69 : "r"(rs), "r"(rt) 70 ); 71 72 __asm 73 ("rddsp %0\n\t" 74 : "=r"(dsp) 75 ); 76 77 if ((rd != result) || (((dsp >> 20) & 0x01) != 1)) { 78 printf("4 addq_s.ph wrong\n"); 79 80 return -1; 81 } 82 83 return 0; 84} 85