test_dsp_r1_shll_qb.c (1068B)
1#include<stdio.h> 2#include<assert.h> 3 4int main() 5{ 6 int rd, rt, dsp; 7 int result, resultdsp; 8 9 rt = 0x87654321; 10 result = 0x87654321; 11 resultdsp = 0x00; 12 13 __asm 14 ("wrdsp $0\n\t" 15 "shll.qb %0, %2, 0x00\n\t" 16 "rddsp %1\n\t" 17 : "=r"(rd), "=r"(dsp) 18 : "r"(rt) 19 ); 20 dsp = (dsp >> 22) & 0x01; 21 assert(dsp == resultdsp); 22 assert(rd == result); 23 24 rt = 0x87654321; 25 result = 0x38281808; 26 resultdsp = 0x01; 27 28 __asm 29 ("wrdsp $0\n\t" 30 "shll.qb %0, %2, 0x03\n\t" 31 "rddsp %1\n\t" 32 : "=r"(rd), "=r"(dsp) 33 : "r"(rt) 34 ); 35 dsp = (dsp >> 22) & 0x01; 36 assert(dsp == resultdsp); 37 assert(rd == result); 38 39 rt = 0x00000001; 40 result = 0x00000080; 41 resultdsp = 0x00; 42 43 __asm 44 ("wrdsp $0\n\t" 45 "shll.qb %0, %2, 0x07\n\t" 46 "rddsp %1\n\t" 47 : "=r"(rd), "=r"(dsp) 48 : "r"(rt) 49 ); 50 dsp = (dsp >> 22) & 0x01; 51 assert(dsp == resultdsp); 52 assert(rd == result); 53 54 return 0; 55}