1*073d9f2cSAleksandar Markovic #include<stdio.h> 2*073d9f2cSAleksandar Markovic #include<assert.h> 3*073d9f2cSAleksandar Markovic 4*073d9f2cSAleksandar Markovic int main() 5*073d9f2cSAleksandar Markovic { 6*073d9f2cSAleksandar Markovic int rd, rs, rt, dsp; 7*073d9f2cSAleksandar Markovic int result, resultdsp; 8*073d9f2cSAleksandar Markovic 9*073d9f2cSAleksandar Markovic rs = 0x87654321; 10*073d9f2cSAleksandar Markovic rt = 0x11111111; 11*073d9f2cSAleksandar Markovic result = 0x76543210; 12*073d9f2cSAleksandar Markovic resultdsp = 0x00; 13*073d9f2cSAleksandar Markovic 14*073d9f2cSAleksandar Markovic __asm 15*073d9f2cSAleksandar Markovic ("subu.ph %0, %2, %3\n\t" 16*073d9f2cSAleksandar Markovic "rddsp %1\n\t" 17*073d9f2cSAleksandar Markovic : "=r"(rd), "=r"(dsp) 18*073d9f2cSAleksandar Markovic : "r"(rs), "r"(rt) 19*073d9f2cSAleksandar Markovic ); 20*073d9f2cSAleksandar Markovic dsp = (dsp >> 20) & 0x01; 21*073d9f2cSAleksandar Markovic assert(dsp == resultdsp); 22*073d9f2cSAleksandar Markovic assert(rd == result); 23*073d9f2cSAleksandar Markovic 24*073d9f2cSAleksandar Markovic rs = 0x87654321; 25*073d9f2cSAleksandar Markovic rt = 0x12345678; 26*073d9f2cSAleksandar Markovic result = 0x7531ECA9; 27*073d9f2cSAleksandar Markovic resultdsp = 0x01; 28*073d9f2cSAleksandar Markovic 29*073d9f2cSAleksandar Markovic __asm 30*073d9f2cSAleksandar Markovic ("subu.ph %0, %2, %3\n\t" 31*073d9f2cSAleksandar Markovic "rddsp %1\n\t" 32*073d9f2cSAleksandar Markovic : "=r"(rd), "=r"(dsp) 33*073d9f2cSAleksandar Markovic : "r"(rs), "r"(rt) 34*073d9f2cSAleksandar Markovic ); 35*073d9f2cSAleksandar Markovic dsp = (dsp >> 20) & 0x01; 36*073d9f2cSAleksandar Markovic assert(dsp == resultdsp); 37*073d9f2cSAleksandar Markovic assert(rd == result); 38*073d9f2cSAleksandar Markovic 39*073d9f2cSAleksandar Markovic return 0; 40*073d9f2cSAleksandar Markovic } 41