1#include<stdio.h> 2#include<assert.h> 3 4 5int main() 6{ 7 int rd, rs, rt; 8 int result; 9 10 rt = 0x10017EFD; 11 rs = 0x11111111; 12 result = 0x2112900e; 13 14 __asm 15 ("addq_s.w %0, %1, %2\n\t" 16 : "=r"(rd) 17 : "r"(rs), "r"(rt) 18 ); 19 assert(rd == result); 20 21 rt = 0x80017EFD; 22 rs = 0x81111111; 23 result = 0x80000000; 24 25 __asm 26 ("addq_s.w %0, %1, %2\n\t" 27 : "=r"(rd) 28 : "r"(rs), "r"(rt) 29 ); 30 assert(rd == result); 31 32 rt = 0x7fffffff; 33 rs = 0x01111111; 34 result = 0x7fffffff; 35 36 __asm 37 ("addq_s.w %0, %1, %2\n\t" 38 : "=r"(rd) 39 : "r"(rs), "r"(rt) 40 ); 41 assert(rd == result); 42 43 return 0; 44} 45