Annotation of qemu/tests/xtensa/test_mac16.S, revision 1.1.1.1

1.1       root        1: .include "macros.inc"
                      2: 
                      3: test_suite mac16
                      4: 
                      5: #define ext16(v) (((v) & 0xffff) | (((v) & 0x8000) * 0x1ffffffe))
                      6: #define mul16(a, b) ((ext16(a) * ext16(b)))
                      7: 
                      8: .macro assert_acc_value v
                      9:     rsr     a4, ACCLO
                     10:     movi    a5, (\v) & 0xffffffff
                     11:     assert  eq, a4, a5
                     12:     rsr     a4, ACCHI
                     13:     movi    a5, (\v) >> 32
                     14:     sext    a5, a5, 7
                     15:     assert  eq, a4, a5
                     16: .endm
                     17: 
                     18: .macro init_reg sr, reg, val
                     19:     .if (\sr)
                     20:     movi    a4, \val
                     21:     wsr     a4, \reg
                     22:     .else
                     23:     movi    \reg, \val
                     24:     .endif
                     25: .endm
                     26: 
                     27: .macro test_mulxx mulop, comb, s, t, a, b
                     28:     init_reg \comb & 2, \s, \a
                     29:     init_reg \comb & 1, \t, \b
                     30: 
                     31:     \mulop\().ll \s, \t
                     32:     assert_acc_value mul16(\a, \b)
                     33: 
                     34:     \mulop\().lh \s, \t
                     35:     assert_acc_value mul16(\a, (\b >> 16))
                     36: 
                     37:     \mulop\().hl \s, \t
                     38:     assert_acc_value mul16((\a >> 16), \b)
                     39: 
                     40:     \mulop\().hh \s, \t
                     41:     assert_acc_value mul16((\a >> 16), (\b >> 16))
                     42: .endm
                     43: 
                     44: test mul_aa
                     45:     test_mulxx mul.aa, 0, a2, a3, 0xf7315a5a, 0xa5a5137f
                     46: test_end
                     47: 
                     48: test mul_ad
                     49:     test_mulxx mul.ad, 1, a2, m2, 0xf7315a5a, 0xa5a5137f
                     50: test_end
                     51: 
                     52: test mul_da
                     53:     test_mulxx mul.da, 2, m1, a3, 0xf7315a5a, 0xa5a5137f
                     54: test_end
                     55: 
                     56: test mul_dd
                     57:     test_mulxx mul.dd, 3, m0, m3, 0xf7315a5a, 0xa5a5137f
                     58: test_end
                     59: 
                     60: 
                     61: .macro init_acc iv
                     62:     movi    a4, (\iv) & 0xffffffff
                     63:     wsr     a4, ACCLO
                     64:     movi    a4, (\iv) >> 32
                     65:     wsr     a4, ACCHI
                     66: .endm
                     67: 
                     68: .macro test_mulxxx mulop, comb, s, t, a, b, iv, op
                     69:     init_reg \comb & 2, \s, \a
                     70:     init_reg \comb & 1, \t, \b
                     71: 
                     72:     init_acc \iv
                     73:     \mulop\().ll \s, \t
                     74:     assert_acc_value (\iv \op mul16(\a, \b))
                     75: 
                     76:     init_acc \iv
                     77:     \mulop\().lh \s, \t
                     78:     assert_acc_value (\iv \op mul16(\a, (\b >> 16)))
                     79: 
                     80:     init_acc \iv
                     81:     \mulop\().hl \s, \t
                     82:     assert_acc_value (\iv \op mul16((\a >> 16), \b))
                     83: 
                     84:     init_acc \iv
                     85:     \mulop\().hh \s, \t
                     86:     assert_acc_value (\iv \op mul16((\a >> 16), (\b >> 16)))
                     87: .endm
                     88: 
                     89: 
                     90: test mula_aa
                     91:     test_mulxxx mula.aa, 0, a2, a3, 0xf7315a5a, 0xa5a5137f, 0xfff73155aa, +
                     92: test_end
                     93: 
                     94: test mula_ad
                     95:     test_mulxxx mula.ad, 1, a2, m2, 0xf7315a5a, 0xa5a5137f, 0xfff73155aa, +
                     96: test_end
                     97: 
                     98: test mula_da
                     99:     test_mulxxx mula.da, 2, m1, a3, 0xf7315a5a, 0xa5a5137f, 0x0ff73155aa, +
                    100: test_end
                    101: 
                    102: test mula_dd
                    103:     test_mulxxx mula.dd, 3, m0, m3, 0xf7315a5a, 0xa5a5137f, 0x0ff73155aa, +
                    104: test_end
                    105: 
                    106: 
                    107: test muls_aa
                    108:     test_mulxxx muls.aa, 0, a2, a3, 0xf7315a5a, 0xa5a5137f, 0x0ff73155aa, -
                    109: test_end
                    110: 
                    111: test muls_ad
                    112:     test_mulxxx muls.ad, 1, a2, m2, 0xf7315a5a, 0xa5a5137f, 0x0ff73155aa, -
                    113: test_end
                    114: 
                    115: test muls_da
                    116:     test_mulxxx muls.da, 2, m1, a3, 0xf7315a5a, 0xa5a5137f, 0xfff73155aa, -
                    117: test_end
                    118: 
                    119: test muls_dd
                    120:     test_mulxxx muls.dd, 3, m0, m3, 0xf7315a5a, 0xa5a5137f, 0xfff73155aa, -
                    121: test_end
                    122: 
                    123: test ldinc
                    124:     movi    a2, 1f - 4
                    125:     ldinc   m0, a2
                    126:     movi    a3, 1f
                    127:     assert  eq, a2, a3
                    128:     rsr     a3, m0
                    129:     movi    a4, 0x55aa137f
                    130:     assert  eq, a3, a4
                    131:     ldinc   m1, a2
                    132:     movi    a3, 1f + 4
                    133:     assert  eq, a2, a3
                    134:     rsr     a3, m1
                    135:     movi    a4, 0x12345678
                    136:     assert  eq, a3, a4
                    137: 
                    138: .data
                    139: 1:  .word 0x55aa137f, 0x12345678, 0x137fa5a5
                    140: .text
                    141: test_end
                    142: 
                    143: test lddec
                    144:     movi    a2, 1f
                    145:     lddec   m2, a2
                    146:     movi    a3, 1f - 4
                    147:     assert  eq, a2, a3
                    148:     rsr     a3, m2
                    149:     movi    a4, 0x12345678
                    150:     assert  eq, a3, a4
                    151:     lddec   m3, a2
                    152:     movi    a3, 1f - 8
                    153:     assert  eq, a2, a3
                    154:     rsr     a3, m3
                    155:     movi    a4, 0x55aa137f
                    156:     assert  eq, a3, a4
                    157: .data
                    158:     .word 0x55aa137f, 0x12345678
                    159: 1:
                    160: .text
                    161: test_end
                    162: 
                    163: 
                    164: .macro test_mulxxx_ld mulop, ldop, comb, w, x, s, t, a, b, iv, op
                    165:     init_reg \comb & 2, \s, \a
                    166:     init_reg \comb & 1, \t, \b
                    167: 
                    168:     init_acc \iv
                    169:     \mulop\().ll.\ldop \w, \x, \s, \t
                    170:     assert_acc_value (\iv \op mul16(\a, \b))
                    171: 
                    172:     init_acc \iv
                    173:     \mulop\().lh.\ldop \w, \x, \s, \t
                    174:     assert_acc_value (\iv \op mul16(\a, (\b >> 16)))
                    175: 
                    176:     init_acc \iv
                    177:     \mulop\().hl.\ldop \w, \x, \s, \t
                    178:     assert_acc_value (\iv \op mul16((\a >> 16), \b))
                    179: 
                    180:     init_acc \iv
                    181:     \mulop\().hh.\ldop \w, \x, \s, \t
                    182:     assert_acc_value (\iv \op mul16((\a >> 16), (\b >> 16)))
                    183: .endm
                    184: 
                    185: test mula_da_ldinc
                    186:     movi    a2, 1f - 4
                    187:     test_mulxxx_ld mula.da, ldinc, 2, m1, a2, m1, a3, \
                    188:         0xf7315a5a, 0xa5a5137f, 0x0ff73155aa, +
                    189:     movi    a3, 1f + 12
                    190:     assert  eq, a2, a3
                    191:     rsr     a2, m1
                    192:     movi    a3, 0x12345678
                    193:     assert  eq, a2, a3
                    194: .data
                    195: 1:  .word 0xf7315a5a, 0xf7315a5a, 0xf7315a5a, 0x12345678
                    196: .text
                    197: test_end
                    198: 
                    199: test mula_dd_ldinc
                    200:     movi    a2, 1f - 4
                    201:     test_mulxxx_ld mula.dd, ldinc, 3, m2, a2, m1, m2, \
                    202:         0xf7315a5a, 0xa5a5137f, 0x0ff73155aa, +
                    203:     movi    a3, 1f + 12
                    204:     assert  eq, a2, a3
                    205:     rsr     a2, m2
                    206:     movi    a3, 0x12345678
                    207:     assert  eq, a2, a3
                    208: .data
                    209: 1:  .word 0xa5a5137f, 0xa5a5137f, 0xa5a5137f, 0x12345678
                    210: .text
                    211: test_end
                    212: 
                    213: test mula_da_lddec
                    214:     movi    a2, 1f
                    215:     test_mulxxx_ld mula.da, lddec, 2, m1, a2, m1, a3, \
                    216:         0xf7315a5a, 0xa5a5137f, 0x0ff73155aa, +
                    217:     movi    a3, 1f - 16
                    218:     assert  eq, a2, a3
                    219:     rsr     a2, m1
                    220:     movi    a3, 0x12345678
                    221:     assert  eq, a2, a3
                    222: .data
                    223:     .word 0x12345678, 0xf7315a5a, 0xf7315a5a, 0xf7315a5a
                    224: 1:
                    225: .text
                    226: test_end
                    227: 
                    228: test mula_dd_lddec
                    229:     movi    a2, 1f
                    230:     test_mulxxx_ld mula.dd, lddec, 3, m2, a2, m1, m2, \
                    231:         0xf7315a5a, 0xa5a5137f, 0x0ff73155aa, +
                    232:     movi    a3, 1f - 16
                    233:     assert  eq, a2, a3
                    234:     rsr     a2, m2
                    235:     movi    a3, 0x12345678
                    236:     assert  eq, a2, a3
                    237: .data
                    238:     .word 0x12345678, 0xa5a5137f, 0xa5a5137f, 0xa5a5137f
                    239: 1:
                    240: .text
                    241: test_end
                    242: 
                    243: test_suite_end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.