diff options
author | Peter Johnson <peter@tortall.net> | 2009-01-14 08:34:22 +0000 |
---|---|---|
committer | Peter Johnson <peter@tortall.net> | 2009-01-14 08:34:22 +0000 |
commit | b1710263e90ee44e7dfb3969fa90e844a8dfd749 (patch) | |
tree | 95c8eae51e935382003519f81613f66f1b3bf99b | |
parent | 5624364e9096be838dcdb872ee88d704968b4048 (diff) | |
download | yasm-b1710263e90ee44e7dfb3969fa90e844a8dfd749.tar.gz |
Add file missed in previous commit.
Contributed by: Mark Charney, Intel Corporation
svn path=/trunk/yasm/; revision=2171
-rwxr-xr-x | modules/arch/x86/tests/gen-fma-test.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/modules/arch/x86/tests/gen-fma-test.py b/modules/arch/x86/tests/gen-fma-test.py new file mode 100755 index 00000000..a8f4e025 --- /dev/null +++ b/modules/arch/x86/tests/gen-fma-test.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +def emit(opcode,suffix,width,order,optype): + d = {} + d['opcode']=opcode + d['suffix']=suffix + d['order']=order + if width == 128: + d['op1']= 'xmm1' + d['op2']= 'xmm2' + d['op3']= 'xmm3' + if optype == 'rrr': + d['op3']= 'xmm3' + elif suffix == 'pd': + d['op3']= 'dqword [rax]' + elif suffix == 'sd': + d['op3']= 'qword [rax]' + elif suffix == 'ss': + d['op3']= 'dword [rax]' + else: + d['op1']= 'ymm1' + d['op2']= 'ymm2' + if optype == 'rrr': + d['op3']= 'ymm3' + else: + d['op3']= 'yword [rax]' + + + print "v%(opcode)s%(order)s%(suffix)s %(op1)s, %(op2)s, %(op3)s" % (d) + if optype == 'rrm': + d['op3']= '[rax]' + print "v%(opcode)s%(order)s%(suffix)s %(op1)s, %(op2)s, %(op3)s" % (d) + +def gen(opcodes, combos, optypes, orders): + for opcode in opcodes: + for (suffix,width) in combos: + for order in orders: + for optype in optypes: + emit(opcode,suffix,width,order,optype) + + +if __name__ == '__main__': + orders = ['132', '231', '213'] + + all_combos = [('ss',128), + ('sd',128), + ('ps',128), + ('ps',256), + ('pd',128), + ('pd',256) ] + packed_combos = [ ('ps',128), + ('ps',256), + ('pd',128), + ('pd',256) ] + + opcodes1 = ['fmadd', 'fmsub', 'fnmadd', 'fnmsub'] + opcodes2 = ['fmaddsub', 'fmsubadd'] + + optypes = ['rrr','rrm'] + + print "[bits 64]" + gen(opcodes1, all_combos,optypes, orders) + gen(opcodes2, packed_combos,optypes, orders) |