addi1.s 6.34 KB
/****************************************************************
  This program tests the instruction: addi
 ****************************************************************/

#include "suregre.h"

.base 0x04001000

	LI(r0 , 0xFFFF, 0xFFFF);
	LI(r1 , 0x0101, 0x0101);
	LI(r2 , 0x0202, 0x0202);
	LI(r3 , 0x0303, 0x0303);
	LI(r4 , 0x0404, 0x0404);
	LI(r5 , 0x0505, 0x0505);
	LI(r6 , 0x0606, 0x0606);
	LI(r7 , 0x0707, 0x0707);
	LI(r8 , 0x0808, 0x0808);
	LI(r9 , 0x0909, 0x0909);
	LI(r10, 0x0A0A, 0x0A0A);
	LI(r11, 0x0B0B, 0x0B0B);
	LI(r12, 0x0C0C, 0x0C0C);
	LI(r13, 0x0D0D, 0x0D0D);
	LI(r14, 0x0E0E, 0x0E0E);
	LI(r15, 0x0F0F, 0x0F0F);
	LI(r16, 0x1010, 0x1010);
	LI(r17, 0x1111, 0x1111);
	LI(r18, 0x1212, 0x1212);
	LI(r19, 0x1313, 0x1313);
	LI(r20, 0x1414, 0x1414);
	LI(r21, 0x1515, 0x1515);
	LI(r22, 0x1616, 0x1616);
	LI(r23, 0x1717, 0x1717);
	LI(r24, 0x1818, 0x1818);
	LI(r25, 0x1919, 0x1919);
	LI(r26, 0x1A1A, 0x1A1A);
	LI(r27, 0x1B1B, 0x1B1B);
	LI(r28, 0x1C1C, 0x1C1C);
	LI(r29, 0x1D1D, 0x1D1D);
	LI(r30, 0x1E1E, 0x1E1E);
	LI(r31, 0x1F1F, 0x1F1F);
	ChkAluWWI( 1,addi,r5 ,0x0505,0x0505,r3 ,0x0000,0x0000,0x0000,0x0000,0x0000,r2 )
	ChkAluWWI( 2,addi,r6 ,0x0606,0x0606,r4 ,0x0001,0x0001,0x0002,0x0001,0x0001,r3 )
	ChkAluWWI( 3,addi,r7 ,0x0707,0x0707,r5 ,0x0003,0x0002,0x0005,0x0002,0x0002,r4 )
	ChkAluWWI( 4,addi,r8 ,0x0808,0x0808,r6 ,0x0007,0x0004,0x000B,0x0004,0x0004,r5 )
	ChkAluWWI( 5,addi,r9 ,0x0909,0x0909,r7 ,0x000F,0x0008,0x0017,0x0008,0x0008,r6 )
	ChkAluWWI( 6,addi,r10,0x0A0A,0x0A0A,r8 ,0x001F,0x0010,0x002F,0x0010,0x0010,r7 )
	ChkAluWWI( 7,addi,r11,0x0B0B,0x0B0B,r9 ,0x003F,0x0020,0x005F,0x0020,0x0020,r8 )
	ChkAluWWI( 8,addi,r12,0x0C0C,0x0C0C,r10,0x007F,0x0040,0x00BF,0x0040,0x0040,r9 )
	ChkAluWWI( 9,addi,r13,0x0D0D,0x0D0D,r11,0x00FF,0x0080,0x017F,0x0080,0x0080,r10)
	ChkAluWWI(10,addi,r14,0x0E0E,0x0E0E,r12,0x01FF,0x0100,0x02FF,0x0100,0x0100,r11)
	ChkAluWWI(11,addi,r15,0x0F0F,0x0F0F,r13,0x03FF,0x0200,0x05FF,0x0200,0x0200,r12)
	ChkAluWWI(12,addi,r16,0x1010,0x1010,r14,0x07FF,0x0400,0x0BFF,0x0400,0x0400,r13)
	ChkAluWWI(13,addi,r17,0x1111,0x1111,r15,0x0FFF,0x0800,0x17FF,0x0800,0x0800,r14)
	ChkAluWWI(14,addi,r18,0x1212,0x1212,r16,0x1FFF,0x1000,0x2FFF,0x1000,0x1000,r15)
	ChkAluWWI(15,addi,r19,0x1313,0x1313,r17,0x3FFF,0x2000,0x5FFF,0x2000,0x2000,r16)
	ChkAluWWI(16,addi,r20,0x1414,0x1414,r18,0x7FFF,0x4000,0xBFFF,0x4000,0x4000,r17)
	ChkAluWWI(17,addi,r21,0x1515,0x1515,r19,0xFFFF,0x8000,0x7FFF,0x8000,0x8000,r18)
	ChkAluWWI(18,addi,r22,0x1616,0x1616,r20,0x0001,0x0000,0x0002,0x0000,0x0001,r19)
	ChkAluWWI(19,addi,r23,0x1717,0x1717,r21,0x0003,0x0000,0x0005,0x0000,0x0002,r20)
	ChkAluWWI(20,addi,r24,0x1818,0x1818,r22,0x0007,0x0000,0x000B,0x0000,0x0004,r21)
	ChkAluWWI(21,addi,r25,0x1919,0x1919,r23,0x000F,0x0000,0x0017,0x0000,0x0008,r22)
	ChkAluWWI(22,addi,r26,0x1A1A,0x1A1A,r24,0x001F,0x0000,0x002F,0x0000,0x0010,r23)
	ChkAluWWI(23,addi,r27,0x1B1B,0x1B1B,r25,0x003F,0x0000,0x005F,0x0000,0x0020,r24)
	ChkAluWWI(24,addi,r28,0x1C1C,0x1C1C,r26,0x007F,0x0000,0x00BF,0x0000,0x0040,r25)
	ChkAluWWI(25,addi,r29,0x1D1D,0x1D1D,r27,0x00FF,0x0000,0x017F,0x0000,0x0080,r26)
	ChkAluWWI(26,addi,r30,0x1E1E,0x1E1E,r28,0x01FF,0x0000,0x02FF,0x0000,0x0100,r27)
	ChkAluWWI(27,addi,r2 ,0x0000,0x0000,r29,0x03FF,0x0000,0x05FF,0x0000,0x0200,r28)
	ChkAluWWI(28,addi,r3 ,0x0001,0x0002,r30,0x07FF,0x0000,0x0BFF,0x0000,0x0400,r29)
	ChkAluWWI(29,addi,r4 ,0x0002,0x0005,r2 ,0x0FFF,0x0000,0x17FF,0x0000,0x0800,r30)
	ChkAluWWI(30,addi,r5 ,0x0004,0x000B,r3 ,0x1FFF,0x0000,0x2FFF,0x0000,0x1000,r2 )
	ChkAluWWI(31,addi,r6 ,0x0008,0x0017,r4 ,0x3FFF,0x0000,0x5FFF,0x0000,0x2000,r3 )
	ChkAluWWI(32,addi,r7 ,0x0010,0x002F,r5 ,0x7FFF,0x0000,0xBFFF,0x0000,0x4000,r4 )
	ChkAluWWI(33,addi,r8 ,0x0020,0x005F,r6 ,0xFFFF,0x0000,0x7FFF,0x0000,0x8000,r5 )
	ChkAluWWI(34,addi,r9 ,0x0040,0x00BF,r7 ,0x8001,0x0FFF,0x9001,0x1000,0x1000,r6 )
	ChkAluWWI(35,addi,r10,0x0080,0x017F,r8 ,0x8003,0x1FFF,0xA003,0x2000,0x2000,r7 )
	ChkAluWWI(36,addi,r11,0x0100,0x02FF,r9 ,0x8007,0x3FFF,0xC007,0x4000,0x4000,r8 )
	ChkAluWWI(37,addi,r12,0x0200,0x05FF,r10,0x800F,0x8000,0x000F,0x8000,0x8000,r9 )
	ChkAluWWI(38,addi,r13,0x0400,0x0BFF,r11,0x801F,0x0000,0x801F,0x0001,0x0000,r10)
	ChkAluWWI(39,addi,r14,0x0800,0x17FF,r12,0x803F,0x0001,0x803F,0x0002,0x0000,r11)
	ChkAluWWI(40,addi,r15,0x1000,0x2FFF,r13,0x807F,0x0003,0x807F,0x0004,0x0000,r12)
	ChkAluWWI(41,addi,r16,0x2000,0x5FFF,r14,0x80FF,0x0007,0x80FF,0x0008,0x0000,r13)
	ChkAluWWI(42,addi,r17,0x4000,0xBFFF,r15,0x81FF,0x000F,0x81FF,0x0010,0x0000,r14)
	ChkAluWWI(43,addi,r18,0x8000,0x7FFF,r16,0x83FF,0x001F,0x83FF,0x0020,0x0000,r15)
	ChkAluWWI(44,addi,r19,0x0000,0x0002,r17,0x87FF,0x003F,0x87FF,0x0040,0x0000,r16)
	ChkAluWWI(45,addi,r20,0x0000,0x0005,r18,0x8FFF,0x007F,0x8FFF,0x0080,0x0000,r17)
	ChkAluWWI(46,addi,r21,0x0000,0x000B,r19,0x9FFF,0x00FF,0x9FFF,0x0100,0x0000,r18)
	ChkAluWWI(47,addi,r22,0x0000,0x0017,r20,0xBFFF,0x01FF,0xBFFF,0x0200,0x0000,r19)
	ChkAluWWI(48,addi,r23,0x0000,0x002F,r21,0xFFFF,0x03FF,0xFFFF,0x0400,0x0000,r20)
	ChkAluWWI(49,addi,r24,0x0000,0x005F,r22,0xFFFF,0x07FF,0xFFFF,0x0800,0x0000,r21)
	ChkAluWWI(50,addi,r25,0x0000,0x00BF,r23,0xFFFF,0x8000,0x0000,0x8000,0x0001,r22)
	ChkAluWWI(51,addi,r26,0x0000,0x017F,r24,0xFFFF,0xC000,0x0002,0xC000,0x0003,r23)
	ChkAluWWI(52,addi,r27,0x0000,0x02FF,r25,0xFFFF,0xE000,0x0006,0xE000,0x0007,r24)
	ChkAluWWI(53,addi,r28,0x0000,0x05FF,r26,0xFFFF,0xF000,0x000E,0xF000,0x000F,r25)
	ChkAluWWI(54,addi,r29,0x0000,0x0BFF,r27,0xFFFF,0xF800,0x001E,0xF800,0x001F,r26)
	ChkAluWWI(55,addi,r30,0x0000,0x17FF,r28,0xFFFF,0xFC00,0x003E,0xFC00,0x003F,r27)
	ChkAluWWI(56,addi,r2 ,0x0000,0x2FFF,r29,0xFFFF,0xFE00,0x007E,0xFE00,0x007F,r28)
	ChkAluWWI(57,addi,r3 ,0x0000,0x5FFF,r30,0xFFFF,0xFF00,0x00FE,0xFF00,0x00FF,r29)
	ChkAluWWI(58,addi,r4 ,0x0000,0xBFFF,r2 ,0xFFFF,0xFF80,0x01FE,0xFF80,0x01FF,r30)
	ChkAluWWI(59,addi,r5 ,0x0000,0x7FFF,r3 ,0xFFFF,0xFFC0,0x03FE,0xFFC0,0x03FF,r2 )

	ori	r1, r0, 0xFEED;
