1/* 2 * tests for arithmetic instruction relaxation 3 * 4 * Author: libin 5 */ 6 7.include "relaxation_macro.h" 8 9.macro _arith_op_pattern insn insn1 10 insn_32 "\insn r0, r0, r15" 11 12 tran_16_32 "\insn! r0, r15", "\insn r0, r0, r15" 13 14 /* shouldn't alter */ 15 .set r1 16 insn_32 "\insn1 r0, r0, r15" 17 insn_32 "\insn r0, r0, r16" 18 insn_32 "\insn r16, r16, r0" 19 insn_32 "\insn r16, r16, r17" 20 insn_32 "\insn r0, r1, r2" 21.endm 22 23.text 24/* add rD,rA,rB -> add! rD,rA */ 25_arith_op_pattern "add", "add.c" 26 27/* sub rD,rA,rB -> sub rD,rA */ 28_arith_op_pattern "sub", "sub.c" 29 30/* addi rD,SImm16 -> addi! rD,SImm6 */ 31insn_32 "addi r0, -32" 32insn_32 "addi r0, 31" 33insn_32 "addi r15, -32" 34insn_32 "addi r15, 31" 35 36tran_16_32 "addi! r0,-32", "addi r0,-32" 37 38/* shouldn't alter */ 39insn_32 "addi.c r0, -32" 40insn_32 "addi r0, -33" 41insn_32 "addi r0, 32" 42insn_32 "addi r16, -32" 43insn_32 "addi r16, 31" 44