1*d901eff3SJia Liu #include <stdio.h> 2*d901eff3SJia Liu 3*d901eff3SJia Liu int main(void) 4*d901eff3SJia Liu { 5*d901eff3SJia Liu int a, b, c; 6*d901eff3SJia Liu int result; 7*d901eff3SJia Liu 8*d901eff3SJia Liu b = 0x9743; 9*d901eff3SJia Liu c = 0x2; 10*d901eff3SJia Liu result = 0x25d0c; 11*d901eff3SJia Liu __asm 12*d901eff3SJia Liu ("l.sll %0, %1, %2\n\t" 13*d901eff3SJia Liu : "=r"(a) 14*d901eff3SJia Liu : "r"(b), "r"(c) 15*d901eff3SJia Liu ); 16*d901eff3SJia Liu if (a != result) { 17*d901eff3SJia Liu printf("sll error\n"); 18*d901eff3SJia Liu return -1; 19*d901eff3SJia Liu } 20*d901eff3SJia Liu 21*d901eff3SJia Liu b = 0x9743; 22*d901eff3SJia Liu result = 0x25d0c; 23*d901eff3SJia Liu __asm 24*d901eff3SJia Liu ("l.slli %0, %1, 0x2\n\t" 25*d901eff3SJia Liu : "=r"(a) 26*d901eff3SJia Liu : "r"(b) 27*d901eff3SJia Liu ); 28*d901eff3SJia Liu if (a != result) { 29*d901eff3SJia Liu printf("slli error\n"); 30*d901eff3SJia Liu return -1; 31*d901eff3SJia Liu } 32*d901eff3SJia Liu 33*d901eff3SJia Liu b = 0x7654; 34*d901eff3SJia Liu c = 0x03; 35*d901eff3SJia Liu result = 0xeca; 36*d901eff3SJia Liu __asm 37*d901eff3SJia Liu ("l.srl %0, %1, %2\n\t" 38*d901eff3SJia Liu : "=r"(a) 39*d901eff3SJia Liu : "r"(b), "r"(c) 40*d901eff3SJia Liu ); 41*d901eff3SJia Liu 42*d901eff3SJia Liu b = 0x7654; 43*d901eff3SJia Liu result = 0xeca; 44*d901eff3SJia Liu __asm 45*d901eff3SJia Liu ("l.srli %0, %1, 0x3\n\t" 46*d901eff3SJia Liu : "=r"(a) 47*d901eff3SJia Liu : "r"(b) 48*d901eff3SJia Liu ); 49*d901eff3SJia Liu if (a != result) { 50*d901eff3SJia Liu printf("srli error\n"); 51*d901eff3SJia Liu return -1; 52*d901eff3SJia Liu } 53*d901eff3SJia Liu 54*d901eff3SJia Liu b = 0x80000001; 55*d901eff3SJia Liu c = 0x4; 56*d901eff3SJia Liu result = 0x18000000; 57*d901eff3SJia Liu __asm 58*d901eff3SJia Liu ("l.ror %0, %1, %2\n\t" 59*d901eff3SJia Liu : "=r"(a) 60*d901eff3SJia Liu : "r"(b), "r"(c) 61*d901eff3SJia Liu ); 62*d901eff3SJia Liu if (a != result) { 63*d901eff3SJia Liu printf("ror error\n"); 64*d901eff3SJia Liu return -1; 65*d901eff3SJia Liu } 66*d901eff3SJia Liu 67*d901eff3SJia Liu b = 0x80000001; 68*d901eff3SJia Liu result = 0x18000000; 69*d901eff3SJia Liu __asm 70*d901eff3SJia Liu ("l.rori %0, %1, 0x4\n\t" 71*d901eff3SJia Liu : "=r"(a) 72*d901eff3SJia Liu : "r"(b) 73*d901eff3SJia Liu ); 74*d901eff3SJia Liu if (a != result) { 75*d901eff3SJia Liu printf("rori error\n"); 76*d901eff3SJia Liu return -1; 77*d901eff3SJia Liu } 78*d901eff3SJia Liu 79*d901eff3SJia Liu b = 0x80000001; 80*d901eff3SJia Liu c = 0x03; 81*d901eff3SJia Liu result = 0xf0000000; 82*d901eff3SJia Liu __asm 83*d901eff3SJia Liu ("l.sra %0, %1, %2\n\t" 84*d901eff3SJia Liu : "=r"(a) 85*d901eff3SJia Liu : "r"(b), "r"(c) 86*d901eff3SJia Liu ); 87*d901eff3SJia Liu if (a != result) { 88*d901eff3SJia Liu printf("sra error\n"); 89*d901eff3SJia Liu return -1; 90*d901eff3SJia Liu } 91*d901eff3SJia Liu 92*d901eff3SJia Liu b = 0x80000001; 93*d901eff3SJia Liu result = 0xf0000000; 94*d901eff3SJia Liu __asm 95*d901eff3SJia Liu ("l.srai %0, %1, 0x3\n\t" 96*d901eff3SJia Liu : "=r"(a) 97*d901eff3SJia Liu : "r"(b) 98*d901eff3SJia Liu ); 99*d901eff3SJia Liu if (a != result) { 100*d901eff3SJia Liu printf("srai error\n"); 101*d901eff3SJia Liu return -1; 102*d901eff3SJia Liu } 103*d901eff3SJia Liu 104*d901eff3SJia Liu return 0; 105*d901eff3SJia Liu } 106