Fail:	sw	r0, 0xf80(r0);
	sw	r1, 0xf84(r0);
	sw	r2, 0xf88(r0);
	sw	r3, 0xf8c(r0);
	sw	r4, 0xf90(r0);
	sw	r5, 0xf94(r0);
	sw	r6, 0xf98(r0);
	sw	r7, 0xf9c(r0);
	sw	r8, 0xfa0(r0);
	sw	r9, 0xfa4(r0);
	sw	r10, 0xfa8(r0);
	sw	r11, 0xfac(r0);
	sw	r12, 0xfb0(r0);
	sw	r13, 0xfb4(r0);
	sw	r14, 0xfb8(r0);
	sw	r15, 0xfbc(r0);
	sw	r16, 0xfc0(r0);
	sw	r17, 0xfc4(r0);
	sw	r18, 0xfc8(r0);
	sw	r19, 0xfcc(r0);
	sw	r20, 0xfd0(r0);
	sw	r21, 0xfd4(r0);
	sw	r22, 0xfd8(r0);
	sw	r23, 0xfdc(r0);
	sw	r24, 0xfe0(r0);
	sw	r25, 0xfe4(r0);
	sw	r26, 0xfe8(r0);
	sw	r27, 0xfec(r0);
	sw	r28, 0xff0(r0);
	sw	r29, 0xff4(r0);
	sw	r30, 0xff8(r0);
	sw	r31, 0xffc(r0);
	break;