IRC logs for #openrisc Monday, 2012-07-16

-!- Jia` is now known as Jia05:55
-!- maximi89__ is now known as maximi8908:44
stekernmorning08:46
stekernI've noticed that the arch manual is a bit unclear on how structs should be returned08:47
stekernit only states that the pointer to the struct should be in r1108:48
stekernbut that's not exactly the whole truth08:58
stekernif I have understood correctly, this is how it works (in gcc): the caller function allocates stack for the struct, and passes a pointer to the callee function in r3, the callee function then copies the struct content to this memory area09:01
stekernso what's the r11 actually for?09:01
stekernsince the caller function already has the pointer to the struct (it's in r3)09:02
Jiathe code in gcc is mess, too, and, I'm not sure about this part09:05
stekernI haven't actually looked at the code, just the generated asm09:10
stekernbut it sounds to me that copying the value to r11 is completely redundant, and just put there to "keep it consistent"09:11
Jiakeep it simple and teach me :-)09:13
stekernllvm does it like this "out of the box" as well, but naturally, it doesn't copy the value to r11. I'm tempted to leave it as it is.09:31
stekerns/value/pointer09:32
jeremybennettstekern: It depends on the size of the struct.10:22
jeremybennettSmall ones can be returned by value.10:23
jeremybennettYou'd need to check with amylaar, but I think up to 32 bits in r11 and up to 64 bits in r11/r12.10:24
jeremybennettThere are some other constraints as well I think.10:25
jeremybennettBut you are right, it should be documented.10:25
stekernjeremybennett: ok, so it is even less compliant with what the arch manual is saying?10:25
stekernsince it is stating that a *pointer* to the struct is returned in r1110:25
jeremybennettI think that when the value is returned in memory, then it will also return a pointer to that memory in r11.10:26
jeremybennettI'm doing this from memory - I may be wrong about the small values.10:26
jeremybennettamylaar is the expert, and he'll have taken the existing ABI when the manual doesn't document things.10:27
stekernyeah, but giving the pointer in r11 gives no extra value, since the pointer is already in r3 (if I'm not missing anything)10:27
stekernI'll check the small values10:28
jeremybennettYes - there may be advantages to having the value returned as well (r3 is not callee saved).10:28
stekernok, may be, but the caller will probably just save r3 on the stack and use that10:30
jeremybennettThat would be inefficient - accessing main memory. Let the compiler guarantee the value will be in r11. The worst case is that the value is saved on the stack and restored (same as you doing it). Best case it is a register move.10:31
stekernsmall values go by pointer as well10:37
stekernworst case it is save-restor _and_ register move ;)10:40
jeremybennettstekern: Unlikely though - GCC gets that right with anything above -O0.10:41
stekernbut you're probably right, if nothing else, putting the value in r11 will prevent bug-bites later on10:41
jeremybennettstekern: And you are right that this part of the ABI should be documented!10:42
stekernjeremybennett: (> -O0) nah, it doesn't10:44
stekernit still store-load r3 10:44
stekernah, no sorry I was too quick, it's just using the frame-pointer10:52
stekernsince it is on it's own stack10:52
stekernI still don't think r11 ever will be used10:53
stekernperhaps if the stack offset is larger than what fits in the imm of a load?10:54
stekernnope, then it just use the scavenged offset register10:58
jeremybennettI'm seeing Joern (amylaar) shortly - I'll ask him about it.10:59
stekernyeah, do so, I'll still put a copy into r11, don't worry ;)11:00
stekernI'd be happy to see a case where it'd be used though11:01
maximi89stekern, have you heard of coreboot?13:11
stekernmaximi89: yes, I've heard about it, not particularly familiar with it though, why?13:13
maximi89stekern, just curious of getting a hardware entire created with open specifications, like the raspberry13:19
stekernhmm, yeah sure... but isn't coreboot (mostly) x86?13:23
stekernyou know that we have u-boot support for openrisc?13:23
maximi89something you told me the other day13:23
maximi89my router use uboot13:24
maximi89as far as I know13:24
maximi89with OpenWRT13:24
stekernI don't recall telling you that the other day13:25
maximi89does this project use uclinux?13:25
maximi89in some devices?13:25
stekernno, linux13:25
maximi89directly :O13:26
maximi89RISC it's a type of work of the logical gates or the arquitecture? or it applies for both?13:28
stekernhttp://en.wikipedia.org/wiki/Reduced_instruction_set_computing13:28
maximi89yeah i am reading xd13:28
maximi89the instruction supported by the old RISC specified there are the ASM code right?13:36
stekernhmm, what?13:37
maximi89the "instruction" who talk the wiki are the assembler code supported by that chips am right?13:38
stekernerr, still not quite get what you are asking... instructions are instructions, assembler code is a way to express a list of instructions in a human readable form13:40
maximi89thanks13:40
maximi89more clear13:41
maximi89time to sleep, back tomorrow 7am here XD13:44
maximi89good night13:45
stekernnight13:47

Generated by irclog2html.py 2.15.2 by Marius Gedminas - find it at mg.pov.lt!