1#include<stdio.h> 2#include<assert.h> 3 4int main() 5{ 6 int rd, rs, rt, dsp; 7 int result, resultdsp; 8 9 rs = 0x80001234; 10 rt = 0x80004321; 11 result = 0x7FFFAAAB; 12 13 __asm 14 ("mulq_s.w %0, %1, %2\n\t" 15 : "=r"(rd) 16 : "r"(rs), "r"(rt) 17 ); 18 assert(rd == result); 19 20 rs = 0x80000000; 21 rt = 0x80000000; 22 result = 0x7FFFFFFF; 23 resultdsp = 1; 24 25 __asm 26 ("mulq_s.w %0, %2, %3\n\t" 27 "rddsp %1\n\t" 28 : "=r"(rd), "=r"(dsp) 29 : "r"(rs), "r"(rt) 30 ); 31 dsp = (dsp >> 21) & 0x01; 32 assert(rd == result); 33 assert(dsp == resultdsp); 34 35 return 0; 36} 37