Monday, 2022-04-25

lkclsadoon, apparently not (i just checked, i hadn't before), slightly bizarre.11:22
ghostmansdhooray folks, almost two days, and I've finally implemented the automatic generation for "remapped fields"20:42
ghostmansdexcerpts are here: https://pastebin.com/A7CYHTmG20:43
ghostmansdthis actually is split in two files, all these declarations and definitions, but I've been too lazy to create two pastes20:43
ghostmansdnote that, unlike the previous approach, this relies on macros with masks and shifts, so the calculations should be as fast as they can be20:44
lkclwhoopie-t-doo-dahh20:45
lkclthat looks pretty damn good20:46
lkclbinutils-devs are so going to be either jealous or totally freak out20:47
lkclthis is auto-generated code? moo?20:47
lkcl:)20:47
lkcl    SVP64_RM_EXTRA3_1,20:49
lkclthere should be an SVP64_RM_EXTRA3_220:49
lkclat bits 18,17,16 -> 0,1,220:50
ghostmansdthat's auto-generated20:50
ghostmansdsorry for delay, did some tuning :-)20:50
lkcli mean, for EXTRA2 there's QTY 4of 2-bit indices20:51
lkcland for EXTRA3 there's QTY 3of 3-bit indices20:51
lkclso somewhere in the data structure that defines/generates the fields20:51
lkclan EXTRA3[2] is missing20:51
ghostmansdhm, let me check20:51
lkclhttps://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/consts.py;h=4ec670eba8dbc1110808a85877970c560c54e51e;hb=53681596f91014af0122e9239902859722477045#l20920:52
lkclit's the same indices as SMASK20:53
ghostmansdyehyeh20:53
ghostmansdI know :-)20:53
lkclbecause the same bits... okok :)20:53
ghostmansdseems like that was lost in generator20:53
lkclintriguing20:53
ghostmansdthat's good, because at least SelectableIntMappingMeta works20:53
lkclhoo-ya20:54
ghostmansddogshit20:54
ghostmansdI think I know20:54
ghostmansdfricking Python enums20:54
ghostmansdI'll demonstrate20:54
* lkcl cackles20:54
lkclurr the underlying indices are the same, aren't they?20:55
ghostmansdaha20:55
ghostmansdthat's the issue :-)20:55
ghostmansdPython considers these to be aliases20:55
ghostmansdand, sigh, considers only one of them20:55
lkclngggh20:55
ghostmansddammit20:55
ghostmansdOK, here's __members__20:55
lkclyou mean, the default implementation of enum considers them aliases20:56
ghostmansdaha20:56
lkclgoodbye Enum?20:56
lkclunless the information is accessible via some other way...20:57
ghostmansdhere's what happens: https://pastebin.com/BkzgDR5A21:00
ghostmansdonly __members__ work correctly21:00
ghostmansdand, of course, I already had to use this trick with power.consts, but this behavior is so counter-intuitive that I forgot it, and yet another enum uses tuple(enum) instead of enum.__members__21:01
lkclthat's *so* going to need documenting21:01
ghostmansdit's buried somewhere in Python official docs :-)21:01
lkclfor goodness sake put a one-line comment in each time21:02
lkcl"use __members__.items() due to aliases being dropped" or something21:02
ghostmansdOK, I finally did it21:28
ghostmansdI think in the future I'll refactor the code so that we won't have aliases in the child classes21:28
ghostmansdbit, rather, will augment the key with, for example, enumerate function21:29
ghostmansdso two keys which originally had the same value would end up with different values, thanks to enumerate() call upon iteration21:29
ghostmansdanyway, that'll be later21:30
ghostmansdit's been about 12 hours of work, so I'll rest21:30
ghostmansdhttps://git.libre-soc.org/?p=binutils-gdb.git;a=blob;f=opcodes/ppc-svp64-opc.c;h=a461a92c5571bd0f1eb048e7ba34eb3f417cbd8d;hb=refs/heads/svp6421:32
ghostmansdsorry, here's the URL with correct line21:32
ghostmansdC code: https://git.libre-soc.org/?p=binutils-gdb.git;a=blob;f=opcodes/ppc-svp64-opc.c;h=a461a92c5571bd0f1eb048e7ba34eb3f417cbd8d;hb=refs/heads/svp64#l971521:32
ghostmansdC header: https://git.libre-soc.org/?p=binutils-gdb.git;a=blob;f=include/opcode/ppc-svp64.h;h=18f70ab078b368b2b6b909d6f381b93d8b626f41;hb=refs/heads/svp64#l15921:33
ghostmansdThat's how it looks21:33
ghostmansdOnly 32-bit integers are supported, though it won't be difficult to adopt it for bit vectors of arbitrary size21:34
lkclghostmansd[m], fantastic23:30

Generated by irclog2html.py 2.17.1 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!