IRC logs for #openrisc Monday, 2012-09-03

-!- mbuf` is now known as mbuf09:25
stekernhmm, I need to compile libgcc with clang (more precisely crtstuff.c to get a -fPIC compiled crtbeginS.o), can I do that with the (G)CC_FOR_TARGET env vars?09:37
stekernok, managed to build them, but in the ugliest way possible...11:02
juliusbewww, compiling libgcc with clang hey?12:46
juliusbhas no one done this linking business for an embedded target before with LLVM?12:46
stekernprobably, but most likely they have gcc with PIC support ;)12:50
stekernrolling your own crtbegin/end is not hard though, I think there even are some freebsd ones, but I don't mind using the ones in libgcc12:51
stekernand I only need the crtbegin/end from libgcc, all other things are in compiler-rt12:52
stekernhmm, things doesn't work well on my 32-bit machine13:25
stekernor1k-linux-as screams about operand out of range13:27
stekernon all -offset14:14
stekernit interprets it as an very large positive offset14:14
stekernjuliusb: you were using a 32-bit machine when you played around with the cgen assembler, right?14:16
juliusbstekern: yep, no 64bit machines in my posession15:10
stekernisn't the amazon a 64-bit?15:11
juliusboh yes but i never did work on it15:14
juliusbjust to host15:14
stekernok, I'll try to bisect what has broke it then15:15
juliusbcare to pastebin the actual barf?15:19
stekernjuliusb: ../test.S:12: Error: operand out of range (1073741820 not between -33554432 and 33554431)16:50
stekernI've bisected it down to
stekernbut it's probably a commit before that that actually contains the change16:52
juliusbstekern: and what is test.S:12?17:29
juliusban l.branch immediate?17:29 1b17:29
stekernand 1: is a couple of instructions above17:30
juliusbohhh ok, should be a label17:30
juliusbnot an immediate17:30
juliusbso labels backwards don't work at all?17:30
juliusboh, but is it that the immediate is getting generated correctly but the assembler says it's out of range?17:31
juliusbwhere would the error be? in the compiler generating the immediate?17:31
stekernand only on 3217:31
stekernno, it's in the assembler17:31
juliusbOK, so the compiler generates 1b?17:32
juliusbor it's not being generated by the compiler?17:32
stekernI have a pure .S as test case17:32
stekernit doesn't matter if the label is foo:17:32
stekernand I think the immediate is 30 bits and the expected is 2617:33
juliusbI'm just looking through the CGEN changes he committed wondering if it's to do with them17:33
stekernI'm typing on my phone so it's hard for me to check, but it should show from the error message17:34
stekernI'm not sure what the correct is, it could be 28 before shifting or 26 after17:37
juliusbPhone keyboard tying sucks17:39
juliusbBut, it looks like we have this for the processing of a 26-bit immediate:17:39
juliusb     ((value pc) (sra WI (sub WI value pc) (const 2)))17:39
juliusb((value pc) (add WI (sll WI value (const 2)) pc)))17:39
juliusbI forget why we have 2 things there, 2 actual arithmetic steps I geuss?17:41
juliusband I even forget how it works17:41
juliusbthat appears to be a common way of doing it17:49
juliusbtake immediateValue - PC, arithmetic shift right 217:50
juliusb(does that get stored as the target PC?)17:50
stekernI guess this is the actual commit that contains the change:
juliusbyeah i'm looing at that commit now17:51
stekernah, ok17:51
juliusbalthough, all he did was change formatting on the df f-disp26 line17:51
stekernyeah, I didn't see anything obvious when quickly browsing through (on the phone)17:52
juliusbbut basically, it takes the difference, eg if you were PC 0x1080 and the immediate was written as -4, I guess it goes sra((0xfffffffc - 0x1080), 2)17:58
juliusbwhich is 0xffffef7c, so sra(0xfffef7c,2) is 0xfffffbdf17:59
juliusband I guess this then gets used in the next calculation, which is add ( sll(0xfffffbdf,2), 0x1080)18:00
juliusbwhich is 0xfffffffc18:01
juliusbthere appears to be no masking info there, other than the bit width of the way it's encoded into the instructino (starting at bit 25, is 26 bits long)18:02
juliusbwhat is a bit odd is that we don't indicate that it's signed18:02
juliusblike i yuo look a bit further down, you see that there's something where u declare that (df ... blahblah) stuff and you say it's a PCREL-ADDR in the case of f-disp26 but for f-simm16 you say ((MACH ORBIS-MACHS) SIGN-OPT)18:03
juliusbbut, perhaps PCREL-ADDR assumes signed, I think it would be silly not to, right?18:03
juliusbso then probaly PCREL is OK18:03
juliusband that weird sra process looks like it's getting done elsewhere18:04
juliusbI mean, in other architectures in CGEN18:04
juliusbI could have interpreted what the CGEN code does completly wrong, though :(18:05
juliusbI can't remember exactly how it works now18:05
juliusbahhh, top one is encode algorith, bottom one is decode algorithm18:15
juliusbthe mode, INT, is right, it's signed, as the only laternative is UINT, which clearly is unsigned18:15
stekernyeah, and that logic didn't change anyway18:21
stekernthe only actual change on that row is the addition of the MACH_ORBIS18:22
juliusbit still could be something which never worked on 64-bit18:23
juliusbI mean, the way the encode/decode is specified18:23
juliusbthe documentation has this example for a very similar thing:18:23
juliusb 18:24
juliusb(df f-disp818:24
juliusb    "disp8, slot unknown" (PCREL-ADDR)18:24
juliusb    8 8 INT18:24
juliusb    ((value pc) (sra WI (sub WI value (and WI pc (const -4))) (const 2)))18:24
juliusb    ((value pc) (add WI (sll WI value (const 2)) (and WI pc (const -4)))))18:24
juliusbThis defines a field called ‘f-disp8’ that is a signed PC-relative address beginning at bit 8 of size 8 bits that is left shifted by 2.18:24
juliusband ours, for those following at home, is:18:24
juliusb     ((value pc) (sra WI (sub WI value pc) (const 2)))18:24
juliusb     ((value pc) (add WI (sll WI value (const 2)) pc)))18:24
juliusbthey appear to mask their PC before doing the subtract18:24
juliusband before doing the add18:25
juliusbbut the immediate it's complaining about: 1073741820, is 30-bits18:27
juliusbso even shifted right by two for encoding it's still too big18:27
stekernnever worked on 64-bit? it's not working on 32-bit18:28
juliusboh sorry, I thought you said it's not working on 64-bit18:28
juliusbthere must be backwards branches going on in the testsuite though, somewhere!18:28
stekernit works fine on 64-bit18:28
juliusbI got it around the wrong way then, sorry18:28
juliusbdoes it work if you do -4?18:29
juliusbbut not if you do backwards_label?18:29
stekernand it works on 32-bit before that commit I bisected down to18:30
juliusbI see a diffrence in the way the PC is defined18:31
juliusbhe's added a "type pc UWI" in the fuller definition18:31
juliusblet me look up what that menas18:31
stekernsame result with -418:32
juliusbyes, that's an interesting change18:32
juliusbhe's declared the PC as unsigned18:32
juliusbwhich, I guess is true18:32
juliusbbut maybe it screws with some of the arithmetic?18:32
stekernsounds like an candidate at least18:33
stekernwhere's that change?18:33
stekernin what file and what was it before?18:34
juliusband try changing (type pc UWI) to just (type pc)18:36
juliusbI've no idea if this  agood idea or not, but... :)18:36
juliusbit's worth a try18:36
juliusbI'm not sure I've built this toolchain recently18:36
juliusbI've managed to convince work to use OpenOCD for something18:37
juliusbso I've been having fun hacking on that lately, is kinda nice18:37
juliusbbut it's for ARM stuff :(18:37
juliusbbut have at least been playing with something open source18:37
juliusband convincing them to go with a nice open source soloution instead of forking out thousands per desk for over the top proprietary debugging solutions18:38
juliusbat least, evaluate it18:38
stekernconvincing the customer I work for to use open source is like banging your head against a waöll ;)18:41
juliusbit's in a way a skunkwords18:47
stekernreverting the pc change didn't cut it18:49
stekernI've found the change among the regenerated ones20:01
stekern-        value = ((SI) (((value) - (pc))) >> (2));20:01
stekern+        value = ((DI) (((value) - (pc))) >> (2));20:01
stekernnot sure what change make it generate that though20:02

Generated by 2.15.2 by Marius Gedminas - find it at!