1# Blackfin testcase for setting all ASTAT bits via CC 2# mach: bfin 3 4# We encode the opcodes directly since we test reserved bits 5# which lack an insn in the ISA for it. It's a 16bit insn; 6# the low 8 bits are always 0x03 while the encoding for the 7# high 8 bits are: 8# bit 7 - direction 9# 0: CC=...; 10# 1: ...=CC; 11# bit 6/5 - operation 12# 0: = assignment 13# 1: | bit or 14# 2: & bit and 15# 3: ^ bit xor 16# bit 4-0 - the bit in ASTAT to access 17 18 .include "testutils.inc" 19 20 .macro _do dir:req, op:req, bit:req, bit_in:req, cc_in:req, bg_val:req, bit_out:req, cc_out:req 21 /* CC = CC; is invalid, so skip it */ 22 .if \bit != 5 23 24 /* Calculate the before and after ASTAT values */ 25 imm32 R1, (\bg_val & ~((1 << \bit) | (1 << 5))) | (\bit_in << \bit) | (\cc_in << 5); 26 imm32 R3, (\bg_val & ~((1 << \bit) | (1 << 5))) | (\bit_out << \bit) | (\cc_out << 5); 27 28 /* Test the actual opcode */ 29 ASTAT = R1; 30 .byte (\dir << 7) | (\op << 5) | \bit 31 .byte 0x03 32 R2 = ASTAT; 33 34 /* Make sure things line up */ 35 CC = R3 == R2; 36 IF !CC JUMP 1f; 37 JUMP 2f; 381: fail 392: 40 .endif 41 42 /* Recurse through all the bits */ 43 .if \bit > 0 44 _do \dir, \op, \bit - 1, \bit_in, \cc_in, \bg_val, \bit_out, \cc_out 45 .endif 46 .endm 47 48 /* Test different background fields on ASTAT */ 49 .macro do dir:req, op:req, bit_in:req, cc_in:req, bit_out:req, cc_out:req 50 _do \dir, \op, 31, \bit_in, \cc_in, 0, \bit_out, \cc_out 51 _do \dir, \op, 31, \bit_in, \cc_in, -1, \bit_out, \cc_out 52 .endm 53 54 start 55 nop; 56 57_cc_eq_bit: /* CC = bit */ 58 do 0, 0, 0, 0, 0, 0 59 do 0, 0, 0, 1, 0, 0 60 do 0, 0, 1, 0, 1, 1 61 do 0, 0, 1, 1, 1, 1 62_bit_eq_cc: /* bit = CC */ 63 do 1, 0, 0, 0, 0, 0 64 do 1, 0, 0, 1, 1, 1 65 do 1, 0, 1, 0, 0, 0 66 do 1, 0, 1, 1, 1, 1 67 68_cc_or_bit: /* CC |= bit */ 69 do 0, 1, 0, 0, 0, 0 70 do 0, 1, 0, 1, 0, 1 71 do 0, 1, 1, 0, 1, 1 72 do 0, 1, 1, 1, 1, 1 73_bit_or_cc: /* bit |= CC */ 74 do 1, 1, 0, 0, 0, 0 75 do 1, 1, 0, 1, 1, 1 76 do 1, 1, 1, 0, 1, 0 77 do 1, 1, 1, 1, 1, 1 78 79_cc_and_bit: /* CC &= bit */ 80 do 0, 2, 0, 0, 0, 0 81 do 0, 2, 0, 1, 0, 0 82 do 0, 2, 1, 0, 1, 0 83 do 0, 2, 1, 1, 1, 1 84_bit_and_cc: /* bit &= CC */ 85 do 1, 2, 0, 0, 0, 0 86 do 1, 2, 0, 1, 0, 1 87 do 1, 2, 1, 0, 0, 0 88 do 1, 2, 1, 1, 1, 1 89 90_cc_xor_bit: /* CC ^= bit */ 91 do 0, 3, 0, 0, 0, 0 92 do 0, 3, 0, 1, 0, 1 93 do 0, 3, 1, 0, 1, 1 94 do 0, 3, 1, 1, 1, 0 95_bit_xor_cc: /* bit ^= CC */ 96 do 1, 3, 0, 0, 0, 0 97 do 1, 3, 0, 1, 1, 1 98 do 1, 3, 1, 0, 1, 0 99 do 1, 3, 1, 1, 0, 1 100 101 pass 102